vpasolve doesn't work with roots for some equations

57 次查看(过去 30 天)
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)
ans = Empty sym: 0-by-1
vpasolve(-1.2068e+21*x - 2.0765e+20==(-2.2185e+10)^2,x)

采纳的回答

Walter Roberson
Walter Roberson 2024-11-25,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 个)

标签

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by