MATLAB Answers

Empty sym: 0-by-1

20 views (last 30 days)
Answered: Walter Roberson on 13 Jul 2020
syms x
c2 = 5.231727664128001e-27;
c1 = 1.6500123538833403e-33;
eqn = c2/2 + (sqrt((x^2/4)+c1))/c1 == log((x/2-sqrt(x^2/4+c1))/(sqrt(x^2/4+c1)-x/2));
I am unable to get any value when I try to solve for x in this equation.


Sign in to comment.

Answers (2)

Mahesh Taparia
Mahesh Taparia on 13 Jul 2020
The function solve is the symbolic solver. You can use vpasolve function to find the solution. For example, for your case:
ans =
1.5089977350351154212617542935339e-35 - 0.000000000000000081240688177374279597779655094221i
To understand the difference between solve and vpasolve, you can refer this documentation.

  1 Comment

Walter Roberson
Walter Roberson on 13 Jul 2020
This solution is invalid, it turns out. If you back-substitute it, the two sides of the equation will not come anywhere close to balancing.

Sign in to comment.

Walter Roberson
Walter Roberson on 13 Jul 2020
The equation has no solutions.
You can use vpasolve() specifying a large number of digits and you will get some answer, but the calculation being done is within tolerances and the tolerances turn out to not be valid for this equation.
If you use too few digits in the solution, then the results can vary quite a bit, making it almost appear that the real portion is probably zero and not showing up as non-zero due to rounding. However, if you use sufficient digits, then the real portion and imaginary portions will settle down. Unfortunately they will not settle into a valid solution.
The x^2/4 + c1 will involve squaring a pretty small number, such that x^2/4 is within round-off of c1. The x^2/4 portion effectively vanishes, leading to invalid solutions. In theory you could balance that term with infinite number of digits... but you cannot really calculate accurately enough with finite number of digits.
But all that does not matter. The algebraic chain that permits you to get far enough to do those calculations, turns out to have a branch cut that cannot be satisfied. When you back-substitute the numeric solutions to the difference between the left and right side of the equation, you get out a real component about 1e-27, but the sign is wrong between the imaginary components, so instead of pi imaginary component on each side canceling out, you end up with 2*pi imaginary component. Though I can't say that I thought to test the complex conjugate to see whether that would work.


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by