Get multiple solutions for one variable from Maxima Solve() - How to get multiple solutions when the variable name is the same? (Assign() is not enough) - Сообщения
I've became an addicted of the Maxima Solve() function, but I am finding some trouble handling cases where one variable has multiple solutions.
Let's say for example that my expression is defined as "x^2-1=0"; the Solve() function will return the correct two solutions for "x" (-1, +1), but they are in boolean format and of not use without an assignment.
Normally I would use the Assign() function to extract and assign the values to the variables, but since the variable name is the same for both solutions, I end up with only one value for "x=+1": I suspect that the Assign function simply loops across the element of the list of solutions and the "x" is overwritten each times, this only the last value on the list is returned.
I know I can access the system of solution returned by the Solve() function by index, but I would like to be able to programmatically save all solutions, or filter down to the valid solution based on a criteria that fit the problem (e.g. I just want positive value for x, or within certain boundary).
I thought I could insert boundary condition (e.g. "x>0" in the system of equations to feed to the Solve() function, but it is not accepted as proper input
I have devised a for-loop to extract all the solutions and convert them to a list (vector) and even filter to just the one I need, but to me it seems a little convoluted for such a common problem that ought to be a better solutions.
filter maxima solve solution.sm (22 КиБ) скачан 64 раз(а).
filter maxima solve solution.pdf (126 КиБ) скачан 58 раз(а).
Lastly, I am aware of the bulit-in solve() function, which will return a vector of solutions, and where I can define the boundary where to find the solution, but I know it does it numerically and will not work if I have some undefined variables (e.g. "x^2-a"). Maybe the maple solve could work if expect only one variable (because solutions are not ordered), but I would like to stick with Maxima.
Is there a better way?
EDIT: attached pdf version
WroteIs there a better way?
Your document does not open incorrect format
Was never clearly explained ... may be caused from your active AV.
Find more in Samples Solve root LAGRANGIAN [few days ago]
You can spline for in-situ calculation.
Solve Inverse [Seeded Scanner_roots].sm (16 КиБ) скачан 45 раз(а).
WroteWroteIs there a better way?
Your document does not open incorrect format
Was never clearly explained ... may be caused from your active AV.
Find more in Samples Solve root LAGRANGIAN [few days ago]
Not sure why you can't open the file, I've tried it on two different machine and for me works fine. What's "active AV"?
By the way I've attached at the original post the pdf version of what the file looks like to me, to avoid misunderstanding with someone that could have different plugin installed from me.
WroteWhat's "active AV"?
AV Anti Virus
It may be my Win 7 not recognizing your Win 10.
Promised *.PDF missing.
However it has some non standard fonts may result misbehave of smath. Manually replacing them with Arial via a text editor shall correct it.
I couldn't check it with maxima since smath linux version doesn't have Maxima support.
But with maple or standard solve() there are solutions.
Regards
filter maxima solve solution - choose.sm (8 КиБ) скачан 60 раз(а).
Best regards.
Alvaro.
WroteI've became an addicted of the Maxima Solve() function, but I am finding some trouble handling cases where one variable has multiple solutions.
That visit will help.
Solve roots LAGRANGIAN.sm (188 КиБ) скачан 41 раз(а).
WroteHowever it has some non standard fonts may result misbehave of smath. Manually replacing them with Arial via a text editor shall correct it.
Gotcha. Haven't thought about font shenanigans!
I couldn't check it with maxima since smath linux version doesn't have Maxima support.
But with maple or standard solve() there are solutions.
Ah, too bad! Maxima is very good and convenient for solving system of equation and multiple variables. Standard solve() will not work if there is an undefined parameter (e.g. "x^2-b"); maple would work though.
WroteHi. You can try this approach.
filter maxima solve solution - choose.sm (8 КиБ) скачан 60 раз(а).
Best regards.
Alvaro.
Thanks! Very interesting use of the at() function, I didn't know it could be used with Boolean also. I not fully understand what the line() does to Solve(), but I tried without and and seen for myself that it will not work without.
WroteI not fully understand what the line() does to Solve(), but I tried without and and seen for myself that it will not work without.
There was a post sent by Razonar why line() needed sometimes. I will try to find it.
..................
the line is local definition.
sols:=]for the double vertical ▄
back space on the 2nd one
in the active ▄ solve(x^2-9,x)
More down the document is of local definition style.
... the function at(3) is used as differential operator.
Wrote... I not fully understand what the line() does to Solve(), but I tried without and and seen for myself that it will not work without.
Hi. line( ) does the same as defining sols (u) = Solve (eq, u)
filter maxima solve solution - line.sm (11 КиБ) скачан 44 раз(а).
Best regards.
Alvaro.
WroteWroteI not fully understand what the line() does to Solve(), but I tried without and and seen for myself that it will not work without.
There was a post sent by Razonar why line() needed sometimes. I will try to find it.
Hi overlord. I don't know which one could be. This is 9 years old: https://en.smath.com/forum/yaf_postsm7966_Function-as-a-program.aspx#post7966
Best regards.
Alvaro.
WroteHi overlord. I don't know which one could be.
This one I guess.
https://en.smath.com/forum/yaf_postsm71525_Functions-as-arguments-of-other-functions.aspx#post71525
-
Новые сообщения
-
Нет новых сообщений