vpasolve and independent equations
Show older comments
Hello,
How does the vpasolve command work and what is the difference between vpasolve and solve ?
I read on a discussion the vpasolve can solve many independent equations without using a loop over single equations. Then I tried and got the following.
>> syms x y z u;
1>> sol = vpasolve([2*x+3, exp(y)-20,log(z+5)+60],[x,y,z]);[sol.x sol.y sol.z] % correct answer
ans =
[ -1.5, 2.9957322735539909934352235761425, -4.9999999999999999999999999912435]
2>> sol = vpasolve([2*x+3, exp(y)-20,log(z+5)+60,1/u+10],[x,y,z,u]);[sol.x sol.y sol.z sol.u] % ??
ans =
[ -1.5, 72.364158219472484524557308589775, - 2.3427240402068111246084751973687e55 - 3.8942786692210248849674644994505e53i, 2.1973620198615687196267013300432e220164446]
3>> sol = vpasolve([2*x+3, exp(y)-20,1/u+10],[x,y,u]);[sol.x sol.y sol.u] % ??
ans =
[ -1.5, 72.395408219472484524557308589775, 7.6288584990871366247428709032065e187034710]
4>> sol = vpasolve([2*x+3,1/u+10],[x,u]);[sol.x sol.u] % correct answer
ans =
[ -1.5, -0.1]
Commands 1 and 4 gave the correct answer that I expected. But I don't understand the results of 2 and 3. 2 is the 1 to which I added one simple equation 1/u+10 ==0. Not only the result of that equation is not correct (in the sens -1/10 that I expect) but also the results of the former equations are affected. I cannot uderstand complex number as result for log(z+5)+60==0. Same thing in 3. then in 4 I supress some equations and I get expected results again. Does anyone understand what is actually done ?
And in the case, how can I solve for many independent equations (like the same equations but with different parameters: e.g. a1*x+b1==0, a2*x+b2==0, ..., an*x+bn ==0) without using a loop over the single equations ?
Thanks.
2 Comments
Walter Roberson
on 17 Aug 2019
vpasolve() uses a modified Newton search. You can look at the innards by using
evalin(symengine,'expose(symobj::vpasolve)')
which will take you to numeric::solve which will take you to numeric::fsolve which is documented https://www.mathworks.com/help/symbolic/mupad_ref/numeric-fsolve.html
Idossou Marius Adom
on 21 Aug 2019
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!