Parametric Intersection point calculation of two curves
1 view (last 30 days)
Show older comments
Hi all. I have a problem with the code below,
inter = solve('x-((y+a)/(x+b))^2','y-((y-a)/(x-b))^2','x','y'); inter.x; inter.y
where the given error is;
_Error using ==> mupadengine.mupadengine>mupadengine.feval at 144 MuPAD error: Error: Recursive definition [See ?MAXDEPTH];
during evaluation of 'ff'
Error in ==> solve at 77 sol = eng.feval('symobj::solvefull',eqns,vars);
Error in ==> newm at 18 inter = solve('x-((y+a)/(x+b))^2','y-((y-a)/(x-b))^2','x','y');_
On the other hand, if I change the parameters a and b with the values 2 and 1 respectively, it works great and reveals 7 intersection points, but I have to find the intersection point functions consisting of a and b. Such as a+2b, a^2-b^2 ....
All help is greatly appreciated.
2 Comments
Roger Stafford
on 4 Sep 2014
As you have stated your problem, there are no simultaneous solutions to your two equations unless a = 0, because you are requiring both y = -a and y = a. If matlab gives you solutions with the substitution a = 2, then matlab would be lying to you. Are you sure you have described your problem accurately?
Accepted Answer
Roger Stafford
on 4 Sep 2014
Edited: Roger Stafford
on 4 Sep 2014
Now that you've corrected your equations, they do have a solution - in fact seven solutions. These can be derived from the roots of a seventh-order polynomial equation. It is impossible for matlab to give a symbolic solution to such an equation, but it can be solved numerically using matlab's 'roots' function. That is the reason you received an error message with symbolic values of a and b, but did receive the solutions when a and b were specified.
The numeric solution can be obtained either by:
t = roots([1,-1,-b,-(a+2*b),4*a-b^2,(2*a-b)*b,(4*a+b^2)*b,-a*(4*a+b^2)]);
x = t.^2;
y = -a+(x+b).*t;
or by specifying a and b values before calling on 'solve', as you did.
As has been proved mathematically, you will never find a symbolic expression for the solution in terms of a and b involving only elementary operations including involution - in other words, those kinds of mathematical operations 'solve' could ordinarily furnish.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!