sand15

787 Reputation

11 Badges

9 years, 177 days

MaplePrimes Activity


These are answers submitted by sand15


And after using some trick, here is the result you wanted (whose rendering can likely be improved)
Compare_three_regions_sand15.mw

NULL

restart; with(LinearAlgebra); A := `<,>`(`<|>`(c, 0, 0), `<|>`(0, -1, a), `<|>`(0, b, -1))

p := CharacteristicPolynomial(A, t)

t^3-(-2+c)*t^2-(a*b+2*c-1)*t+b*a*c-c

(1)

z := solve(p, t)

c, -1+(b*a)^(1/2), -1-(b*a)^(1/2)

(2)

s := solve([z[2] < 0, z[3] < 0])

Warning, solutions may have been lost

 

{a <= 0, b < 0, 1/b < a}, {a = a, b = 0}, {0 <= a, 0 < b, a < 1/b}

(3)

plots:-inequal({z[2] < 0, z[3] < 0}, a = -3 .. 3, b = -3 .. 3, color = "Chartreuse")

 

``

for u in [s] do `assuming`([`not`(is(z[2] >= 0))], [op(u)]); `assuming`([is(z[3] < 0)], [op(u)]); print() end do

true

 

true

 

 

true

 

true

 

 

true

 

true

 

(4)

for u in [s] do `assuming`([coulditbe(z[2] < 0)], [op(u)]); `assuming`([coulditbe(z[3] < 0)], [op(u)]); print() end do

true

 

true

 

 

true

 

true

 

 

true

 

true

 

(5)

Download A_way.mw

@Rana47 

The solution I get (note that either I did something wrong, either the reference you provide contains a typo, see eq. (10) in the attached file... but it looks like you made the same observation on yout own).
 

NULL``

restart:

# In the sequel [REF] refers to the paper in your question

PDEtools[declare](f(x), prime = x);
PDEtools[declare](v(x), prime = x);

f(x)*`will now be displayed as`*f

 

`derivatives with respect to`*x*`of functions of one variable will now be displayed with '`

 

v(x)*`will now be displayed as`*v

 

`derivatives with respect to`*x*`of functions of one variable will now be displayed with '`

(1)

ansatz := N -> g(x) = add((p^(i))*f[i](x), i = 0 .. N);

proc (N) options operator, arrow; g(x) = add(p^i*f[i](x), i = 0 .. N) end proc

(2)

HPMEq0 := n -> (1-p)*diff(g(x), x$2)+p*(diff(g(x), x$2)+n*b*(diff(g(x), x))^(n-1)*(diff(g(x), x$2))-k)

proc (n) options operator, arrow; (1-p)*(diff(g(x), `$`(x, 2)))+p*(diff(g(x), `$`(x, 2))+n*b*(diff(g(x), x))^(n-1)*(diff(g(x), `$`(x, 2)))-k) end proc

(3)

# For future comparison.
# I assume that "b could be small"

BandK  := {b=0.2, k=1}:
solnum := dsolve(eval({HPMEq0(5), g(0)=1, D(g)(1)=0}, [b=1, k=1, p=1]), numeric);

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(8, {(1) = .0, (2) = .14336963204980777, (3) = .2900466215145109, (4) = .4353361965030204, (5) = .5785822672734197, (6) = .7199321002245741, (7) = .8601611693890534, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = 1.0, (1, 2) = -.7548776680903789, (2, 1) = .8959450309095821, (2, 2) = -.6947588510066209, (3, 1) = .7993872281187419, (3, 2) = -.6190441277506114, (4, 1) = .7160282275546896, (4, 2) = -.524840529797366, (5, 1) = .6488216303410848, (5, 2) = -.40985288738847253, (6, 1) = .6000220598418652, (6, 2) = -.27839561889214526, (7, 1) = .5706582492352634, (7, 2) = -.13978546046509682, (8, 1) = .560882045183903, (8, 2) = .0}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = -.7548776680903789, (1, 2) = .38115714552830066, (2, 1) = -.6947588510066209, (2, 2) = .46190496326941016, (3, 1) = -.6190441277506114, (3, 2) = .5766111180756199, (4, 1) = -.524840529797366, (4, 2) = .7249610786111673, (5, 1) = -.40985288738847253, (5, 2) = .8763586151412666, (6, 1) = -.27839561889214526, (6, 2) = .97084132113079, (7, 1) = -.13978546046509682, (7, 2) = .9980945844328213, (8, 1) = .0, (8, 2) = 1.0}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(8, {(1) = .0, (2) = .14336963204980777, (3) = .2900466215145109, (4) = .4353361965030204, (5) = .5785822672734197, (6) = .7199321002245741, (7) = .8601611693890534, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.18475853661398794e-8, (2, 1) = -0.11885430084609172e-8, (2, 2) = 0.8073184654949896e-9, (3, 1) = -0.4623005782207097e-8, (3, 2) = -0.4482766175548063e-8, (4, 1) = -0.3811290083323037e-8, (4, 2) = -0.8830999792100185e-8, (5, 1) = 0.10224692181959045e-7, (5, 2) = 0.3863667292630575e-8, (6, 1) = 0.4819434053646237e-8, (6, 2) = 0.10343146017446533e-7, (7, 1) = -0.30369015467116946e-8, (7, 2) = 0.14054598858037295e-8, (8, 1) = -0.3391301075431207e-8, (8, 2) = .0}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.0343146017446533e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [g(x), diff(g(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[g(x), diff(g(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.0343146017446533e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(0..0, {}), (3) = [x, g(x), diff(g(x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[g(x), diff(g(x), x)]'[i] = res[i+1], i = 1 .. 2)] catch: error  end try end proc

(4)

ansatz_order    := 3;
exponent_degree := 5;

# The initial guess corresponding to relation [REF] eq (29).

v[0]  := k/2*(x^2-2*x)+1;
Lv[0] := diff(v[0], x$2);

3

 

5

 

(1/2)*k*(x^2-2*x)+1

 

k

(5)

# Plug the ansatz into HPMEq0:

HPMEq1 := collect(eval(HPMEq0(exponent_degree), ansatz(ansatz_order)), p):

# Derive the successive edos according to [REF] eq (23), (25), (27) and
# generalize.

equ[0] := coeff(HPMEq1, p, 0) - diff(v[0], x$2) = 0;  # [REF] eq 23
for i from 1 to ansatz_order do
  equ[i] := coeff(HPMEq1, p, i) + diff(v[0], x$(i+1)) = 0
end do;

diff(diff(f[0](x), x), x)-k = 0

 

5*b*(diff(f[0](x), x))^4*(diff(diff(f[0](x), x), x))+diff(diff(f[1](x), x), x) = 0

 

20*b*(diff(f[0](x), x))^3*(diff(f[1](x), x))*(diff(diff(f[0](x), x), x))+5*b*(diff(f[0](x), x))^4*(diff(diff(f[1](x), x), x))+diff(diff(f[2](x), x), x) = 0

 

diff(diff(f[3](x), x), x)+5*b*(diff(f[0](x), x))^4*(diff(diff(f[2](x), x), x))+20*b*(diff(f[0](x), x))^3*(diff(f[1](x), x))*(diff(diff(f[1](x), x), x))+5*b*(2*(diff(f[0](x), x))^2*(2*(diff(f[0](x), x))*(diff(f[2](x), x))+(diff(f[1](x), x))^2)+4*(diff(f[0](x), x))^2*(diff(f[1](x), x))^2)*(diff(diff(f[0](x), x), x)) = 0

(6)

# BCs given by eq (21) in the paper you present.

cond[0] := f[0](0) = 1, (D(f[0]))(1) = 0;

# BCs on the successive corrections

for j from 1 to ansatz_order do
  cond[j] := f[j](0) = 0, (D(f[j]))(1) = 0
end do;

f[0](0) = 1, (D(f[0]))(1) = 0

 

f[1](0) = 0, (D(f[1]))(1) = 0

 

f[2](0) = 0, (D(f[2]))(1) = 0

 

f[3](0) = 0, (D(f[3]))(1) = 0

(7)

answers := {dsolve({cond[0], equ[0]})};

for j from 1 to ansatz_order do
  ans := dsolve(eval({cond[j], equ[j]}, answers)):
  answers := answers union {ans}
end do:

#print~(answers):

{f[0](x) = (1/2)*k*x^2-k*x+1}

(8)

# Check if f[1] is equal to the 3rd term in [REF] eq (33)
# (OK)

collect(eval(f[1](x), answers), [b, k]);

(-(1/6)*(x-1)^6+1/6)*k^5*b

(9)

# Check if f[2] is equal to the 4th term in [REF] eq (32a)
# (Not OK: coefficient "5" missing in the numerator,
# could it be an error in [REF]?)

collect(eval(f[2](x), answers), [b, k]);

((1/2)*(x-1)^10-1/2)*k^9*b^2

(10)

# Check [REF] eq (32a)

collect(eval(f[0](x), answers), k)
+
collect(eval(f[1](x), answers), [b, k])
+
collect(eval(f[2](x), answers), [b, k]):

eval(%, [5=n, 1/6=1/(n+1), 9=2*n-1])

1+((1/2)*x^2-x)*k+(-(1/6)*(x-1)^6+1/6)*k^5*b+((1/2)*(x-1)^10-1/2)*k^9*b^2

 

1+((1/2)*x^2-x)*k+(-(1/6)*(x-1)^6+1/(n+1))*k^n*b+((1/2)*(x-1)^10-1/2)*k^(2*n-1)*b^2

(11)

# f[3] is not given in [REF], here is its expression

collect(eval(f[3](x), answers), [b, k])

(-(5/2)*(x-1)^14+5/2)*k^13*b^3

(12)

# Order 3 expansion of the solution

collect(eval(f[0](x), answers), k)
+
collect(eval(f[1](x), answers), [b, k])
+
collect(eval(f[2](x), answers), [b, k])
+
collect(eval(f[3](x), answers), [b, k]);

1+((1/2)*x^2-x)*k+(-(1/6)*(x-1)^6+1/6)*k^5*b+((1/2)*(x-1)^10-1/2)*k^9*b^2+(-(5/2)*(x-1)^14+5/2)*k^13*b^3

(13)

ANSWERS := eval(answers, BandK):

plots:-display(
  plots:-odeplot(solnum, [x, g(x)], x=0..1)
  , plot(eval(eval(rhs(ansatz(0)), p=1), ANSWERS), x=0..1, color=blue, legend="0th order")
  , plot(eval(eval(rhs(ansatz(1)), p=1), ANSWERS), x=0..1, color=green, legend="1st order")
  , plot(eval(eval(rhs(ansatz(2)), p=1), ANSWERS), x=0..1, color=cyan, legend="2nd order")
  , plot(eval(eval(rhs(ansatz(3)), p=1), ANSWERS), x=0..1, color=gold, legend="3rd order")
)

 

plots:-display(
    plot(eval(f[1](x), ANSWERS), x=0..1, color=green, legend="1th order")
  , plot(eval(f[2](x), ANSWERS), x=0..1, color=cyan, legend="2th order")
  , plot(eval(f[3](x), ANSWERS), x=0..1, color=gold, legend="3th order")
)

 

 

``


 

Download hpm_sand15_to_rana47.mw

 

If my previous reply didn't enlighten you, here is a way to proceed
 

NULL

restart:

N := 2:
ansatz := f(x) = add((p^(i))*(f||i)(x), i = 0 .. N) ;

f(x) = f0(x)+p*f1(x)+p^2*f2(x)

(1)

HPMEq0 := (1-p)*(diff(f(x), `$`(x, 3)))+p*(diff(f(x), `$`(x, 3))+2*alpha*RE*(diff(f(x), x))*f(x)+(4-H)*alpha^2*(diff(f(x), x)))

(1-p)*(diff(diff(diff(f(x), x), x), x))+p*(diff(diff(diff(f(x), x), x), x)+2*alpha*RE*(diff(f(x), x))*f(x)+(4-H)*alpha^2*(diff(f(x), x)))

(2)

HPMEq1 := eval(HPMEq0, ansatz)

(1-p)*(diff(diff(diff(f0(x), x), x), x)+p*(diff(diff(diff(f1(x), x), x), x))+p^2*(diff(diff(diff(f2(x), x), x), x)))+p*(diff(diff(diff(f0(x), x), x), x)+p*(diff(diff(diff(f1(x), x), x), x))+p^2*(diff(diff(diff(f2(x), x), x), x))+2*alpha*RE*(diff(f0(x), x)+p*(diff(f1(x), x))+p^2*(diff(f2(x), x)))*(f0(x)+p*f1(x)+p^2*f2(x))+(4-H)*alpha^2*(diff(f0(x), x)+p*(diff(f1(x), x))+p^2*(diff(f2(x), x))))

(3)

for i from 0 to N do
  equ[1][i] := coeff(HPMEq1, p, i) = 0
end do;

diff(diff(diff(f0(x), x), x), x) = 0

 

diff(diff(diff(f1(x), x), x), x)+2*alpha*RE*(diff(f0(x), x))*f0(x)+(4-H)*alpha^2*(diff(f0(x), x)) = 0

 

diff(diff(diff(f2(x), x), x), x)+2*alpha*RE*(diff(f0(x), x))*f1(x)+2*alpha*RE*(diff(f1(x), x))*f0(x)+(4-H)*alpha^2*(diff(f1(x), x)) = 0

(4)

cond[1][0] := f0(0) = 1, (D(f0))(0) = 0, f0(1) = 0;
for j from 1 to N do
  cond[1][j] := (f || j)(0) = 0, (D(f || j))(0) = 0, (f || j)(1) = 0
end do;

f0(0) = 1, (D(f0))(0) = 0, f0(1) = 0

 

f1(0) = 0, (D(f1))(0) = 0, f1(1) = 0

 

f2(0) = 0, (D(f2))(0) = 0, f2(1) = 0

(5)

answers := {dsolve({cond[1][0], equ[1][0]})}

{f0(x) = -x^2+1}

(6)

H := 5;
alpha := (1/180)*(5*3.142);
RE := 10

5

 

0.8727777778e-1

 

10

(7)

for j from 1 to N do
  ans := dsolve(eval({cond[1][j], equ[1][j]}, answers)):
  answers := answers union {ans}
end do:

print~(evalf(answers)):

f0(x) = -1.*x^2+1.

 

f1(x) = -0.2909259260e-1*x^6+.1448281788*x^4-.1157355862*x^2

 

f2(x) = -0.5642526295e-3*x^10+0.5417263546e-2*x^8-0.1512417707e-1*x^6+0.1676177417e-1*x^4-0.6490608021e-2*x^2

(8)

plots:-display(
  plot(eval(f0(x), answers), x=0..1, color=red, legend="0th order"),
  plot(eval(f0(x)+f1(x), answers), x=0..1, color=green, legend="1st order"),
  plot(eval(f0(x)+f1(x)+f2(x), answers), x=0..1, color=blue, legend="2nd order"),
  title="Successive approximations"
)

 

plots:-display(
  plot(eval(f1(x), answers), x=0..1, color=green, legend="1st order"),
  plot(eval(f2(x), answers), x=0..1, color=blue, legend="2nd order"),
  title="Successive corrections"
)

 

 

NULL


 

Download hpm_error_sand15.mw

 

After having corrected the (likely) typo (equal instead of equa) and changed a few  little things:

Download HPM_1.mw

You willsee in the attached file that f0=1=...=0(solving directly the initial ode without even using the ansatz

f = x -> add(p^i*(f||i)(x), i = 0 .. L)

already gives f=0 given the bcs you write.

When on uses this kind of ansatz (small parameter expansion?), one generally set non identivally null bcs for the "trend" (f0) a,d null bcs for the perturbations of successive orders (to guarantee that successive refinments preserve the bcs on f0).

With bcs arbitrarily set to

f0(0)=1, D(f0)(0)=1, f0(1)=0

the attached file shows how to compute (in a step-by-step way) perturbations of increasing orders an thus a sequence of augmented solutions.
Once approved this method could be encapsulated into a specific procedure.

restart

with(PDEtools):

with(plots):

L := 5;

5

(1)

H := 5;

5

 

0.8727777778e-1

 

10

(2)

HO := (1-p)*(diff(f(x), `$`(x, 3))+p*(diff(f(x), `$`(x, 3)))+2*alpha*RE*(diff(f(x), x))*f(x)+(4-H)*alpha^2*(diff(f(x), x)))

(1-p)*(diff(diff(diff(f(x), x), x), x)+p*(diff(diff(diff(f(x), x), x), x))+1.745555556*(diff(f(x), x))*f(x)-0.7617410494e-2*(diff(f(x), x)))

(3)

ansatz := f = (x -> add(p^i*(f || i)(x), i = 0 .. L));

f = (proc (x) options operator, arrow; add(p^i*(f || i)(x), i = 0 .. L) end proc)

(4)

HO1 := eval(HO, ansatz):

 

Zero order solution f0

 

HO1 := collect(expand(HO1), p):

coeff(HO1, p, 0);
sol0 := dsolve({coeff(HO1, p, 0), f0(0)=1, D(f0)(0)=1, f0(1)=0}, numeric);

-0.7617410494e-2*(diff(f0(x), x))+diff(diff(diff(f0(x), x), x), x)+1.745555556*(diff(f0(x), x))*f0(x)

 

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(10, {(1) = .0, (2) = .11078278220502231, (3) = .22364174273643112, (4) = .336400857639379, (5) = .44797504433316043, (6) = .5582094408957031, (7) = .6677790172685235, (8) = .7779200458343468, (9) = .8895341149733956, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 3, {(1, 1) = 1.0, (1, 2) = 1.0, (1, 3) = -3.983477327766739, (2, 1) = 1.0859803004343302, (2, 2) = .549346065085729, (2, 3) = -4.1393578797975605, (3, 1) = 1.121419727242096, (3, 2) = 0.7740148632607177e-1, (3, 3) = -4.207364448156272, (4, 1) = 1.1034190552999128, (4, 2) = -.3960219069400372, (4, 3) = -4.172548043626565, (5, 1) = 1.0334856968721362, (5, 2) = -.8551317943920755, (5, 3) = -4.042652033602019, (6, 1) = .9150351107388788, (6, 2) = -1.290241093967279, (6, 3) = -3.8421142104577206, (7, 1) = .7510656023540799, (7, 2) = -1.6983897118813762, (7, 3) = -3.6049293155861535, (8, 1) = .5426235137367472, (8, 2) = -2.082307479123934, (8, 3) = -3.3711644866560833, (9, 1) = .2896295135416169, (9, 2) = -2.447663710557477, (9, 3) = -3.1893238955632652, (10, 1) = .0, (10, 2) = -2.7947930788176802, (10, 3) = -3.1183169372581445}, datatype = float[8], order = C_order); YP := Matrix(10, 3, {(1, 1) = 1.0, (1, 2) = -3.983477327766739, (1, 3) = -1.737938145506, (2, 1) = .549346065085729, (2, 2) = -4.1393578797975605, (2, 3) = -1.0371772019479302, (3, 1) = 0.7740148632607177e-1, (3, 2) = -4.207364448156272, (3, 3) = -.15092384429708883, (4, 1) = -.3960219069400372, (4, 2) = -4.172548043626565, (4, 3) = .7597529210528466, (5, 1) = -.8551317943920755, (5, 2) = -4.042652033602019, (5, 3) = 1.5361495967515448, (6, 1) = -1.290241093967279, (6, 2) = -3.8421142104577206, (6, 3) = 2.0510023517096023, (7, 1) = -1.6983897118813762, (7, 2) = -3.6049293155861535, (7, 3) = 2.2136969872974745, (8, 1) = -2.082307479123934, (8, 2) = -3.3711644866560833, (8, 3) = 1.9564571436311755, (9, 1) = -2.447663710557477, (9, 2) = -3.1893238955632652, (9, 3) = 1.2188067920130512, (10, 1) = -2.7947930788176802, (10, 2) = -3.1183169372581445, (10, 3) = -0.21289086127144367e-1}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(10, {(1) = .0, (2) = .11078278220502231, (3) = .22364174273643112, (4) = .336400857639379, (5) = .44797504433316043, (6) = .5582094408957031, (7) = .6677790172685235, (8) = .7779200458343468, (9) = .8895341149733956, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.13603335696444332e-7, (2, 1) = 0.7265581332725971e-9, (2, 2) = -0.9179594754749238e-9, (2, 3) = -0.14360711048599372e-7, (3, 1) = 0.935850951586146e-9, (3, 2) = -0.33022746441561657e-8, (3, 3) = -0.15358678429518584e-7, (4, 1) = 0.1523118379956452e-9, (4, 2) = -0.5942457533255831e-8, (4, 3) = -0.14810819342344207e-7, (5, 1) = -0.13595390189336288e-8, (5, 2) = -0.7496861395347225e-8, (5, 3) = -0.13899207188268168e-7, (6, 1) = -0.29580647058515214e-8, (6, 2) = -0.7708912520795418e-8, (6, 3) = -0.15201085345852005e-7, (7, 1) = -0.40645381116283325e-8, (7, 2) = -0.72449801484776965e-8, (7, 3) = -0.20236709048260123e-7, (8, 1) = -0.42352021900713655e-8, (8, 2) = -0.6908010054283183e-8, (8, 3) = -0.28476365215460827e-7, (9, 1) = -0.29553323497707087e-8, (9, 2) = -0.6885055401174663e-8, (9, 3) = -0.3650784387748412e-7, (10, 1) = .0, (10, 2) = -0.6407492020611782e-8, (10, 3) = -0.3661757260073899e-7}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[10] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(3.661757260073899e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [3, 10, [f0(x), diff(f0(x), x), diff(diff(f0(x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[10] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[10] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(3, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(10, 3, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(3, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(10, 3, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[f0(x), diff(f0(x), x), diff(diff(f0(x), x), x)]'[i] = yout[i], i = 1 .. 3)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[10] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(3.661757260073899e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [3, 10, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[10] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[10] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(10, 3, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(3, {(1) = 0., (2) = 0., (3) = 0.}); `dsolve/numeric/hermite`(10, 3, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 3)] end proc, (2) = Array(0..0, {}), (3) = [x, f0(x), diff(f0(x), x), diff(diff(f0(x), x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[f0(x), diff(f0(x), x), diff(diff(f0(x), x), x)]'[i] = res[i+1], i = 1 .. 3)] catch: error  end try end proc

(5)

F0 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(f0(x), sol0(t)));
  end if;
end proc:

dF0 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f0(x), x), x=t), sol0(t)));
  end if;
end proc:

ddF0 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f0(x), x$2), x=t), sol0(t)));
  end if;
end proc:

subs0 := {f0(x)=F0(x), diff(f0(x), x)=dF0(x), diff(f0(x), x$2)=ddF0(x)};

{diff(diff(f0(x), x), x) = ddF0(x), diff(f0(x), x) = dF0(x), f0(x) = F0(x)}

(6)

 

First order correction f1

coeff(HO1, p, 1):
eval(%, subs0);

sol1 := dsolve({%, f1(0)=0, D(f1)(0)=0, f1(1)=0}, f1(x), numeric);

1.745555556*dF0(x)*f1(x)+1.745555556*(diff(f1(x), x))*F0(x)-1.745555556*dF0(x)*F0(x)+diff(diff(diff(f1(x), x), x), x)-0.7617410494e-2*(diff(f1(x), x))+0.7617410494e-2*dF0(x)

 

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(16, {(1) = .0, (2) = 0.6404561717292101e-1, (3) = .13548250894342245, (4) = .2122716707745767, (5) = .2884888958349662, (6) = .3620331204527494, (7) = .4316113205671453, (8) = .4977368087758108, (9) = .5608265805477214, (10) = .6220917756931348, (11) = .6832353851897301, (12) = .7445626983123486, (13) = .8078204843197364, (14) = .8733810552722883, (15) = .9378567463688994, (16) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(16, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.3212187661126076e-2, (2, 1) = 0.6564679961247358e-4, (2, 2) = 0.3114080432866802e-2, (2, 3) = 0.963683331251039e-1, (3, 1) = 0.6087451195508886e-3, (3, 2) = 0.13026771944825986e-1, (3, 3) = .17486744344098132, (4, 1) = 0.21753193364114107e-2, (4, 2) = 0.28279271091437002e-1, (4, 3) = .21419262565092856, (5, 1) = 0.4954626157255434e-2, (5, 2) = 0.44517132006358755e-1, (5, 3) = .20359601897522392, (6, 1) = 0.8738299477267725e-2, (6, 2) = 0.5768688395048585e-1, (6, 3) = .14728647498744749, (7, 1) = 0.1304213815879093e-1, (7, 2) = 0.6497183975446072e-1, (7, 3) = 0.5654829594084956e-1, (8, 1) = 0.17383420415696352e-1, (8, 2) = 0.6507721183392393e-1, (8, 3) = -0.57225106548140114e-1, (9, 1) = 0.212936602529797e-1, (9, 2) = 0.575497509540539e-1, (9, 3) = -.18367691820637957, (10, 1) = 0.2439299425024134e-1, (10, 2) = 0.4227794437310392e-1, (10, 3) = -.3157553158356348, (11, 1) = 0.26304429992423214e-1, (11, 2) = 0.18885964739179e-1, (11, 3) = -.4489745129134839, (12, 1) = 0.2653705961586595e-1, (12, 2) = -0.1260033744207179e-1, (12, 3) = -.5761147465647417, (13, 1) = 0.24506713309364235e-1, (13, 2) = -0.52817579643494386e-1, (13, 3) = -.6921816649495488, (14, 1) = 0.19482793601557198e-1, (14, 2) = -.10148682704173242, (14, 3) = -.7875818778401714, (15, 1) = 0.11253899896994142e-1, (15, 2) = -.15442304708314117, (15, 3) = -.8483267423312889, (16, 1) = .0, (16, 2) = -.2079779482830367, (16, 3) = -.8683725554267051}, datatype = float[8], order = C_order); YP := Matrix(16, 3, {(1, 1) = .0, (1, 2) = -0.3212187661126076e-2, (1, 3) = 1.737938145506, (2, 1) = 0.3114080432866802e-2, (2, 2) = 0.963683331251039e-1, (2, 3) = 1.3552081584558717, (3, 1) = 0.13026771944825986e-1, (3, 2) = .17486744344098132, (3, 3) = .8278280889766552, (4, 1) = 0.28279271091437002e-1, (4, 2) = .21419262565092856, (4, 3) = .1883677603012989, (5, 1) = 0.44517132006358755e-1, (5, 2) = .20359601897522392, (5, 3) = -.46447601588938187, (6, 1) = 0.5768688395048585e-1, (6, 2) = .14728647498744749, (6, 3) = -1.056149999809692, (7, 1) = 0.6497183975446072e-1, (7, 2) = 0.5654829594084956e-1, (7, 3) = -1.535754685752323, (8, 1) = 0.6507721183392393e-1, (8, 2) = -0.57225106548140114e-1, (8, 3) = -1.8859545164871088, (9, 1) = 0.575497509540539e-1, (9, 2) = -.18367691820637957, (9, 3) = -2.102092604529736, (10, 1) = 0.4227794437310392e-1, (10, 2) = -.3157553158356348, (10, 3) = -2.188630853345391, (11, 1) = 0.18885964739179e-1, (11, 2) = -.4489745129134839, (11, 3) = -2.1475052546467324, (12, 1) = -0.1260033744207179e-1, (12, 2) = -.5761147465647417, (12, 3) = -1.9774487568282264, (13, 1) = -0.52817579643494386e-1, (13, 2) = -.6921816649495488, (13, 3) = -1.6703846603530887, (14, 1) = -.10148682704173242, (14, 2) = -.7875818778401714, (14, 3) = -1.2177366978634918, (15, 1) = -.15442304708314117, (15, 2) = -.8483267423312889, (15, 3) = -.6461131491510258, (16, 1) = -.2079779482830367, (16, 2) = -.8683725554267051, (16, 3) = 0.19704832721372575e-1}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(16, {(1) = .0, (2) = 0.6404561717292101e-1, (3) = .13548250894342245, (4) = .2122716707745767, (5) = .2884888958349662, (6) = .3620331204527494, (7) = .4316113205671453, (8) = .4977368087758108, (9) = .5608265805477214, (10) = .6220917756931348, (11) = .6832353851897301, (12) = .7445626983123486, (13) = .8078204843197364, (14) = .8733810552722883, (15) = .9378567463688994, (16) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(16, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = 0.7134055481678411e-9, (2, 1) = -0.21932230435644282e-10, (2, 2) = 0.4590245883148544e-11, (2, 3) = 0.7461923959253619e-9, (3, 1) = -0.6082398462942408e-10, (3, 2) = 0.3065326957403016e-10, (3, 3) = 0.8683866891000823e-9, (4, 1) = -0.8695065362407275e-10, (4, 2) = 0.11153256807576377e-9, (4, 3) = 0.9810666598014438e-9, (5, 1) = -0.6053555201500314e-10, (5, 2) = 0.20181250467793794e-9, (5, 3) = 0.9251916928967297e-9, (6, 1) = -0.41073477234674456e-12, (6, 2) = 0.2495361553785567e-9, (6, 3) = 0.7704948562363915e-9, (7, 1) = 0.6056818024074013e-10, (7, 2) = 0.2515251688390155e-9, (7, 3) = 0.6439500967633543e-9, (8, 1) = 0.10868684843511718e-9, (8, 2) = 0.2301904357179198e-9, (8, 3) = 0.5936739598428944e-9, (9, 1) = 0.14076986220351994e-9, (9, 2) = 0.20625579736177594e-9, (9, 3) = 0.623410717783828e-9, (10, 1) = 0.15987175494471696e-9, (10, 2) = 0.1900168529372196e-9, (10, 3) = 0.7165453504154215e-9, (11, 1) = 0.16825746824195036e-9, (11, 2) = 0.18477923694672967e-9, (11, 3) = 0.8650304385793945e-9, (12, 1) = 0.16514866680272493e-9, (12, 2) = 0.19808534216613374e-9, (12, 3) = 0.10595450219154226e-8, (13, 1) = 0.14657074566307816e-9, (13, 2) = 0.2315425152103885e-9, (13, 3) = 0.13008516723077958e-8, (14, 1) = 0.10422197575497192e-9, (14, 2) = 0.29065656833632424e-9, (14, 3) = 0.1564887441917633e-8, (15, 1) = 0.5088008014332878e-10, (15, 2) = 0.3817429595284989e-9, (15, 3) = 0.17589401418123942e-8, (16, 1) = .0, (16, 2) = 0.4863562698983413e-9, (16, 3) = 0.18476646867013011e-8}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[16] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.8476646867013011e-9) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [3, 16, [f1(x), diff(f1(x), x), diff(diff(f1(x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[16] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[16] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(3, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(16, 3, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(3, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(16, 3, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[f1(x), diff(f1(x), x), diff(diff(f1(x), x), x)]'[i] = yout[i], i = 1 .. 3)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[16] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.8476646867013011e-9) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [3, 16, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[16] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[16] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(16, 3, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(3, {(1) = 0., (2) = 0., (3) = 0.}); `dsolve/numeric/hermite`(16, 3, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 3)] end proc, (2) = Array(0..0, {}), (3) = [x, f1(x), diff(f1(x), x), diff(diff(f1(x), x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[f1(x), diff(f1(x), x), diff(diff(f1(x), x), x)]'[i] = res[i+1], i = 1 .. 3)] catch: error  end try end proc

(7)

display(
  odeplot(sol0, [x, f0(x)], x=0..1, color=blue)
  , odeplot(sol1, [x, f1(x)+F0(x)], x=0..1, color=purple)
)

 

F1 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(f1(x), sol1(t)));
  end if;
end proc:

dF1 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f1(x), x), x=t), sol1(t)));
  end if;
end proc:

ddF1 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f1(x), x$2), x=t), sol1(t)));
  end if;
end proc:

subs1 := subs0 union {f1(x)=F1(x), diff(f1(x), x)=dF1(x), diff(f1(x), x$2)=ddF1(x)};

{diff(diff(f0(x), x), x) = ddF0(x), diff(diff(f1(x), x), x) = ddF1(x), diff(f0(x), x) = dF0(x), diff(f1(x), x) = dF1(x), f0(x) = F0(x), f1(x) = F1(x)}

(8)

 

Second order correction f2

 

coeff(HO1, p, 2):
eval(%, isolate(coeff(HO1, p, 0), diff(f0(x), x$3))):
eval(%, subs1);

sol2 := dsolve({%, f2(0)=0, D(f2)(0)=0, f2(1)=0}, f2(x), numeric);

1.745555556*dF0(x)*f2(x)+1.745555556*dF1(x)*F1(x)+1.745555556*(diff(f2(x), x))*F0(x)-1.745555556*dF0(x)*F1(x)-1.745555556*dF1(x)*F0(x)+diff(diff(diff(f2(x), x), x), x)+0.7617410494e-2*dF1(x)-0.7617410494e-2*dF0(x)+1.745555556*dF0(x)*F0(x)-0.7617410494e-2*(diff(f2(x), x))

 

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(16, {(1) = .0, (2) = 0.6401730673686455e-1, (3) = .13535434866443885, (4) = .21184479539811732, (5) = .2874106622391402, (6) = .36018298833690005, (7) = .4289747704390974, (8) = .4945158762055879, (9) = .5573544786848745, (10) = .6185541600774694, (11) = .6799679578806432, (12) = .7418691804331442, (13) = .805878954011701, (14) = .8724424641402733, (15) = .9376435075095818, (16) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(16, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.10855106714429266e-1, (2, 1) = -0.9434324559718517e-4, (2, 2) = -0.4008921457300064e-2, (2, 3) = -.11022411295479144, (3, 1) = -0.7345226618178199e-3, (3, 2) = -0.14858406176389628e-1, (3, 3) = -.1874264034029753, (4, 1) = -0.24668572303698107e-2, (4, 2) = -0.30896215937434624e-1, (4, 3) = -.22337792269059026, (5, 1) = -0.5436523078143244e-2, (5, 2) = -0.4750302824001485e-1, (5, 3) = -.20761400745680145, (6, 1) = -0.939808779150627e-2, (6, 2) = -0.6061808070998779e-1, (6, 3) = -.14550383128999295, (7, 1) = -0.13843203706555673e-1, (7, 2) = -0.6751413435805735e-1, (7, 3) = -0.4954511550414553e-1, (8, 1) = -0.182941169975788e-1, (8, 2) = -0.6701748576587586e-1, (8, 3) = 0.6830228433029469e-1, (9, 1) = -0.22287523582588977e-1, (9, 2) = -0.5872929299610989e-1, (9, 3) = .19740923210996972, (10, 1) = -0.2542968960358908e-1, (10, 2) = -0.42601624432994124e-1, (10, 3) = .3300957365992241, (11, 1) = -0.27339849032211847e-1, (11, 2) = -0.18253967782892542e-1, (11, 3) = .46191475616382505, (12, 1) = -0.27503867881480085e-1, (12, 2) = 0.14230167062005505e-1, (12, 3) = .5854310388105278, (13, 1) = -0.25314865873590324e-1, (13, 2) = 0.5534105024997991e-1, (13, 3) = .6954860742794319, (14, 1) = -0.2001989833588037e-1, (14, 2) = .10473118863537298, (14, 3) = .783448101559649, (15, 1) = -0.11481766747797573e-1, (15, 2) = .15775651294698934, (15, 3) = .8372939488619414, (16, 1) = .0, (16, 2) = .21068302134443742, (16, 3) = .8543052611659095}, datatype = float[8], order = C_order); YP := Matrix(16, 3, {(1, 1) = .0, (1, 2) = -0.10855106714429266e-1, (1, 3) = -1.737938145506, (2, 1) = -0.4008921457300064e-2, (2, 2) = -.11022411295479144, (2, 3) = -1.3479189615379026, (3, 1) = -0.14858406176389628e-1, (3, 2) = -.1874264034029753, (3, 3) = -.7999164710320333, (4, 1) = -0.30896215937434624e-1, (4, 2) = -.22337792269059026, (4, 3) = -.13140940246672603, (5, 1) = -0.4750302824001485e-1, (5, 2) = -.20761400745680145, (5, 3) = .5455239983517919, (6, 1) = -0.6061808070998779e-1, (6, 2) = -.14550383128999295, (6, 3) = 1.1483341496355746, (7, 1) = -0.6751413435805735e-1, (7, 2) = -0.4954511550414553e-1, (7, 3) = 1.6223192555783386, (8, 1) = -0.6701748576587586e-1, (8, 2) = 0.6830228433029469e-1, (8, 3) = 1.951686014460034, (9, 1) = -0.5872929299610989e-1, (9, 2) = .19740923210996972, (9, 3) = 2.13471956047877, (10, 1) = -0.42601624432994124e-1, (10, 2) = .3300957365992241, (10, 3) = 2.17926647087871, (11, 1) = -0.18253967782892542e-1, (11, 2) = .46191475616382505, (11, 3) = 2.09200960450085, (12, 1) = 0.14230167062005505e-1, (12, 2) = .5854310388105278, (12, 3) = 1.8788522008739734, (13, 1) = 0.5534105024997991e-1, (13, 2) = .6954860742794319, (13, 3) = 1.5415600873402, (14, 1) = .10473118863537298, (14, 2) = .783448101559649, (14, 3) = 1.0852525314768466, (15, 1) = .15775651294698934, (15, 2) = .8372939488619414, (15, 3) = .5540197824891389, (16, 1) = .21068302134443742, (16, 2) = .8543052611659095, (16, 3) = -0.1809997366367583e-1}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(16, {(1) = .0, (2) = 0.6401730673686455e-1, (3) = .13535434866443885, (4) = .21184479539811732, (5) = .2874106622391402, (6) = .36018298833690005, (7) = .4289747704390974, (8) = .4945158762055879, (9) = .5573544786848745, (10) = .6185541600774694, (11) = .6799679578806432, (12) = .7418691804331442, (13) = .805878954011701, (14) = .8724424641402733, (15) = .9376435075095818, (16) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(16, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.1109561503003624e-8, (2, 1) = 0.26699812435622908e-10, (2, 2) = -0.19918851259478768e-10, (2, 3) = -0.11812785942632816e-8, (3, 1) = 0.7290545265482255e-10, (3, 2) = -0.435518863276401e-10, (3, 3) = -0.1370038408939214e-8, (4, 1) = 0.10327208677955919e-9, (4, 2) = -0.9099775069557878e-10, (4, 3) = -0.15286310683797769e-8, (5, 1) = 0.738457274020005e-10, (5, 2) = -0.14594628936276227e-9, (5, 3) = -0.14424793442283092e-8, (6, 1) = 0.9057897962753132e-11, (6, 2) = -0.17240836061534957e-9, (6, 3) = -0.12205996244564129e-8, (7, 1) = -0.54425291935501215e-10, (7, 2) = -0.17098292347539843e-9, (7, 3) = -0.10323622296221041e-8, (8, 1) = -0.10351756071377093e-9, (8, 2) = -0.15663723131857096e-9, (8, 3) = -0.9356588405429689e-9, (9, 1) = -0.13549220262582118e-9, (9, 2) = -0.1452319944728306e-9, (9, 3) = -0.9358672788267563e-9, (10, 1) = -0.15331699329356284e-9, (10, 2) = -0.14588951928284822e-9, (10, 3) = -0.10145347686655287e-8, (11, 1) = -0.15964518339726942e-9, (11, 2) = -0.16289058555461386e-9, (11, 3) = -0.1162024809582045e-8, (12, 1) = -0.15341111964548522e-9, (12, 2) = -0.20676190160146303e-9, (12, 3) = -0.13701166123373674e-8, (13, 1) = -0.1306663509042881e-9, (13, 2) = -0.28766725617611577e-9, (13, 3) = -0.16404736621639975e-8, (14, 1) = -0.839918600087215e-10, (14, 2) = -0.4214750711551729e-9, (14, 3) = -0.1947795993242128e-8, (15, 1) = -0.3463981824448189e-10, (15, 2) = -0.5968250300218129e-9, (15, 3) = -0.21655810926463017e-8, (16, 1) = .0, (16, 2) = -0.780446270962002e-9, (16, 3) = -0.2262710129722444e-8}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[16] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(2.262710129722444e-9) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [3, 16, [f2(x), diff(f2(x), x), diff(diff(f2(x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[16] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[16] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(3, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(16, 3, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(3, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(16, 3, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[f2(x), diff(f2(x), x), diff(diff(f2(x), x), x)]'[i] = yout[i], i = 1 .. 3)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[16] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(2.262710129722444e-9) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [3, 16, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[16] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[16] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(16, 3, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(3, {(1) = 0., (2) = 0., (3) = 0.}); `dsolve/numeric/hermite`(16, 3, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 3)] end proc, (2) = Array(0..0, {}), (3) = [x, f2(x), diff(f2(x), x), diff(diff(f2(x), x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[f2(x), diff(f2(x), x), diff(diff(f2(x), x), x)]'[i] = res[i+1], i = 1 .. 3)] catch: error  end try end proc

(9)

display(
  odeplot(sol0, [x, f0(x)], x=0..1, color=blue)
  , odeplot(sol1, [x, f1(x)+F0(x)], x=0..1, color=purple)
  , odeplot(sol2, [x, f2(x)+F0(x)+F1(x)], x=0..1, color=red)
)

 

F2 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(f2(x), sol2(t)));
  end if;
end proc:

dF2 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f2(x), x), x=t), sol2(t)));
  end if;
end proc:

ddF2 := proc(t)
  if not type(evalf(t),'numeric') then
    'procname'(t);
  else
    evalf(eval(eval(diff(f2(x), x$2), x=t), sol2(t)));
  end if;
end proc:

subs2 := subs1 union {f2(x)=F2(x), diff(f2(x), x)=dF2(x), diff(f2(x), x$2)=ddF2(x)};

{diff(diff(f0(x), x), x) = ddF0(x), diff(diff(f1(x), x), x) = ddF1(x), diff(diff(f2(x), x), x) = ddF2(x), diff(f0(x), x) = dF0(x), diff(f1(x), x) = dF1(x), diff(f2(x), x) = dF2(x), f0(x) = F0(x), f1(x) = F1(x), f2(x) = F2(x)}

(10)

 

Third order correction f3

 

coeff(HO1, p, 3):

eval(%, isolate(coeff(HO1, p, 0), diff(f0(x), x$3))):
eval(%, isolate(coeff(HO1, p, 1), diff(f1(x), x$3)));
eval(%, subs2);

sol3 := dsolve({%, f3(0)=0, D(f3)(0)=0, f3(1)=0}, f3(x), numeric);

1.745555556*(diff(f0(x), x))*f3(x)+1.745555556*(diff(f1(x), x))*f2(x)+1.745555556*(diff(f2(x), x))*f1(x)+1.745555556*(diff(f3(x), x))*f0(x)-1.745555556*(diff(f0(x), x))*f2(x)-1.745555556*(diff(f1(x), x))*f1(x)-1.745555556*(diff(f2(x), x))*f0(x)+diff(diff(diff(f3(x), x), x), x)+0.7617410494e-2*(diff(f2(x), x))+1.745555556*(diff(f0(x), x))*f1(x)+1.745555556*(diff(f1(x), x))*f0(x)-1.745555556*(diff(f0(x), x))*f0(x)-0.7617410494e-2*(diff(f1(x), x))+0.7617410494e-2*(diff(f0(x), x))-0.7617410494e-2*(diff(f3(x), x))

 

1.745555556*dF0(x)*f3(x)+1.745555556*dF1(x)*F2(x)+1.745555556*dF2(x)*F1(x)+1.745555556*(diff(f3(x), x))*F0(x)-1.745555556*dF0(x)*F2(x)-1.745555556*dF1(x)*F1(x)-1.745555556*dF2(x)*F0(x)+diff(diff(diff(f3(x), x), x), x)+0.7617410494e-2*dF2(x)+1.745555556*dF0(x)*F1(x)+1.745555556*dF1(x)*F0(x)-1.745555556*dF0(x)*F0(x)-0.7617410494e-2*dF1(x)+0.7617410494e-2*dF0(x)-0.7617410494e-2*(diff(f3(x), x))

 

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(15, {(1) = .0, (2) = 0.6868100819699492e-1, (3) = .14595638898984406, (4) = .22740500925807855, (5) = .30717748303792447, (6) = .38288700335472736, (7) = .4543480349020496, (8) = .5227453148711261, (9) = .5886887155389848, (10) = .6545230333992893, (11) = .7211386562635443, (12) = .7898630878316497, (13) = .8618912771704792, (14) = .9329501707442724, (15) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(15, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = 0.25694532785562645e-1, (2, 1) = 0.1491788703088783e-3, (2, 2) = 0.5551372935008765e-2, (2, 3) = .13099940113459047, (3, 1) = 0.10582537588995147e-2, (3, 2) = 0.1897376951598749e-1, (3, 3) = .2082481619796001, (4, 1) = 0.3338407184419461e-2, (4, 2) = 0.37348640764275555e-1, (4, 3) = .23267324550810226, (5, 1) = 0.7035325223644292e-2, (5, 2) = 0.54854993962537416e-1, (5, 3) = .19642015019561962, (6, 1) = 0.11680425308889414e-1, (6, 2) = 0.66768337313347e-1, (6, 3) = .11057958569318455, (7, 1) = 0.16639899614274103e-1, (7, 2) = 0.7061961064737002e-1, (7, 3) = -0.797137778600824e-2, (8, 1) = 0.21348091436839207e-1, (8, 2) = 0.6548908832301815e-1, (8, 3) = -.14490233927517804, (9, 1) = 0.25249173230482803e-1, (9, 2) = 0.5125732753073486e-1, (9, 3) = -.2875375207494506, (10, 1) = 0.27897092799920892e-1, (10, 2) = 0.27626301543563176e-1, (10, 3) = -.42938749383968755, (11, 1) = 0.2868373948753689e-1, (11, 2) = -0.5483361420010717e-2, (11, 3) = -.5620492132282962, (12, 1) = 0.26883334437606946e-1, (12, 2) = -0.4824239819134363e-1, (12, 3) = -.6781167048832408, (13, 1) = 0.21563292898862964e-1, (13, 2) = -.10057345513347787, (13, 3) = -.7692213545779051, (14, 1) = 0.12421270049959098e-1, (14, 2) = -.1573760517562036, (14, 3) = -.8233191152894311, (15, 1) = .0, (15, 2) = -.21331312092771168, (15, 3) = -.8394658359534058}, datatype = float[8], order = C_order); YP := Matrix(15, 3, {(1, 1) = .0, (1, 2) = 0.25694532785562645e-1, (1, 3) = 1.737938145506, (2, 1) = 0.5551372935008765e-2, (2, 2) = .13099940113459047, (2, 3) = 1.304932394663431, (3, 1) = 0.1897376951598749e-1, (3, 2) = .2082481619796001, (3, 3) = .6737940929200968, (4, 1) = 0.37348640764275555e-1, (4, 2) = .23267324550810226, (4, 3) = -0.8182620950393095e-1, (5, 1) = 0.54854993962537416e-1, (5, 2) = .19642015019561962, (5, 3) = -.8183665285133928, (6, 1) = 0.66768337313347e-1, (6, 2) = .11057958569318455, (6, 3) = -1.4284164631328513, (7, 1) = 0.7061961064737002e-1, (7, 2) = -0.797137778600824e-2, (7, 3) = -1.8625610701017996, (8, 1) = 0.6548908832301815e-1, (8, 2) = -.14490233927517804, (8, 3) = -2.112540126710141, (9, 1) = 0.5125732753073486e-1, (9, 2) = -.2875375207494506, (9, 3) = -2.185773121994767, (10, 1) = 0.27626301543563176e-1, (10, 2) = -.42938749383968755, (10, 3) = -2.0977739473107095, (11, 1) = -0.5483361420010717e-2, (11, 2) = -.5620492132282962, (11, 3) = -1.8627989688402546, (12, 1) = -0.4824239819134363e-1, (12, 2) = -.6781167048832408, (12, 3) = -1.497097500557855, (13, 1) = -.10057345513347787, (13, 2) = -.7692213545779051, (13, 3) = -1.0202162547215374, (14, 1) = -.1573760517562036, (14, 2) = -.8233191152894311, (14, 3) = -.49670159106503564, (15, 1) = -.21331312092771168, (15, 2) = -.8394658359534058, (15, 3) = 0.16475080057813184e-1}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(15, {(1) = .0, (2) = 0.6868100819699492e-1, (3) = .14595638898984406, (4) = .22740500925807855, (5) = .30717748303792447, (6) = .38288700335472736, (7) = .4543480349020496, (8) = .5227453148711261, (9) = .5886887155389848, (10) = .6545230333992893, (11) = .7211386562635443, (12) = .7898630878316497, (13) = .8618912771704792, (14) = .9329501707442724, (15) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(15, 3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = 0.22389404042291576e-8, (2, 1) = -0.5168218350433026e-10, (2, 2) = 0.57468118190898715e-10, (2, 3) = 0.24344806834023884e-8, (3, 1) = -0.1417976448449938e-9, (3, 2) = 0.8404174699561922e-10, (3, 3) = 0.28914120499479665e-8, (4, 1) = -0.17738113188552843e-9, (4, 2) = 0.10287376876120677e-9, (4, 3) = 0.3134948950104668e-8, (5, 1) = -0.10327528482632357e-9, (5, 2) = 0.1263970472149691e-9, (5, 3) = 0.28325343046744072e-8, (6, 1) = 0.10202960090514321e-10, (6, 2) = 0.1334652921831637e-9, (6, 3) = 0.23559724843213524e-8, (7, 1) = 0.1066953549222101e-9, (7, 2) = 0.12847849228984948e-9, (7, 3) = 0.2010184323492844e-8, (8, 1) = 0.17396091548402068e-9, (8, 2) = 0.12586648554756268e-9, (8, 3) = 0.18599761019367305e-8, (9, 1) = 0.21124400605476557e-9, (9, 2) = 0.14579545969855338e-9, (9, 3) = 0.18947527456398552e-8, (10, 1) = 0.22654582423044557e-9, (10, 2) = 0.197432459382499e-9, (10, 3) = 0.20815927918919977e-8, (11, 1) = 0.2185432085017301e-9, (11, 2) = 0.3023159295450315e-9, (11, 3) = 0.24129148737532237e-8, (12, 1) = 0.18226111479919648e-9, (12, 2) = 0.4902954681979294e-9, (12, 3) = 0.28885241734514984e-8, (13, 1) = 0.10489511429189739e-9, (13, 2) = 0.8083964868359335e-9, (13, 3) = 0.3489441941514877e-8, (14, 1) = 0.28291286689841743e-10, (14, 2) = 0.1218372130067739e-8, (14, 3) = 0.3933864731719928e-8, (15, 1) = .0, (15, 2) = 0.16233326858211381e-8, (15, 3) = 0.41201977518441975e-8}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[15] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(4.1201977518441975e-9) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [3, 15, [f3(x), diff(f3(x), x), diff(diff(f3(x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[15] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[15] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(3, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(15, 3, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(3, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(15, 3, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[f3(x), diff(f3(x), x), diff(diff(f3(x), x), x)]'[i] = yout[i], i = 1 .. 3)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[15] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(4.1201977518441975e-9) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [3, 15, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[15] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[15] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(15, 3, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(3, {(1) = 0., (2) = 0., (3) = 0.}); `dsolve/numeric/hermite`(15, 3, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 3)] end proc, (2) = Array(0..0, {}), (3) = [x, f3(x), diff(f3(x), x), diff(diff(f3(x), x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[f3(x), diff(f3(x), x), diff(diff(f3(x), x), x)]'[i] = res[i+1], i = 1 .. 3)] catch: error  end try end proc

(11)

display(
  odeplot(sol0, [x, f0(x)], x=0..1, color=blue)
  , odeplot(sol1, [x, f1(x)+F0(x)], x=0..1, color=purple)
  , odeplot(sol2, [x, f2(x)+F0(x)+F1(x)], x=0..1, color=red)
  , odeplot(sol3, [x, f3(x)+F0(x)+F1(x)+F2(x)], x=0..1, color=gold)
)

 

 

and so on...

Plot corrections:

(note that the process doesn't seem to converge)

 

display(
  odeplot(sol1, [x, f1(x)], x=0..1, color=purple)
  , odeplot(sol2, [x, f2(x)], x=0..1, color=red)
  , odeplot(sol3, [x, f3(x)], x=0..1, color=gold)
)

 

 


 

Download HPM_1_iterative.mw

Remark 1
Your initial pde must contain partial derivatices wrt x.
When applying the Fourier transform the imaginary root I should appear elsewhere, unless all the partial derivatives wrt x. are of the even orders.
See here

edo := M*diff(u(x), x$2)+C*diff(u(x), x)+K*u(x)=f(x);
FT := inttrans:-fourier(edo, x, k):

ToReplace := remove(has, convert(select(has, indets(%, function), fourier), list), diff):
ReplaceBy := map(i -> parse(StringTools:-Capitalize(op(0, i)))(k), map2(op, 1, ToReplace)):

Fode := eval(FT, ToReplace =~ ReplaceBy);

M*(diff(diff(u(x), x), x))+C*(diff(u(x), x))+K*u(x) = f(x)

 

(I*C*k-M*k^2+K)*U(k) = F(k)

(1)

pde := C*diff(u(x, t), t)+lambda*diff(u(x, t), x$2) = f(x, t);
FT := inttrans:-fourier(pde, x, k);

ToReplace := remove(has, convert(select(has, indets(%, function), fourier), list), diff):
ReplaceBy := map(i -> parse(StringTools:-Capitalize(op(0, i)))(k, t), map2(op, 1, ToReplace)):

Fpde := eval(FT, ToReplace =~ ReplaceBy):

C*(diff(u(x, t), t))+lambda*(diff(diff(u(x, t), x), x)) = f(x, t)

 

-lambda*k^2*fourier(u(x, t), x, k)+C*(diff(fourier(u(x, t), x, k), t)) = fourier(f(x, t), x, k)

(2)

pde := C*diff(u(x, t), t)+v*diff(u(x, t), x) = f(x, t);
FT := inttrans:-fourier(pde, x, k):

ToReplace := remove(has, convert(select(has, indets(%, function), fourier), list), diff):
ReplaceBy := map(i -> parse(StringTools:-Capitalize(op(0, i)))(k, t), map2(op, 1, ToReplace)):

Fpde := eval(FT, ToReplace =~ ReplaceBy);

C*(diff(u(x, t), t))+v*(diff(u(x, t), x)) = f(x, t)

 

C*(diff(U(k, t), t))+I*v*k*U(k, t) = F(k, t)

(3)

 

Download Remark_1.mw

Did you omit I or is there really no I?

Remark 2
Given the complexity of the ode in the Fourier space, I guess the initial pde contains terms zeta(x,t)^r where r is some integer.
Applying the Fourier transform to a term like this should introduce a convolution product (... unless if the initial pde contains itself convolution products which are transformed into ordinary products by the Fourier transform?)

inttrans:-fourier(u(x)*u(x), x, k) = int(U(kappa)*U(k-kappa), kappa=-infinity..+infinity)

fourier(u(x)^2, x, k) = int(U(kappa)*U(k-kappa), kappa = -infinity .. infinity)

(1)

 

Download Remark_2.mw

Remark 3
As your ode is extremely complex, are you suresolving directly the initial pde (in a numeric way of course) is that bad an idea?

Remark 4
Fourier transform has the advantage to transform a linear pde into a simple ode, but you must not omit the boundary condions.
This help page explain how to solve formally an ode with some integral transformations

help(dsolve[inttrans])

What is the best way to solve this rroblem? (apart from the obvious choice to fit the data and solve the equation with the fitted potential)

Why do you say that? Do you think this "obvious choice" doesn't deserve to be taken into account?

I guess that V(x) comes from the numerical solution of an ODE, which doesn't contain y(x) nor any of its derivative?

If it's not the case just solve a coupled system of odes.

If it is the case I advice you to look this help page

help(dsolve[numeric,efficiency])

and go to the section Solutions depending on other solutions.
You will find an example where  a first ode is solved numerically to get a procedure

                  xf:=proc(t) ... end proc

(typically xf could be V) and then this procedure is plugged into a second ode system (typically the -y''(x) = (E-V(x))*y(x) ode) :

sys2 := {diff(y(t),t,t)=xf(t), y(0)=0, D(y)(0)=1};
sol2 := dsolve(sys2, numeric, known={xf});
                    sol2:=proc(x_rkf45) ... end proc

So you could write something like this

sys2 := {-diff(y(x), x$2) = (E-V(x))*y(x), +IC/BC};
sol2 := dsolve(sys2, numeric, known={V});

This avoids the "fitting step" which you do not like.

Depending of the complexity of the ode V(x) verifies and on the complexity of V(x), the "fitting" approach can perform better, or be worse, than the metof describe in the help page.

f1 can be integrated formally, but it seems f2 cannot.
(the assumptions I use come from the kc and kh ranges you give for f1).

restart:

#
# for numerical integration, assume sigma=10, kc=1.6..3, kh=3..7, deltac=1-deltah  , deltah=0.65
#
f1:=deltac*(1-x/(kc-3/2))^(-kc+1/2)+deltah*(1-x/(sigma*(kh-3/2)))^(-kh+1/2);

deltac*(1-x/(kc-3/2))^(-kc+1/2)+deltah*(1-x/(sigma*(kh-3/2)))^(-kh+1/2)

(1)


There is no need to use a numerical integration for f1

# For some unknown reason
# int(f1, x=0..X) assuming kc > 1/2, kh > 1/2, X > 0;
# vives no answer with Maple 2015.2 after a reasonable amount of time.
#
# So this trick:

int(f1, x) assuming kc > 1/2, kh > 1/2;
If1 := unapply(eval(%, x=X)-eval(%, x=0), [X, sigma, kc, kh, deltac, deltah]):


plot3d(If1(0.15, 10, kc, kh, 1-0.65, 0.65), kc=1.6..3, kh=3..7, labels=["kc", "kh", "int"], style=surface)

-deltac*(1-x/(kc-3/2))^(-kc+3/2)*(kc-3/2)/(-kc+3/2)-deltah*(1-x/(sigma*(kh-3/2)))^(-kh+3/2)*sigma*(kh-3/2)/(-kh+3/2)

 

 


I guess numerical integration is needed for f2

f2 := (deltac*(1-x/(kc-3/2))^(-kc+1/2)+deltah*(1-x/(sigma*(kh-3/2)))^(-kh+1/2))
      *
      (deltac*(1-x/(kc-3/2))^(-kc+3/2)+deltah*sigma*(1-x/(sigma*(kh-3/2)))^(-kh+3/2))

(deltac*(1-x/(kc-3/2))^(-kc+1/2)+deltah*(1-x/(sigma*(kh-3/2)))^(-kh+1/2))*(deltac*(1-x/(kc-3/2))^(-kc+3/2)+deltah*sigma*(1-x/(sigma*(kh-3/2)))^(-kh+3/2))

(2)

with(IntegrationTools):

If2 := Expand(Int(f2, x)) assuming kc > 1/2, kh > 3/2:
if2 := value(If2);

(1/2)*deltac^2*(2*kc-3-2*x)/((2*kc-1)*(((2*kc-3-2*x)/(2*kc-3))^kc)^2)-(1/4)*deltac^2*(4*kc*x-2*kc-2*x+3)*(2*kc-3-2*x)/((kc-3/2)*(((2*kc-3-2*x)/(2*kc-3))^kc)^2*(2*kc^2-3*kc+1))+(1/8)*deltac^2*(8*kc^2*x^2-8*kc^2*x-12*kc*x^2+4*kc^2+16*kc*x+4*x^2-12*kc-6*x+9)*(2*kc-3-2*x)/((kc-3/2)^2*(((2*kc-3-2*x)/(2*kc-3))^kc)^2*(2*kc^2-3*kc+1)*(2*kc-3))+deltac*deltah*sigma*(int((1-x/(kc-3/2))^(1/2)*(1-x/(sigma*(kh-3/2)))^(3/2)/((1-x/(kc-3/2))^kc*(1-x/(sigma*(kh-3/2)))^kh), x))+deltah*deltac*(int((1-x/(sigma*(kh-3/2)))^(1/2)*(1-x/(kc-3/2))^(3/2)/((1-x/(sigma*(kh-3/2)))^kh*(1-x/(kc-3/2))^kc), x))+(1/2)*deltah^2*sigma*(2*kh*sigma-3*sigma-2*x)/((2*kh-1)*(((2*kh*sigma-3*sigma-2*x)/(sigma*(2*kh-3)))^kh)^2)+(1/4)*deltah^2*(2*kh*sigma-4*kh*x-3*sigma+2*x)*(2*kh*sigma-3*sigma-2*x)/((kh-3/2)*(((2*kh*sigma-3*sigma-2*x)/(sigma*(2*kh-3)))^kh)^2*(2*kh^2-3*kh+1))+(1/8)*deltah^2*(4*kh^2*sigma^2-8*kh^2*sigma*x+8*kh^2*x^2-12*kh*sigma^2+16*kh*sigma*x-12*kh*x^2+9*sigma^2-6*sigma*x+4*x^2)*(2*kh*sigma-3*sigma-2*x)/(sigma*(kh-3/2)^2*(((2*kh*sigma-3*sigma-2*x)/(sigma*(2*kh-3)))^kh)^2*(2*kh^2-3*kh+1)*(2*kh-3))

(3)

select(has, {op(if2)}, int)

{deltah*deltac*(int((1-x/(sigma*(kh-3/2)))^(1/2)*(1-x/(kc-3/2))^(3/2)/((1-x/(sigma*(kh-3/2)))^kh*(1-x/(kc-3/2))^kc), x)), deltac*deltah*sigma*(int((1-x/(kc-3/2))^(1/2)*(1-x/(sigma*(kh-3/2)))^(3/2)/((1-x/(kc-3/2))^kc*(1-x/(sigma*(kh-3/2)))^kh), x))}

(4)

(1-x/b)^(1/2-kh);

# and

int(expr, x)

(1-x/a)^(-kc+1/2)*(1-x/b)^(-kh+1/2)

 

int((1-x/a)^(-kc+1/2)*(1-x/b)^(-kh+1/2), x)

(5)

 

Download f1_and_f2.mw

The simple command

res := eval(<vars>, fsolve(eval({e||(1..8)}, [y1[n]=iny1, y2[n]=iny2]), {vars})):

works perfectly well and your code produces something which seems correct.
Did you think that  tolerance is an option of eval? In this cas the answer is NO: eval has only 1 or 2 arguments (look to the corresponding help page)

Had it been the case, the lines

tolerance := 1e-6:
res := eval(<vars>, fsolve(eval({e||(1..8)}, [y1[n]=iny1, y2[n]=iny2]), {vars}), tolerance = tolerance):

would have produced an error; for instance:

restart
dsys := {diff(x(t),t)=y(t),diff(y(t),t)=-x(t),x(0)=1,y(0)=0}:
abserr := 1e-6;
                            0.000001
dsol := dsolve(dsys, numeric, abserr=abserr):
Error, (in dsolve/numeric/an_args/SC) keyword was '0.1e-5', optional keyword must be one of 'abserr', 
'delaymax', 'delaypts', 'differential', 'event_doublecross', 'event_initial', 'event_iterate', 
'event_maxiter', 'event_pre', 'event_project', 'event_relrange', 'event_stepreduction', 'events', 
'implicit', 'initstep', 'interpolate', 'interr', 'maxfun', 'maxstep', 'minstep', 'optimize', 
'output', 'projection', 'range', 'relerr', 'startinit', 'steppast'

To avaoid this error the correct syntax is (note the simple quotes arround the first occurence of abserr)

dsol := dsolve(dsys, numeric, 'abserr'=abserr):

 

Both the rhs have potentially 2 singularities: one at R=0, the other at R=1.
Computing limit(rhs(Sys[2]), R=1) returns alpha^2 and thus there is no problem at R=1 for the Phi-ode.

To resolve the 3 remaining singularities I propose to replace localy the rhs by its series expansion.
More precisely:

  • T-ode:
    • replace the rhs at R=0 by a series expansion T_SL in the interval [0, h],
    • note T_CS the rhs in the interval [h, 1-h],
    • replace the rhas at R=0 by a series expansion T_SR in the interval [1-h, L), where L is any number > 1,
      (possibly L = 1+h and a fourth range [1+h, L) could be included where T_CS2 is equal to the rhs)
    • dsolve exactly {diff(T(R), R) = T_LS, T(0)=0.5},
    • dsolve numerically {diff(T(R), R) = T_CS, T(h)=U} where U is the value of T at point R=h for the previous solution,
    • dsolve exactly {diff(T(R), R) = T_RS, T(1-h)=V} where U is the value of T at point R=h for the previous solution.
      (possibly dsolve numerically in the fourth range)
  • Phi-ode
    • replace the rhs at R=0 by a series expansion Phi_SL in the interval [0, h],
    • note T_CS the rhs in the interval [h, L), where L is any number > 1,
    • solve exactly {diff(T(R), R) = T_LS, T(0)=0.5},
    • solve numerically {diff(T(R), R) = T_CS, T(h)=U} where U is the value of T at point R=h for the previous solution.

Merge the pieces of solution.
I took arbitrary h=0.25, but this value can be adjusted; a comparison with @Preben Alsholm's solution is also presented
Finally, I've chosen alpha=1, T(0)=1/2 and Phi(0)=0.
 

restart

with(plots):

Sys := diff(T(R),R)=((1-1/R)*(sqrt(1-(alpha/R)^2*(1-1/R))))^(-1),diff(Phi(R),R)=(alpha/R)^2*(sqrt(1-(alpha/R)^2*(1-1/R)))^(-1);

diff(T(R), R) = 1/((1-1/R)*(1-alpha^2*(1-1/R)/R^2)^(1/2)), diff(Phi(R), R) = alpha^2/(R^2*(1-alpha^2*(1-1/R)/R^2)^(1/2))

(1)

T_LS := eval(convert(series(rhs(Sys[1]), R=0, 6), polynom), alpha=1) assuming R > 0;
T_RS := eval(convert(series(rhs(Sys[1]), R=1, 6), polynom), alpha=1);

h := 0.25:
T_CS := eval(rhs(Sys[1]), alpha=1);

-R^(5/2)-(3/2)*R^(7/2)-(15/8)*R^(9/2)-(27/16)*R^(11/2)

 

1/(R-1)+17/8-(5/8)*R-(1/16)*(R-1)^2+(179/128)*(R-1)^3

 

1/((1-1/R)*(1-(1-1/R)/R^2)^(1/2))

(2)

T_Lsol  := Re( dsolve({diff(T(R),R)=T_LS, T(0)=1/2}, T(R)) ):
T_C1sol := dsolve({diff(T(R),R)=T_CS, T(h)=eval(rhs(T_Lsol), R=h)}, numeric):

T_Rsol  := Re( dsolve({diff(T(R),R)=T_RS, T(1-h)=eval(T(R), T_C1sol(1-h))}, T(R)) ):
T_C2sol := dsolve({diff(T(R),R)=T_CS, T(1+h)=eval(rhs(T_Rsol), R=1+h)}, numeric):

T_plot := display(
  plot(rhs(T_Lsol), R=0...h, color=red, legend=T),
  odeplot(T_C1sol, [R, T(R)], R=h..1-h, color=red),
  plot(Re(rhs(T_Rsol)), R=1-h..1+h, color=red),
  odeplot(T_C2sol, [R, T(R)], R=1+h..2, color=red)
):

Phi_LS := eval(convert(series(rhs(Sys[2]), R=0, 6), polynom), alpha=1) assuming R > 0;
Phi_RS := eval(rhs(Sys[2]), alpha=1);

1/R^(1/2)+(1/2)*R^(1/2)+(3/8)*R^(3/2)-(3/16)*R^(5/2)-(61/128)*R^(7/2)

 

1/(R^2*(1-(1-1/R)/R^2)^(1/2))

(3)

Phi_Lsol := dsolve({diff(Phi(R),R)=Phi_LS, Phi(0)=0}, Phi(R));
Phi_Rsol := dsolve({diff(Phi(R),R)=Phi_RS, Phi(h)=eval(rhs(Phi_Lsol), R=h)}, numeric):

Phi_plot := display(
  plot(rhs(Phi_Lsol), R=0...h, color=blue, legend=Phi),
  odeplot(Phi_Rsol, [R, Phi(R)], R=h..2, color=blue)
):

Phi(R) = -(1/20160)*R^(1/2)*(2135*R^4+1080*R^3-3024*R^2-6720*R-40320)

(4)

display(T_plot, Phi_plot)

 

NumSol := dsolve(eval({Sys}, alpha=1) union {T(1e-10)=1/2, Phi(1e-10)=0}, numeric, events=[[R=1-1e-10, halt]])

proc (x_rkf45) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_rkf45) else _xout := evalf(x_rkf45) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 24, [( 1 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 2 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 3 ) = ([Array(1..2, 1..21, {(1, 1) = 1.0, (1, 2) = 2.0, (1, 3) = 1.0, (1, 4) = .0, (1, 5) = .9999999999, (1, 6) = .0, (1, 7) = 1.0, (1, 8) = undefined, (1, 9) = undefined, (1, 10) = 1.0, (1, 11) = undefined, (1, 12) = undefined, (1, 13) = undefined, (1, 14) = undefined, (1, 15) = undefined, (1, 16) = undefined, (1, 17) = undefined, (1, 18) = undefined, (1, 19) = undefined, (1, 20) = undefined, (1, 21) = undefined, (2, 1) = 1.0, (2, 2) = .0, (2, 3) = 100.0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = undefined, (2, 9) = undefined, (2, 10) = 0.10e-6, (2, 11) = undefined, (2, 12) = .0, (2, 13) = undefined, (2, 14) = .0, (2, 15) = .0, (2, 16) = undefined, (2, 17) = undefined, (2, 18) = undefined, (2, 19) = undefined, (2, 20) = undefined, (2, 21) = undefined}, datatype = float[8], order = C_order), proc (R, Y, Ypre, n, EA) EA[1, 8+2*n] := 1; 0 end proc, proc (e, R, Y, Ypre) return 0 end proc, Array(1..1, 1..2, {(1, 1) = undefined, (1, 2) = undefined}, datatype = float[8], order = C_order)]), ( 4 ) = (Array(1..54, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 1, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0, (50) = 50, (51) = 1, (52) = 0, (53) = 0, (54) = 0}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = 0.10e-9, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = 0.10e-9, (6) = 0.5047658755589162e-7, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .49999999999999, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = 0.10e-14, (26) = .0, (27) = .0, (28) = .0}, datatype = float[8], order = C_order)), ( 6 ) = (Array(1..2, {(1) = .0, (2) = .5}, datatype = float[8], order = C_order)), ( 7 ) = ([Array(1..4, 1..7, {(1, 1) = .0, (1, 2) = .203125, (1, 3) = .3046875, (1, 4) = .75, (1, 5) = .8125, (1, 6) = .40625, (1, 7) = .8125, (2, 1) = 0.6378173828125e-1, (2, 2) = .0, (2, 3) = .279296875, (2, 4) = .27237892150878906, (2, 5) = -0.9686851501464844e-1, (2, 6) = 0.1956939697265625e-1, (2, 7) = .5381584167480469, (3, 1) = 0.31890869140625e-1, (3, 2) = .0, (3, 3) = -.34375, (3, 4) = -.335235595703125, (3, 5) = .2296142578125, (3, 6) = .41748046875, (3, 7) = 11.480712890625, (4, 1) = 0.9710520505905151e-1, (4, 2) = .0, (4, 3) = .40350341796875, (4, 4) = 0.20297467708587646e-1, (4, 5) = -0.6054282188415527e-2, (4, 6) = -0.4770040512084961e-1, (4, 7) = .77858567237854}, datatype = float[8], order = C_order), Array(1..6, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = 1.0, (2, 1) = .25, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = 1.0, (3, 1) = .1875, (3, 2) = .5625, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = 2.0, (4, 1) = .23583984375, (4, 2) = -.87890625, (4, 3) = .890625, (4, 4) = .0, (4, 5) = .0, (4, 6) = .2681884765625, (5, 1) = .1272735595703125, (5, 2) = -.5009765625, (5, 3) = .44921875, (5, 4) = -0.128936767578125e-1, (5, 5) = .0, (5, 6) = 0.626220703125e-1, (6, 1) = -0.927734375e-1, (6, 2) = .626220703125, (6, 3) = -.4326171875, (6, 4) = .1418304443359375, (6, 5) = -0.861053466796875e-1, (6, 6) = .3131103515625}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .386, (3) = .21, (4) = .63, (5) = 1.0, (6) = 1.0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .25, (2) = -.1043, (3) = .1035, (4) = -0.362e-1, (5) = .0, (6) = .0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 1.544, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = .9466785280815533, (3, 2) = .25570116989825814, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = 3.3148251870684886, (4, 2) = 2.896124015972123, (4, 3) = .9986419139977808, (4, 4) = .0, (4, 5) = .0, (5, 1) = 1.2212245092262748, (5, 2) = 6.019134481287752, (5, 3) = 12.537083329320874, (5, 4) = -.687886036105895, (5, 5) = .0, (6, 1) = 1.2212245092262748, (6, 2) = 6.019134481287752, (6, 3) = 12.537083329320874, (6, 4) = -.687886036105895, (6, 5) = 1.0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = -5.6688, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = -2.4300933568337584, (3, 2) = -.20635991570891224, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = -.10735290581452621, (4, 2) = -9.594562251021896, (4, 3) = -20.470286148096154, (4, 4) = .0, (4, 5) = .0, (5, 1) = 7.496443313968615, (5, 2) = -10.246804314641219, (5, 3) = -33.99990352819906, (5, 4) = 11.708908932061595, (5, 5) = .0, (6, 1) = 8.083246795922411, (6, 2) = -7.981132988062785, (6, 3) = -31.52159432874373, (6, 4) = 16.319305431231363, (6, 5) = -6.0588182388340535}, datatype = float[8], order = C_order), Array(1..3, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 10.126235083446911, (2, 2) = -7.487995877607633, (2, 3) = -34.800918615557414, (2, 4) = -7.9927717075687275, (2, 5) = 1.0251377232956207, (3, 1) = -.6762803392806898, (3, 2) = 6.087714651678606, (3, 3) = 16.43084320892463, (3, 4) = 24.767225114183653, (3, 5) = -6.5943891257167815}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[8]), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .5}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 100000.000005, (2) = -0.100000000015e-24}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = Phi(R), Y[2] = T(R)]`; if -(1-1/X)/X^2 < -1 then YP[1] := undefined; return 0 end if; YP[1] := evalf(1/(1-(1-1/X)/X^2)^(1/2))/X^2; YP[2] := evalf(1/(1-(1-1/X)/X^2)^(1/2))/(1-1/X); 0 end proc, -1, 0, 0, proc (R, Y, Ypre, n, EA) EA[1, 8+2*n] := 1; 0 end proc, proc (e, R, Y, Ypre) return 0 end proc, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = Phi(R), Y[2] = T(R)]`; if -(1-1/X)/X^2 < -1 then YP[1] := undefined; return 0 end if; YP[1] := evalf(1/(1-(1-1/X)/X^2)^(1/2))/X^2; YP[2] := evalf(1/(1-(1-1/X)/X^2)^(1/2))/(1-1/X); 0 end proc, -1, 0, 0, proc (R, Y, Ypre, n, EA) EA[1, 8+2*n] := 1; 0 end proc, proc (e, R, Y, Ypre) return 0 end proc, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0.1e-9, (2) = 0.}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _xout = "map" then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_xin) = "initial" then _ini := rhs(_xin) elif lhs(_xin) = "parameters" then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) <> [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par <> [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _xin = "eventstatus" then if _nv = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nv < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nv do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nv+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_xin) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _xin = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _xout) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(0..0, {}), (3) = [R, Phi(R), T(R)], (4) = []}); _vars := _dat[3]; _pars := map(rhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_rkf45, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_rkf45, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_rkf45, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_rkf45, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_rkf45), 'string') = rhs(x_rkf45); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', NULL]) then return _solnproc(convert(lhs(x_rkf45), 'string') = rhs(x_rkf45)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars end if; if procname <> unknown then return ('procname')(x_rkf45) else _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_rkf45) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

(5)

NumSol_plot := odeplot(
                 NumSol
                 , [[R, T(R)], [R, Phi(R)]]
                 , R=1e-10..1-1e-10
                 , color=[red, blue]
                 , style=[point, point]
                 , symbol=[circle, circle]
                 , legend=[T, Phi]
               ):

display(T_plot, Phi_plot, NumSol_plot, view=[default, -10..3])

 

 


dsolve_series_1.mw

Assuming both alpha and k are strictly positive:

Jn := (alpha, k) -> k*Int((BesselK(0, k*Zeta)/Zeta^3)*Zeta*BesselK(1, alpha*Zeta), Zeta = 1 .. infinity):
r  := rand(0. .. 10):
ak := r(), r();
evalf(Jn(ak))
                    9.631107879, 5.713953505
                                      -8
                        1.463786783 10  

Multiply this value by 4*h1*lambda to get the final result

You can define cot(x) as 1/tan(x) or cot(x) as tan(Pi/2-x) and even cot(x) as -tan(x+Pi/2) (and while not say that cot(x) = cos(x)/sin(x) ?).
In your case (where does the value 90 come from?) you can obtain evry different simplifications: they all depend on the rules you apply and the order you apply them.

Result y is, IMO, even simpler and easier to read than MMA's result. It uses the subjective simplification tan = 1/cot.

Result z is closer to MMA's but replaces Pi/2 by Phi in order to avoid earlier (and autimatic) simplifications. It uses the subjective simplification cot = 1/tan (which is just one of the many definitions of cot).

The last result starts from z and uses nother subjective simplification cot(Pi/2+alpha/2)=-cot(Pi/2-alpha/2).

restart:
x := -sin(alpha)*(L + (e + r)/tan(-Pi/2 + alpha/2))/2 + sin(alpha)*L:
eval(%, cot=(u -> 1/tan(u))):
y := collect(%, sin);
           /1     1            /1      \\           
           |- L + - (e + r) tan|- alpha|| sin(alpha)
           \2     2            \2      //           

x := -sin(alpha)*(L + (e + r)/tan(Phi + alpha/2))/2 + sin(alpha)*L:

eval(%, tan=(u -> 1/cot(u))):
z := collect(%, sin);
        /1     1            /      1      \\           
        |- L - - (e + r) cot|Phi + - alpha|| sin(alpha)
        \2     2            \      2      //           
eval(z, cot(Phi+alpha/2)=-cot(Phi-alpha/2));
        /1     1            /      1      \\           
        |- L + - (e + r) cot|Phi - - alpha|| sin(alpha)
        \2     2            \      2      //           

simplify.mw

s := singular(1/sin(x), x):
var := (indets(%) minus {x})[]:
eval(s, var = `#mo("&#x2124;")`);

As @tomleslie said, one BC is missing.

An example with a periodic BC for D[1](u) ( = diff(u(x, t), x) )

restart:
PDE  := diff(u(x, t), t) = -u(x, t)*diff(u(x, t), x) + 0.1 * diff(u(x, t), x$2):
IC   := u(x, 0) = sin(x):
BC   := u(0, t)=u(2*Pi, t), D[1](u)(0, t)=D[1](u)(2*Pi, t):
IBC  := {IC, BC}:

pds := pdsolve(PDE, IBC, numeric, time=t, range=0..2*Pi):  # just do as explained in the help page
plots:-display(
  seq(
    pds:-plot(
      t=tau
      , numpoints=50
      , color=ColorTools:-Color([rand()/10^12, rand()/10^12, rand()/10^12])
      , legend=('t'=nprintf("%1.2e", tau))
    )
    , tau in [seq](0..2, 0.25)
  )
)

Explanation

P := plot3d( [ b, ( b^2 ) / 4, -b / 2 ], b = -4 .. 4, c = -4 .. 4, thickness = 5, color = red  ); 

P is made of two elements

op(P) = MESH(...., COLOR(....)), THICKNESS(...)

When a MESH structure is plotted the "construction lines" of the mesh are too (default choice).
To avoid plotting them (see PLOT3D help page) you have to use the option STYLE(HIDDEN).

Then (no need to the THICKNESS option)

PLOT3D( MESH( op(op(P)), STYLE(HIDDEN) ) )

does the job.

Not that simple but this explains why the curve you got is black: the black boundaries of each element of the MESH "overwrite" the red on their interiors.

1 2 3 4 5 Page 3 of 5