-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement symbols for CAS computations #1732
Comments
Thanks for your input Michal. So far we already have |
Well, let x = new math.SymbolNode('x');
let y = new math.SymbolNode('y');
math.evaluate('det( [[ 1, x ],[ y, 0 ]] )', {x, y});
// "Unexpected type of argument in function multiplyScalar (expected: number or Complex or BigNumber or Fraction or Unit or string or boolean, actual: Node, index: 0)" I know Of course the implementation of symbols should leverage the existing functionality. After looking into the Algebra chapter of the docs, I think that allowing arithmetical operations on So should I go ahead and try implementing arithmetics on |
I understand what you mean. The I'm not sure though if that is what you are really looking for. The example you give:
is solving an equation. It may be enough to implement a function Implementing a function |
Thanks for your comment, I'll start working on this in a week! Just to clarify: I didn't mean solving an equation, I really meant computing the determinant with the symbol |
That sounds good :). I don't yet have a clear idea on what you're going to implement exactly and whether that's something generic that we can put in mathjs. "the determinant with the symbol x in the upper right corner and the symbol y in the left bottom corner" sounds very specific to me? |
I started fiddling with the implementation, but I got stuck very early. I wanted to add this overload for the 'Node, any': function(x, y) {
return new OperatorNode('+', 'add', [clone(x), clone(y)])
}, However, when I try to add In a reply to your previous comment: Determinants are used very often in antisymetrization problems, which are quite wide-spread across several disciplines (see Jacobian, Hessian, Wronskian, Slater, Vandermonde determinants), so imho it's one of the operations you'd want to perform on symbols quite often. But I'll make an actual showcase once I have a working prototype :) |
Did you add |
Yes, that's exactly what I did. And this alone was enough to stop the project from |
This is a very valuable idea, and has spurred multiple POCs (including one I did myself), but still is rather more of a Discussion than an issue. Hence, moving. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Advanced CAS systems let users define their own symbols and perform symbolic operations with them. Example in Sympy. Since all math.js functions can operate on complex numbers (that means they have to call
add
andmul
methods instead of JavaScript+
and*
operators), it should be really straightforward to implement something like(EDIT: already implemented asSymbolicExpression
Node
) which behaves like a number but remembers the symbols involved.Example usage:
The text was updated successfully, but these errors were encountered: