vpasolve doesn't work with roots for some equations
51 views (last 30 days)
Show older comments
Benjamin Paik
on 25 Nov 2024 at 4:03
Answered: Walter Roberson
on 25 Nov 2024 at 4:33
Notice the example code below. Both instances are essentially solving the same equation using vpasolve except that in the first case there is a square root on the left hand side while in the second case, both sides of the equation have been squared. MATLAB fails to solve the equation when in the when the square root is present, but has no issues when both sides are squared. How can I get vpasolve to solve the first case.
syms x
vpasolve((-1.2068e+21*x - 2.0765e+20)^(1/2)==-2.2185e+10,x)
vpasolve(-1.2068e+21*x - 2.0765e+20==(-2.2185e+10)^2,x)
0 Comments
Accepted Answer
Walter Roberson
on 25 Nov 2024 at 4:33
vpasolve((-1.2068e+21*x - 2.0765e+20)^(1/2)==-2.2185e+10,x)
The left hand side involves a square root. The right hand side involves a negative number. The ^(1/2) operator returns complex numbers for negatives inside the square root, and returns positive values for positive values inside the square root. It is never the case that the ^(1/2) operator returns a negative value (except possibly a negative real component along with a non-zero complex component.)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!