/* Test cases for contrib_ode utility functions */

(load('contrib_ode), done);
done;

expintegral_e_simp(
 (%e^(2*x+2)+(%e*expintegral_e(1,-x-1)*x-%e*expintegral_e(2,-x-1)
 +%e*expintegral_e(1,-x-1))*%e^x)
 /(%e^2*%c^2*x^2+(2*%e^2*%c^2-2*%e*expintegral_e(2,-x-1)*%c)*x+%e^2*%c^2
   -2*%e*expintegral_e(2,-x-1)*%c+expintegral_e(2,-x-1)^2));
0;

expintegral_e_simp(
 -((2*expintegral_e(1/4,(2*x-1)/4)-2*expintegral_e(-3/4,(2*x-1)/4))*x*(2*x-1)^(3/4)*%e^((4*x-1)/4)+(expintegral_e(5/4,(2*x-1)/4)+2*expintegral_e(1/4,(2*x-1)/4)+expintegral_e(-3/4,(2*x-1)/4))*(2*x-1)^(3/4)*%e^((4*x-1)/4))/(8*x-4));
0;

expintegral_e_simp(
%e^(-x-2)*(2*%e^(2*x+2)+(4*expintegral_e(2,-2*(x+1))-4*expintegral_e(1,-2*(x+1)))*x^2+(6*expintegral_e(2,-2*(x+1))-4*expintegral_e(3,-2*(x+1)))*x-2*expintegral_e(2,-2*(x+1))+4*expintegral_e(1,-2*(x+1))));
0;

expintegral_e_simp(
-%e^(-3*x-5)*(x*((100*expintegral_e(2,5*(x-1))+300*expintegral_e(1,5*(x-1)))*%e^(5*x)-100*%e^5)+500*expintegral_e(1,5*(x-1))*x^2*%e^(5*x)+(160*expintegral_e(2,5*(x-1))-800*expintegral_e(1,5*(x-1)))*%e^(5*x)-160*%e^5));
0;

/* verify that ode1_lie doesn't trigger an error on this problem.
 * contrib_ode doesn't appear to be able to solve it, which is OK, I guess.
 */
block ([foo],
 declare (n, integer),
 foo : contrib_ode ('diff(x, t)^2 = alpha - beta*abs(x)^n, x, t),
 remove (n, integer),
 foo);
false;
