Work on the function ic2



I had a look at the function ic2, because of three bug reports. In the
testsuite we have only two examples for the function ic2. I think the
first example is correct by accident (one explicit equation) and the
result for the second example is wrong.

At first the example from the testsuite which I think has a wrong
result:

   'diff(y,x,2)+y*('diff(y,x,1))^3 = 0;
   soln2:ode2(%,y,x);
   ratsimp(ic2(soln2,x = 0,y = 0,'diff(y,x,1) = 2));

This is the expected answer, which I think is wrong:

   -((2*y^3-3*y)/6) = x

I will not present the calculation to show that the expected answer is
wrong, but I will show that the following is a correct answer for the
initial problem y(0)=0 and y'(0)=2:

   sol:(y^3+3*y)/6=x

(%i1) depends(y,x)$
(%i2) sol:(y^3+3*y)/6=x$

Because we have an implicit solution we solve it for y:

(%i3) solve(%,y);
(%o3) [y = (-sqrt(3)*%i/2-1/2)*(sqrt(9*x^2+1)+3*x)^(1/3)
         -(sqrt(3)*%i/2-1/2)/(sqrt(9*x^2+1)+3*x)^(1/3),
       y = (sqrt(3)*%i/2-1/2)*(sqrt(9*x^2+1)+3*x)^(1/3)
         -(-sqrt(3)*%i/2-1/2)/(sqrt(9*x^2+1)+3*x)^(1/3),
       y = (sqrt(9*x^2+1)+3*x)^(1/3)-1/(sqrt(9*x^2+1)+3*x)^(1/3)]

We take the real root:

(%i4) sol:ratsimp(third(%));
(%o4) y = ((sqrt(9*x^2+1)+3*x)^(2/3)-1)/(sqrt(9*x^2+1)+3*x)^(1/3)

(%i5) sol:rhs(%);
(%o5) ((sqrt(9*x^2+1)+3*x)^(2/3)-1)/(sqrt(9*x^2+1)+3*x)^(1/3)

The real root is a solution of the differential equation:

(%i6) diff(sol,x,2)+sol*(diff(sol,x))^3,ratsimp;
(%o6) 0

We satisfy the initial values y(0)=0 and y'(0)=2:

(%i7) subst(0,x,sol);
(%o7) 0

(%i8) subst(0,x,diff(sol,x)),ratsimp;
(%o8) 2

If you try the calculation from above with the expected solution from
the testsuite you will not get the shown answers.

I have done the calculation for two further initial problems. First for
y(0)=0 and y'(0)=1 Maxima gives the answer:

   -(y^3-3*y)/3 = x

But the correct answer is:

   (y^3+3*y)/6 = x

For the initial values y(0)=1 and y'(0)=2 Maxima gives the answer

   -(2*y^3-3*y) = -(3*y^2-6*x-4)

but the correct answer is

   y^3/6 = x+1/6

The function ic2 has the following problems:

(1) The algorithm does not work for an implicit solution.
    This has been observed with the bug report ID:2881021.
    But the reported solution does not solve the problem.
    I have already found a correction of the algorithm, which
    gives the correct solutions from above.

(2) The algorithm does not work, if we get a set of solutions from an 
    ode. This has been shown with the bug reports ID:1839088 and
    ID:2997443. At this time, I have not worked out some good examples,
    which shows that the corrected algorithm will work for this case
    too. The examples of the bug reports do not give an error, but they
    seem to be to complicated to give a simple answer.

ic2 is used in the files inteqn.mac, lindstedt.mac, optvar.mac, and
recur.mac. I had no look, if we have reported problems with these
packages.

Dieter Kaiser