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)
vpasolve(-1.2068e+21*x - 2.0765e+20==(-2.2185e+10)^2,x)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!