Parametric Intersection point calculation of two curves

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 Kommentare

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?
First thank you for your comment. When I solve inter = solve('x-((y+2)/(x+1))^2','y-((y-2)/(x-1))^2','x','y'); one of the intersection point is x=1.6074447143648524831096114040652 and y=1.3058499038651999353460876987318. I am sure that the x,y values make both equations zero since I checked, however as I mentioned before, I do not need the real solutions but the equations consisting of a and b.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Roger Stafford
Roger Stafford am 4 Sep. 2014
Bearbeitet: Roger Stafford am 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.

1 Kommentar

Thank you for your kind answer. Yes you're right the was a misspelling in the first equation but i am grateful that you got my concern. Nonetheless I understand it right now, perfectly clear :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by