vpasolve doesn't work with roots for some equations

3 vues (au cours des 30 derniers jours)
Benjamin Paik
Benjamin Paik le 25 Nov 2024
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)

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Nov 2024
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.)

Plus de réponses (0)

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by