0

I have this equation in x and y:

  (x + y)^(1/2) - 6*y*(x + y)^5 - (x + y)^6 + (x - 1)/(2*(x + y)^(1/2)) = 0.

Now I call the solver:

  R_c = @(y)solve((x + y)^(1/2) - 6*y*(x + y)^5 - (x + y)^6 + (x - 1)/(2*(x + y)^(1/2)), x, 'Real', true);

which gives me the implicit solutions as a function of y. Now try

  R_c(.3)

to find the explicit solution at y = 0.3. MATLAB's answer is:

 ans =

 0.42846617518653978966562924618638
 0.15249587894102346284238111155954
 0.12068186494007759990714181154349

However, the last entry in this array is NOT a solution. Test:

 double(subs(subs((x + y)^(1/2) - 6*y*(x + y)^5 - (x + y)^6 + (x - 1)/(2*(x + y)^(1/2)), x, .12068186494007759990714181154349), y, .3))

yields

 -0.0585.

This is not a rounding error. The other 2 solutions work perfectly and solve the equation correctly. I wonder where MATLAB the third value gets from. Can anyone help?

Amro
  • 123,847
  • 25
  • 243
  • 454
tw-S
  • 579
  • 1
  • 5
  • 23
  • Could you explain `R_c = @(y)solve(f == 0, x, 'Real', true);`? What is the purpose of the `y` which is unused? – Daniel Jul 02 '14 at 17:31
  • When I solve f == 0 for x, then I am getting the solutions as a function of y, right? Or how else shall I find these implicit solutions? – tw-S Jul 02 '14 at 17:43
  • Using your code, I don't get the output. `R_c(.3)` returns `x^2 - 1.0*y`. `R_c = @(ry)solve(subs(f,y,ry) == 0, x, 'Real', true);` would make sense, and produces your output. It substitutes y with a double value. – Daniel Jul 02 '14 at 17:48
  • Ok, yeah. But the output seems odd. As I said above, the last value is not a solution to the equation... – tw-S Jul 02 '14 at 17:55
  • 1
    Update your question, the code in the question does not produce the described behaviour. By the way: `syms x; f(x)=(x + 3/10)^(1/2) - (9*(x + 3/10)^5)/5 - (x + 3/10)^6 + (x - 1)/(2*(x + 3/10)^(1/2)); solve(f,'Real',true);` is sufficient to reproduce, I have no idea what's wrong. Probably a Bug in Matlab. – Daniel Jul 02 '14 at 20:16
  • Thanks. Question updated. – tw-S Jul 02 '14 at 20:39

0 Answers0