-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
correct format of matrix #83
Comments
The syntax of the expression parser differs from JavaScript. It is aimed at mathematicians, not at programmers. It's syntax is similar to math applications. Main differences:
The syntax of the expression parser is not yet stable. We recently decided to make the library zero-based, but make the expression parser one-based, see #66. And I'm for example not yet happy with being able to enter 2D matrices only (no vectors or n-dimensional matrices). |
Thanks for the explanation... this is creating an issue, where I need to take toString() output of a previous calculation ...as an input of another calculation... So, what's the reason we are using different syntax...??? |
See #66. As for the matrix notation: on a JavaScript level you just use the regular (nested) Array notation. The
Sounds like you are feeding stringified results back in the expression parser. Maybe you can use variables instead, which you can provide to the |
Sounds like you are feeding stringified results back in the expression parser. That's correct...I tried with using the scope... a = math.eval("[[1,2],[1,2]]") In array notation I am unable to use the matrix node for further calculation.... math.eval("[1,2;1,2]*[1,2;1,2]") Even if I use the scoping thing to reuse my results, as in the above example....It seems it won't work out... |
You are still mixing the notations up :). Try this: a = math.eval("[1,2;1,2]")
b = math.eval("[1,2;1,2]")
scope = {a:a,b:b}
math.eval("a*b", scope) I have been thinking about the issue that you can currently only enter 2 dimensional matrices in the expression parser (matlab/octave style). To solve this, I think I have to remove the concatenation of matrices using the notation |
I have fixed this :). You can try the develop branch already (you will need to build the library first). Allows you to enter nested arrays JavaScript style. |
what's the correct format of matrix...??? getting confused with examples and code...
math.matrix([[5, 6], [1, 1]]) - this creates a matrix...
but following in parser it doesn't work...
math.parse("matrix([[5, 6], [1, 1]])matrix([[5, 6], [1, 1]])").eval()
math.parse("[[5, 6], [1, 1]][[5, 6], [1, 1]]").eval()
following work...
math.parse("matrix([[5, 6]; [1, 1]])matrix([[5, 6]; [1, 1]])").eval()....OR
math.parse("[[5, 6]; [1, 1]][[5, 6]; [1, 1]]").eval()...OR without inner [s...
And also...toString() in matrix returns matrix with rows separated by commas...
What am I missing?
The text was updated successfully, but these errors were encountered: