Problem with vpasolve after specifying range of solutions as [-Inf Inf]

Hi, I seem to have encountered a weird problem with vpasolve when I specify a range of solutions.
I have 'a' defined as a symbolic variable.
After running the script below, 'test1' returned some real, non-trivial solutions from a1 to a4.
test1=vpasolve([a(1)*0.67 + a(4)*0.5 + a(2)*0.1 == 5 ; a(3)*0.3 + a(1)*2== 10])
However, after specifying, a range of solutions for vpasolve(), it returned empty 0x1 sym results in 'test2'
test2=vpasolve([a(1)*0.67 + a(4)*0.5 + a(2)*0.1 == 5 ; a(3)*0.3 + a(1)*2== 10], [a(1:4)],[-inf,inf;-inf,inf;-inf,inf;-inf,inf])
For another test case, I gave vpasolve a different equation with a similar format of having 4 unknowns shown below, but somehow 'test3' was able to return some non-trivial solutions.
test3=vpasolve([a(1)*sin(10*a(4)) + a(2)^3 == 5 ; a(3)^2 + exp(-2*a(1)/3)== 10], [a(1:4)],[-inf,inf;-inf,inf;-inf,inf;-inf,inf])
Would you please help me understand why is this the case? How can I make 'test2' return the same results as 'test1'?
Thank you very much for your time.

7 Comments

But I did not figure out how it happens with infinite limits.
Thank you for your reply. I had spent 3 hours on this probem thinking that I had messed up somewhere else.
I suppose the next step is to find an alternative function.
Would you please point me to an alternative to vpasolve() for an underdetermined system that is similar to 'test2' above (if it exists)?
My equations are generated in a symbolic form so I don't think fsolve() is suitable.
Thank you
You can use matlabFunction() to generate an anonymous numeric function that can be used with fsolve().
Hint: when you call matlabFunction, use the 'vars' option, and use {a} as the argument, assuming that a is a symbolic row vector of variable names.
I see, thank you. However, are there any other functions that can use a symbolic input?
I've been trying to get fsolve to work for more than an hour but I can't get it to work. I am wondering if there are any other options before I delve more into this.
Thank you once again.
I tried the function "lsqlin" (my system of equations are linear as well as underconstrained).
Setting infinite limits returned a correct solution, but when I used a finite numbers that are 5 orders of magnitude larger than the largest number of the solutions, "lsqlin" failed to compute a correct solution.
solve() and vpasolve() are the only symbolic solvers that there is direct access to.
If you are willing to go into MuPAD then there are https://www.mathworks.com/help/symbolic/mupad_ref/linsolve.html and https://www.mathworks.com/help/symbolic/numeric-solvers.html . Note that you need to either "mupad" to use these, or invoke dark rituals involving evalin(symengine).
Hahaha I have no experience with MUPAD and hilarious as "invoke dark rituals" sound, I hope you understand that I'm trying not to make this more difficult than it should be.
Might you have another suggestion?
Something similar to using a matrix like "lsqlin" perhaps? I can use "equationsToMatrix" so something like this would also be acceptable.
Thank you once again.

Sign in to comment.

Answers (0)

Tags

Asked:

on 21 Jun 2018

Commented:

on 21 Jun 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!