Does Maxima (or indeed any software) allow one to
convert from say, this:
x = cos(theta) * r
y = sin(theta) * r
r = sqrt(xx + yy)
theta = atan2(y,x)
In other words, it will automatically extract the variables
(theta and r), and then have only those to the left of the equals sign.
Here's another more complicated example:
r = sqrt (xx + yy + z*z )
theta = atan2(sqrt(xx + yy),z )
phi = atan2(y,x)
x = r * sin(theta)*cos(phi);
y = r * sin(theta)*sin(phi);
z = r * cos(theta)
Once again, the variables x, y and z are extracted from the
first simultaneous equation.
I tried this:
However, it returns just "". If I replace, x and y with actual numbers, it
seems to work okay, but I need the answer expressed with the variable names
The final thing I need would be for this to work through the
CLI, because I use a programming language, so would like to
feed a text file to the program, and for the program to output
a text file with the solution/s.
(%i1) L1:x = cos(theta)*r$
L2:y = sin(theta)*r$
solve: using arc-trig functions to get a solution.
Some solutions will be lost.
(%i7) L1:r = sqrt (xx + yy + z*z )$
L2:theta = atan2(sqrt(xx + yy),z )$
L3:phi = atan2(y,x)$
Many thanks for your reply - it is appreciated.
I think I've bitten off more than I can chew here, mathematically and
wxmaxima-wise. From your answer, it seems as though there isn't a simple way
from getting from A to B without establishing other criteria (such as the
L:,trigreduce; which I would want to avoid really). I was hoping for a simple
conversion (even if there are multiple answers), but it seems only something
obscure like genetic programming may be fully capable of that?
In other words, I'm probably being naive wanting something like this to work:
(for starters, I'd have to somehow specify that the r variable can't be used
when trying to find theta etc.).
While I think about this some more, I have some much simpler requests which
will help me to use wxmaxima more effectively:
...correctly returns s=-r
...should be the same, but in fact returns just . Any idea why?
One more puzzling thing. This works:
But not this:
I would expect: s=x/r but instead Maxima returns . Again, any
The end of my reply was messed up. I'll post it again here:
...should be the same, but in fact returns just s=0. Any idea why?
I would expect: s=x/r but instead Maxima returns s=0. Again, any ideas?
For equations use = instead of :
(%i1) solve(x=r+s, s);
(%i2) solve(x=r*s, s);
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.