mmcdara

5610 Reputation

17 Badges

7 years, 185 days

MaplePrimes Activity


These are replies submitted by mmcdara



Isn't it this a duplicate of thar previous question?

BTW, why do you persist in doing the same mistake (unknown=f(x) and parameter mu[f])?
Did you read my answer?


More of this your 4 equations are both identical except for the name of the dependent function, so their solutions will be fundamentaly identical it it is stupid to dsolve 4 equations.
The generic form of these equations is given by coeff(HPMeq, p, 1).
Before doing complex things  ask yourself if this equation can be solved formally; 

# example
test := coeff(HPMEq, p, 0);

# A solution is returned here
Without_bc := dsolve(test);   

# But not here
With_bc := dsolve({test, F[0](1) = 1, F[0](-1) = -1, (D(F[0]))(1) = 0, (D(F[0]))(-1)})

So trying to take the rhs of this last ouput generates the error message you got.

The only way is to dsolve numerically

{test, F[0](1) = 1, F[0](-1) = -1, (D(F[0]))(1) = 0, (D(F[0]))(-1)}

which implies to replace the many parameters by their numerical values.

Make an effort to understand all this and to submit us something that is worth us spending time answering, otherwise it's all a waste of  time for the people here.

@Saha 

 

restart;

with(plots):

 

HERE IS A CORRECT WAY TO CODE THE THINGS

Note that I treated ONLY the first ode.

With a little effort you should be capable to generalize this to the two other odes, so stop
doing again and again the same errors and try to learn something.

 

eq1 := mu[hnf]*rho[f]*(diff(F(x), x, x, x, x))/(rho[hnf]*mu[f])+3*alpha*(diff(F(x), x, x))+alpha*eta*(diff(F(x), x, x, x))-2*R*F(x)*(diff(F(x), x, x, x))-rho[f]*M*(diff(F(x), x, x))/rho[hnf] = 0;

mu[hnf]*rho[f]*(diff(diff(diff(diff(F(x), x), x), x), x))/(rho[hnf]*mu[f])+3*alpha*(diff(diff(F(x), x), x))+alpha*eta*(diff(diff(diff(F(x), x), x), x))-2*R*F(x)*(diff(diff(diff(F(x), x), x), x))-rho[f]*M*(diff(diff(F(x), x), x))/rho[hnf] = 0

(1)

a1 := { phi[1] = 0.1e-1, phi[2] = 0.1e-1, R = 1.0, M = 1, alpha = -1, eta = 1 }:
a2 := { phi[1] = 0.1e-1, phi[2] = 0.1e-1, R = 1.0, M = 1, alpha = -.5, eta = 1 }:
a3 := { phi[1] = 0.1e-1, phi[2] = 0.1e-1, R = 1.0, M = 1, alpha = .5, eta = 1 }:
a4 := { phi[1] = 0.1e-1, phi[2] = 0.1e-1, R = 1.0, M = 1, alpha = 1, eta = 1 }:

AllA := [a1, a2, a3, a4]:

print~(AllA):

{M = 1, R = 1.0, alpha = -1, eta = 1, phi[1] = 0.1e-1, phi[2] = 0.1e-1}

 

{M = 1, R = 1.0, alpha = -.5, eta = 1, phi[1] = 0.1e-1, phi[2] = 0.1e-1}

 

{M = 1, R = 1.0, alpha = .5, eta = 1, phi[1] = 0.1e-1, phi[2] = 0.1e-1}

 

{M = 1, R = 1.0, alpha = 1, eta = 1, phi[1] = 0.1e-1, phi[2] = 0.1e-1}

(2)

data := {
  rho[f]   = 997.1,
  rho[s1]  = 6320,
  rho[s2]  = 3970,
  c[p][f]  = 4180,
  c[p][s1] = 531.5,
  c[p][s2] = 765,
  k[s1]    = 76.5,
  k[s2]    = 40,
  k[f]     = .613,
  mu[f]   = 1,     # You forgot assigning it, this is my arbitrary choice
  k[nf]   = 1,     # You forgot assigning it, this is my arbitrary choice
  k[s1]   = 1,     # You forgot assigning it, this is my arbitrary choice
  k[s2]   = 1,     # You forgot assigning it, this is my arbitrary choice
  phi[1]  = 0.1,   # You forgot assigning it, this is my arbitrary choice
  phi[2]  = 0.1    # You forgot assigning it, this is my arbitrary choice
}:

AllData := {
  data[]
  , k[nf]    = eval( k[f]*(k[s1]+2*k[f]-2*phi[1]*(k[f]-k[s1]))/(k[s1]+2*k[f]+phi[1]*(k[f]-k[s1])), data)
  , k[hnf]   = simplify(eval( k[nf]*(k[s2]+2*k[nf]-2*phi[2]*(k[nf]-k[s2]))/(k[s2]+2*k[nf]+phi[2]*(k[nf]-k[s2])), data))
  , mu[hnf]  = eval( mu[f]/((1-phi[1])^2.5*(1-phi[2])^2.5), data)
  , rho[hnf] = eval( (1-phi[2])((1-phi[1])*rho[f]+phi[1]*rho[s1])+phi[2]*rho[s2], data)
}:

# Check:

print~(AllData):
 

k[f] = .613

 

k[hnf] = 1.000000000

 

k[nf] = 1

 

k[nf] = .6455375120

 

k[s1] = 1

 

k[s1] = 76.5

 

k[s2] = 1

 

k[s2] = 40

 

mu[f] = 1

 

mu[hnf] = 1.693508780

 

phi[1] = .1

 

phi[2] = .1

 

rho[f] = 997.1

 

rho[hnf] = 397.9

 

rho[s1] = 6320

 

rho[s2] = 3970

 

c[p][f] = 4180

 

c[p][s1] = 531.5

 

c[p][s2] = 765

(3)

AllB := [ seq(eval(eq1, AllA[i] union AllData), i=1..numelems(AllA)) ]:

print~(AllB):

4.243773825*(diff(diff(diff(diff(F(x), x), x), x), x))-5.505906007*(diff(diff(F(x), x), x))-(diff(diff(diff(F(x), x), x), x))-2.0*F(x)*(diff(diff(diff(F(x), x), x), x)) = 0

 

4.243773825*(diff(diff(diff(diff(F(x), x), x), x), x))-4.005906007*(diff(diff(F(x), x), x))-.5*(diff(diff(diff(F(x), x), x), x))-2.0*F(x)*(diff(diff(diff(F(x), x), x), x)) = 0

 

4.243773825*(diff(diff(diff(diff(F(x), x), x), x), x))-1.005906007*(diff(diff(F(x), x), x))+.5*(diff(diff(diff(F(x), x), x), x))-2.0*F(x)*(diff(diff(diff(F(x), x), x), x)) = 0

 

4.243773825*(diff(diff(diff(diff(F(x), x), x), x), x))+.494093993*(diff(diff(F(x), x), x))+diff(diff(diff(F(x), x), x), x)-2.0*F(x)*(diff(diff(diff(F(x), x), x), x)) = 0

(4)

bcs := F(-1) = -1, F(1) = 1, (D(F))(-1) = 0, (D(F))(1) = 0;

F(-1) = -1, F(1) = 1, (D(F))(-1) = 0, (D(F))(1) = 0

(5)

AllC := [ seq( dsolve({AllB[i], bcs}, numeric), i=1..numelems(AllA)) ];

AllC[1](0);

colors  := [red, gold, green, blue]:
legends := [ seq(cat("data set a", i), i=1..numelems(AllA)) ];

display(
  seq(
    odeplot(AllC[i], [x, diff(F(x), x)], -1..1, color=colors[i], legend=legends[i])
    , i=1..numelems(AllA)
  )
)

[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) = -1.0, (2) = -.8345204915051194, (3) = -.613691680718111, (4) = -.3419593760168745, (5) = -0.30799685620354136e-1, (6) = .261867322088955, (7) = .49531217387834137, (8) = .6834721467651494, (9) = .8471616133630866, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 4, {(1, 1) = -1.0, (1, 2) = .0, (1, 3) = 3.1636830295853944, (1, 4) = -4.607032094044634, (2, 1) = -.9600083071821683, (2, 2) = .4641435042824518, (2, 3) = 2.4670081858897706, (2, 4) = -3.8449519456918044, (3, 1) = -.8038896314203525, (3, 2) = .9217743985030411, (3, 3) = 1.7046802961225183, (3, 4) = -3.1099803799278667, (4, 1) = -.5003436588990865, (4, 2) = 1.2777956453763997, (4, 3) = .93926555275606, (4, 4) = -2.5886165747900933, (5, 1) = -0.6991456323748237e-1, (5, 2) = 1.4489743289330363, (5, 3) = .1685876354270685, (5, 4) = -2.442192850610124, (6, 1) = .35099468269583234, (6, 2) = 1.3910256110120378, (6, 3) = -.5792822530856752, (6, 4) = -2.745091306679072, (7, 1) = .653851403072871, (7, 2) = 1.1762711862773043, (7, 3) = -1.2844409058641224, (7, 4) = -3.3599344632577943, (8, 1) = .8485116918581102, (8, 2) = .8707876943971833, (8, 3) = -1.9881043917473578, (8, 4) = -4.17394509227341, (9, 1) = .9611973502450049, (9, 2) = .4852860212631082, (9, 3) = -2.7494939818683, (9, 4) = -5.1808107093802835, (10, 1) = 1.0, (10, 2) = .0, (10, 3) = -3.632609179737446, (10, 4) = -6.429500616264703}, datatype = float[8], order = C_order); YP := Matrix(10, 4, {(1, 1) = .0, (1, 2) = 3.1636830295853944, (1, 3) = -4.607032094044634, (1, 4) = 5.190185528061891, (2, 1) = .4641435042824518, (2, 2) = 2.4670081858897706, (2, 3) = -3.8449519456918044, (2, 4) = 4.034271280109428, (3, 1) = .9217743985030411, (3, 2) = 1.7046802961225183, (3, 3) = -3.1099803799278667, (3, 4) = 2.657066924436565, (4, 1) = 1.2777956453763997, (4, 2) = .93926555275606, (4, 3) = -2.5886165747900933, (4, 4) = 1.2190298693244515, (5, 1) = 1.4489743289330363, (5, 2) = .1685876354270685, (5, 3) = -2.442192850610124, (5, 4) = -.2762813315156067, (6, 1) = 1.3910256110120378, (6, 2) = -.5792822530856752, (6, 3) = -2.745091306679072, (6, 4) = -1.8524997259979574, (7, 1) = 1.1762711862773043, (7, 2) = -1.2844409058641224, (7, 3) = -3.3599344632577943, (7, 4) = -3.493527624215365, (8, 1) = .8707876943971833, (8, 2) = -1.9881043917473578, (8, 3) = -4.17394509227341, (8, 4) = -5.232027988502383, (9, 1) = .4852860212631082, (9, 2) = -2.7494939818683, (9, 3) = -5.1808107093802835, (9, 4) = -7.134882875694695, (10, 1) = .0, (10, 2) = -3.632609179737446, (10, 3) = -6.429500616264703, (10, 4) = -9.25810567969981}, 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) = -1.0, (2) = -.8345204915051194, (3) = -.613691680718111, (4) = -.3419593760168745, (5) = -0.30799685620354136e-1, (6) = .261867322088955, (7) = .49531217387834137, (8) = .6834721467651494, (9) = .8471616133630866, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 4, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.320965229302303e-6, (1, 4) = 0.20625435773980762e-6, (2, 1) = -0.21662828660741597e-8, (2, 2) = -0.5321047471110476e-7, (2, 3) = -0.29748745205442183e-6, (2, 4) = 0.14474251093437116e-6, (3, 1) = -0.12802224185955755e-7, (3, 2) = -0.12880359685429147e-6, (3, 3) = -0.2754609284674051e-6, (3, 4) = 0.422248919810272e-7, (4, 1) = -0.2488039788282393e-7, (4, 2) = -0.24645040885322146e-6, (4, 3) = -0.2232055894767619e-6, (4, 4) = -0.16612887001043793e-6, (5, 1) = -0.30207191488881113e-8, (5, 2) = -0.31616645991050967e-6, (5, 3) = -0.8442964129401751e-7, (5, 4) = -0.33082012445115147e-6, (6, 1) = 0.17692274965987335e-7, (6, 2) = -0.21929135648323933e-6, (6, 3) = 0.7591113124113682e-7, (6, 4) = -0.16518221277806597e-6, (7, 1) = 0.8997213689790162e-8, (7, 2) = -0.14049504318983955e-6, (7, 3) = 0.15011911446779624e-6, (7, 4) = -0.3775879681945588e-8, (8, 1) = 0.4950006422490701e-9, (8, 2) = -0.8694952700639968e-7, (8, 3) = 0.19486283016094694e-6, (8, 4) = 0.10646699460348378e-6, (9, 1) = -0.233653484917027e-8, (9, 2) = -0.4145693924776069e-7, (9, 3) = 0.23275364039844293e-6, (9, 4) = 0.19144199127325873e-6, (10, 1) = .0, (10, 2) = .0, (10, 3) = 0.26202545849335726e-6, (10, 4) = 0.24531565723179697e-6}, 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.3082012445115147e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [4, 10, [F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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(4, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(10, 4, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(4, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(10, 4, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = yout[i], i = 1 .. 4)] 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.3082012445115147e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [4, 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(4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(10, 4, 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(4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}); `dsolve/numeric/hermite`(10, 4, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 4)] end proc, (2) = Array(0..0, {}), (3) = [x, F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = res[i+1], i = 1 .. 4)] catch: error  end try end proc, 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) = -1.0, (2) = -.8230223002196657, (3) = -.6120604124702849, (4) = -.365734113634546, (5) = -0.8521083706438085e-1, (6) = .19807440722060754, (7) = .4441585008746424, (8) = .6506759302644971, (9) = .8310728926272699, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 4, {(1, 1) = -1.0, (1, 2) = .0, (1, 3) = 3.2024054605007, (1, 4) = -4.561772646438333, (2, 1) = -.9538821065519519, (2, 2) = .499354216305126, (2, 3) = 2.462188482329671, (2, 4) = -3.834015030700587, (3, 1) = -.7994699363427611, (3, 2) = .9386310747679936, (3, 3) = 1.7246690988739413, (3, 4) = -3.1980477350676435, (4, 1) = -.5235639084761247, (4, 2) = 1.2718031406443107, (4, 3) = .9992635168967455, (4, 4) = -2.739308864691832, (5, 1) = -.13728232826492662, (5, 2) = 1.447997749307266, (5, 3) = .26608580079925903, (5, 4) = -2.5429470673842762, (6, 1) = .27392352756220795, (6, 2) = 1.4206602755546929, (6, 3) = -.46549948973869354, (6, 4) = -2.6793461768366402, (7, 1) = .6025721387687291, (7, 2) = 1.2215183660280955, (7, 3) = -1.1701367490289056, (7, 4) = -3.0985615431983247, (8, 1) = .8251391118646613, (8, 2) = .9098931672344264, (8, 3) = -1.8688868827206906, (8, 4) = -3.7129945299859637, (9, 1) = .9550662052310327, (9, 2) = .5084512958428912, (9, 3) = -2.605114303252651, (9, 4) = -4.49032135449593, (10, 1) = 1.0, (10, 2) = .0, (10, 3) = -3.4418755414950137, (10, 4) = -5.4574567197898505}, datatype = float[8], order = C_order); YP := Matrix(10, 4, {(1, 1) = .0, (1, 2) = 3.2024054605007, (1, 3) = -4.561772646438333, (1, 4) = 4.635306934795669, (2, 1) = .499354216305126, (2, 2) = 2.462188482329671, (2, 3) = -3.834015030700587, (2, 4) = 3.596017463172271, (3, 1) = .9386310747679936, (3, 2) = 1.7246690988739413, (3, 3) = -3.1980477350676435, (3, 4) = 2.4561451443713196, (4, 1) = 1.2718031406443107, (4, 2) = .9992635168967455, (4, 3) = -2.739308864691832, (4, 4) = 1.2964187138341203, (5, 1) = 1.447997749307266, (5, 2) = .26608580079925903, (5, 3) = -2.5429470673842762, (5, 4) = .11608643215970291, (6, 1) = 1.4206602755546929, (6, 2) = -.46549948973869354, (6, 3) = -2.6793461768366402, (6, 4) = -1.1009757814453724, (7, 1) = 1.2215183660280955, (7, 2) = -1.1701367490289056, (7, 3) = -3.0985615431983247, (7, 4) = -2.349548474329587, (8, 1) = .9098931672344264, (8, 2) = -1.8688868827206906, (8, 3) = -3.7129945299859637, (8, 4) = -3.645471486112765, (9, 1) = .5084512958428912, (9, 2) = -2.605114303252651, (9, 3) = -4.49032135449593, (9, 4) = -5.009247180175052, (10, 1) = .0, (10, 2) = -3.4418755414950137, (10, 3) = -5.4574567197898505, (10, 4) = -6.463933479418131}, 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) = -1.0, (2) = -.8230223002196657, (3) = -.6120604124702849, (4) = -.365734113634546, (5) = -0.8521083706438085e-1, (6) = .19807440722060754, (7) = .4441585008746424, (8) = .6506759302644971, (9) = .8310728926272699, (10) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(10, 4, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.21795585591266545e-6, (1, 4) = 0.15859585924547324e-6, (2, 1) = -0.7382788075766052e-9, (2, 2) = -0.3484970048445586e-7, (2, 3) = -0.20310495291492214e-6, (2, 4) = 0.13757794743245046e-6, (3, 1) = -0.4824796191312689e-8, (3, 2) = -0.786371881262705e-7, (3, 3) = -0.17951856691697007e-6, (3, 4) = 0.9262522073134566e-7, (4, 1) = -0.9653802963899059e-8, (4, 2) = -0.13506031575634385e-6, (4, 3) = -0.13410901880448737e-6, (4, 4) = 0.10579088076766957e-7, (5, 1) = -0.5168842837487e-8, (5, 2) = -0.1808930499416432e-6, (5, 3) = -0.55580325882813683e-7, (5, 4) = -0.6730545231057284e-7, (6, 1) = 0.57062913913256185e-8, (6, 2) = -0.15787889363918775e-6, (6, 3) = 0.3988819587012066e-7, (6, 4) = -0.3456323983230098e-7, (7, 1) = 0.36524231994704153e-8, (7, 2) = -0.10923881948943386e-6, (7, 3) = 0.10645399214968022e-6, (7, 4) = 0.5146402980834153e-7, (8, 1) = -0.5261386113252735e-9, (8, 2) = -0.6721228628347843e-7, (8, 3) = 0.1509773553809045e-6, (8, 4) = 0.12360533872225815e-6, (9, 1) = -0.1690561041667948e-8, (9, 2) = -0.30794920851512984e-7, (9, 3) = 0.1838203466569299e-6, (9, 4) = 0.17408963220781308e-6, (10, 1) = .0, (10, 2) = .0, (10, 3) = 0.20174679478711903e-6, (10, 4) = 0.1916208597032606e-6}, 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(2.1795585591266545e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [4, 10, [F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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(4, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(10, 4, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(4, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(10, 4, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = yout[i], i = 1 .. 4)] 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(2.1795585591266545e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [4, 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(4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(10, 4, 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(4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}); `dsolve/numeric/hermite`(10, 4, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 4)] end proc, (2) = Array(0..0, {}), (3) = [x, F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = res[i+1], i = 1 .. 4)] catch: error  end try end proc, 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(11, {(1) = -1.0, (2) = -.8349702453362813, (3) = -.6629989401386771, (4) = -.47695397178592847, (5) = -.271772047084955, (6) = -0.4754132124094439e-1, (7) = .1858007458755159, (8) = .41429059327121887, (9) = .6299012307002473, (10) = .827687111900952, (11) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(11, 4, {(1, 1) = -1.0, (1, 2) = .0, (1, 3) = 3.305926822008611, (1, 4) = -4.523672488554754, (2, 1) = -.9582671849373837, (2, 2) = .4864591352968459, (2, 3) = 2.6039107003814994, (2, 4) = -3.9993592087600627, (3, 1) = -.8393949741649898, (3, 2) = .8774432042162891, (3, 3) = 1.9559445568175164, (3, 4) = -3.5537943498965046, (4, 1) = -.6460071110487181, (4, 2) = 1.1821174091381894, (4, 3) = 1.3306943429352183, (4, 4) = -3.187151863442845, (5, 1) = -.3799225547985622, (5, 2) = 1.3902207781570464, (5, 3) = .707183835292867, (5, 4) = -2.911995514638119, (6, 1) = -0.5579044150654242e-1, (6, 2) = 1.4772264934892843, (6, 3) = 0.7486120014579348e-1, (6, 4) = -2.7510082082307656, (7, 1) = .28515756576090134, (7, 2) = 1.4203581008545112, (7, 3) = -.5612480171204297, (7, 4) = -2.724169791644911, (8, 1) = .5895951934544567, (8, 2) = 1.220374178925209, (8, 3) = -1.1932223381511113, (8, 4) = -2.8287988271332107, (9, 1) = .8201843814448493, (9, 2) = .8959047730799011, (9, 3) = -1.8242537511744776, (9, 4) = -3.0431398450851828, (10, 1) = .9576901660006452, (10, 2) = .4738110215978004, (10, 3) = -2.4535632213564074, (10, 4) = -3.3350595641956406, (11, 1) = 1.0, (11, 2) = .0, (11, 3) = -3.0550877141299635, (11, 4) = -3.656004771833288}, datatype = float[8], order = C_order); YP := Matrix(11, 4, {(1, 1) = .0, (1, 2) = 3.305926822008611, (1, 3) = -4.523672488554754, (1, 4) = 3.448495012654861, (2, 1) = .4864591352968459, (2, 2) = 2.6039107003814994, (2, 3) = -3.9993592087600627, (2, 4) = 2.8945648159393023, (3, 1) = .8774432042162891, (3, 2) = 1.9559445568175164, (3, 3) = -3.5537943498965046, (3, 4) = 2.28816807574519, (4, 1) = 1.1821174091381894, (4, 2) = 1.3306943429352183, (4, 3) = -3.187151863442845, (4, 4) = 1.6612513274817053, (5, 1) = 1.3902207781570464, (5, 2) = .707183835292867, (5, 3) = -2.911995514638119, (5, 4) = 1.0321058465598076, (6, 1) = 1.4772264934892843, (6, 2) = 0.7486120014579348e-1, (6, 3) = -2.7510082082307656, (6, 4) = .414199114412958, (7, 1) = 1.4203581008545112, (7, 2) = -.5612480171204297, (7, 3) = -2.724169791644911, (7, 4) = -.17816998271002774, (8, 1) = 1.220374178925209, (8, 2) = -1.1932223381511113, (8, 3) = -2.8287988271332107, (8, 4) = -.7355628778168632, (9, 1) = .8959047730799011, (9, 2) = -1.8242537511744776, (9, 3) = -3.0431398450851828, (9, 4) = -1.250144245620543, (10, 1) = .4738110215978004, (10, 2) = -2.4535632213564074, (10, 3) = -3.3350595641956406, (10, 4) = -1.6938771934039125, (11, 1) = .0, (11, 2) = -3.0550877141299635, (11, 3) = -3.656004771833288, (11, 4) = -2.0163982799684574}, 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(11, {(1) = -1.0, (2) = -.8349702453362813, (3) = -.6629989401386771, (4) = -.47695397178592847, (5) = -.271772047084955, (6) = -0.4754132124094439e-1, (7) = .1858007458755159, (8) = .41429059327121887, (9) = .6299012307002473, (10) = .827687111900952, (11) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(11, 4, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.9790569767920404e-7, (1, 4) = 0.112448305705116e-6, (2, 1) = 0.45844983361163896e-9, (2, 2) = -0.1094032518009447e-7, (2, 3) = -0.8955075685573662e-7, (2, 4) = 0.1191242510363102e-6, (3, 1) = 0.8009839376081181e-9, (3, 2) = -0.2360070345808789e-7, (3, 3) = -0.7338664365543241e-7, (3, 4) = 0.11390192178403137e-6, (4, 1) = 0.6876293051178672e-9, (4, 2) = -0.35999957113990896e-7, (4, 3) = -0.5141334884606263e-7, (4, 4) = 0.10156126373300032e-6, (5, 1) = 0.7037244555939593e-9, (5, 2) = -0.4632169913045516e-7, (5, 3) = -0.2399556636436062e-7, (5, 4) = 0.8670442182328977e-7, (6, 1) = 0.17494118211695317e-8, (6, 2) = -0.51600905679493496e-7, (6, 3) = 0.7897919546512352e-8, (6, 4) = 0.7578789917080854e-7, (7, 1) = 0.3147374590803252e-8, (7, 2) = -0.4857425579192532e-7, (7, 3) = 0.3987221642558589e-7, (7, 4) = 0.7437579754899402e-7, (8, 1) = 0.33146152582413634e-8, (8, 2) = -0.3828130722331125e-7, (8, 3) = 0.6626767042182201e-7, (8, 4) = 0.7959026322089725e-7, (9, 1) = 0.21983578800699434e-8, (9, 2) = -0.25371684974673274e-7, (9, 3) = 0.8406273273179104e-7, (9, 4) = 0.8317133836751885e-7, (10, 1) = 0.5437855531352124e-9, (10, 2) = -0.12802270154238087e-7, (10, 3) = 0.9379983254400154e-7, (10, 4) = 0.8062674681017602e-7, (11, 1) = .0, (11, 2) = .0, (11, 3) = 0.10052401942370861e-6, (11, 4) = 0.7587793139634221e-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[11] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.191242510363102e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [4, 11, [F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[11] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[11] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(4, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(11, 4, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(4, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(11, 4, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = yout[i], i = 1 .. 4)] 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[11] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.191242510363102e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [4, 11, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[11] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[11] 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(4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(11, 4, 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(4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}); `dsolve/numeric/hermite`(11, 4, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 4)] end proc, (2) = Array(0..0, {}), (3) = [x, F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = res[i+1], i = 1 .. 4)] catch: error  end try end proc, 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(13, {(1) = -1.0, (2) = -.8648048849604972, (3) = -.7258144766126813, (4) = -.5806548650009224, (5) = -.4251954881870461, (6) = -.25830200663898156, (7) = -0.7906320968469074e-1, (8) = .10896859691459088, (9) = .30218845783835674, (10) = .4950993608940931, (11) = .6842045337170743, (12) = .8563830920544138, (13) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(13, 4, {(1, 1) = -1.0, (1, 2) = .0, (1, 3) = 3.373722494305436, (1, 4) = -4.540543484968664, (2, 1) = -.9709994051712143, (2, 2) = .4157529846211831, (2, 3) = 2.784924226032603, (2, 4) = -4.175384508203814, (3, 1) = -.8881431843504255, (3, 2) = .7636161458832533, (3, 3) = 2.2284237467793426, (3, 4) = -3.8397480759739473, (4, 1) = -.7557361304421567, (4, 2) = 1.047742309074612, (4, 3) = 1.6935372508295938, (4, 4) = -3.5384993911508076, (5, 1) = -.57456181187085, (5, 2) = 1.2693883369188317, (5, 3) = 1.1648387824551296, (5, 4) = -3.2729827638861617, (6, 1) = -.3489758737997563, (6, 2) = 1.4193148302520373, (6, 3) = .6380114908991168, (6, 4) = -3.050802164777067, (7, 1) = -0.8721290290439132e-1, (7, 2) = 1.4856754446728115, (7, 3) = .10760443033540439, (7, 4) = -2.8784616899570166, (8, 1) = .1908914101879065, (8, 2) = 1.4557957427238546, (8, 3) = -.4218076470447148, (8, 4) = -2.7630465319931523, (9, 1) = .4610068956882461, (9, 2) = 1.3231672424400462, (9, 3) = -.9491453862557799, (9, 4) = -2.704760635382748, (10, 1) = .6953692349713777, (10, 2) = 1.0898540289713925, (10, 3) = -1.4695029587825694, (10, 4) = -2.697678065088815, (11, 1) = .8721442840050412, (11, 2) = .7635868911696608, (11, 3) = -1.9821500585914997, (11, 4) = -2.7295310300633284, (12, 1) = .9719047540926605, (12, 2) = .38161022893967533, (12, 3) = -2.456305521844615, (12, 4) = -2.780622799851062, (13, 1) = 1.0, (13, 2) = .0, (13, 3) = -2.8591443331860087, (13, 4) = -2.829325237274913}, datatype = float[8], order = C_order); YP := Matrix(13, 4, {(1, 1) = .0, (1, 2) = 3.373722494305436, (1, 3) = -4.540543484968664, (1, 4) = 2.8169961287747656, (2, 1) = .4157529846211831, (2, 2) = 2.784924226032603, (2, 3) = -4.175384508203814, (2, 4) = 2.5703447861797697, (3, 1) = .7636161458832533, (3, 2) = 2.2284237467793426, (3, 3) = -3.8397480759739473, (3, 4) = 2.252520951780353, (4, 1) = 1.047742309074612, (4, 2) = 1.6935372508295938, (4, 3) = -3.5384993911508076, (4, 4) = 1.8969145895692585, (5, 1) = 1.2693883369188317, (5, 2) = 1.1648387824551296, (5, 3) = -3.2729827638861617, (5, 4) = 1.5218776963785599, (6, 1) = 1.4193148302520373, (6, 2) = .6380114908991168, (6, 3) = -3.050802164777067, (6, 4) = 1.1463563853206438, (7, 1) = 1.4856754446728115, (7, 2) = .10760443033540439, (7, 3) = -2.8784616899570166, (7, 4) = .784059925028772, (8, 1) = 1.4557957427238546, (8, 2) = -.4218076470447148, (8, 3) = -2.7630465319931523, (8, 4) = .4516205476114067, (9, 1) = 1.3231672424400462, (9, 2) = -.9491453862557799, (9, 3) = -2.704760635382748, (9, 4) = .16021142715357983, (10, 1) = 1.0898540289713925, (10, 2) = -1.4695029587825694, (10, 3) = -2.697678065088815, (10, 4) = -0.7729300109926096e-1, (11, 1) = .7635868911696608, (11, 2) = -1.9821500585914997, (11, 3) = -2.7295310300633284, (11, 4) = -.24793741323626228, (12, 1) = .38161022893967533, (12, 2) = -2.456305521844615, (12, 3) = -2.780622799851062, (12, 4) = -.33242403861147385, (13, 1) = .0, (13, 2) = -2.8591443331860087, (13, 3) = -2.829325237274913, (13, 4) = -.3338159043213642}, 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(13, {(1) = -1.0, (2) = -.8648048849604972, (3) = -.7258144766126813, (4) = -.5806548650009224, (5) = -.4251954881870461, (6) = -.25830200663898156, (7) = -0.7906320968469074e-1, (8) = .10896859691459088, (9) = .30218845783835674, (10) = .4950993608940931, (11) = .6842045337170743, (12) = .8563830920544138, (13) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(13, 4, {(1, 1) = .0, (1, 2) = .0, (1, 3) = -0.3415082014380156e-7, (1, 4) = 0.48382845169449726e-7, (2, 1) = 0.27985988830463634e-9, (2, 2) = -0.29747826355335317e-8, (2, 3) = -0.3095389907332211e-7, (2, 4) = 0.5147221467081313e-7, (3, 1) = 0.5634000429010082e-9, (3, 2) = -0.6211191988774322e-8, (3, 3) = -0.25930801472913458e-7, (3, 4) = 0.5154159579146692e-7, (4, 1) = 0.7626915129413819e-9, (4, 2) = -0.9346779650031032e-8, (4, 3) = -0.19466852860884187e-7, (4, 4) = 0.49264545198076486e-7, (5, 1) = 0.9192783248897028e-9, (5, 2) = -0.12057649486810488e-7, (5, 3) = -0.11869291988131077e-7, (5, 4) = 0.4550569117408885e-7, (6, 1) = 0.11235020840583405e-8, (6, 2) = -0.14047846787318742e-7, (6, 3) = -0.3354285736686311e-8, (6, 4) = 0.4099263112608454e-7, (7, 1) = 0.14812479427117337e-8, (7, 2) = -0.1499312754963664e-7, (7, 3) = 0.5692827186509835e-8, (7, 4) = 0.3658035870208618e-7, (8, 1) = 0.18709366046929603e-8, (8, 2) = -0.1462195147457879e-7, (8, 3) = 0.144873707517166e-7, (8, 4) = 0.32954590048008254e-7, (9, 1) = 0.20523163456542436e-8, (9, 2) = -0.12985898887961813e-7, (9, 3) = 0.22089109706539154e-7, (9, 4) = 0.3014074072119169e-7, (10, 1) = 0.1742172910215283e-8, (10, 2) = -0.10486608719607884e-7, (10, 3) = 0.2771055675320638e-7, (10, 4) = 0.27458856045370038e-7, (11, 1) = 0.8783277962319171e-9, (11, 2) = -0.765167083971309e-8, (11, 3) = 0.3113401515282755e-7, (11, 4) = 0.2425696806134047e-7, (12, 1) = 0.10072978358224701e-9, (12, 2) = -0.41105690627636155e-8, (12, 3) = 0.33450107039721626e-7, (12, 4) = 0.21040741295422602e-7, (13, 1) = .0, (13, 2) = .0, (13, 3) = 0.35515395588326785e-7, (13, 4) = 0.18772939557195428e-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[13] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(5.154159579146692e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [4, 13, [F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[13] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[13] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(4, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(13, 4, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(4, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(13, 4, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = yout[i], i = 1 .. 4)] 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[13] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(5.154159579146692e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [4, 13, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[13] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[13] 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(4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(13, 4, 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(4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}); `dsolve/numeric/hermite`(13, 4, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 4)] end proc, (2) = Array(0..0, {}), (3) = [x, F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), 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('[F(x), diff(F(x), x), diff(diff(F(x), x), x), diff(diff(diff(F(x), x), x), x)]'[i] = res[i+1], i = 1 .. 4)] catch: error  end try end proc]

 

[x = 0., F(x) = HFloat(-0.02521855623397279), diff(F(x), x) = HFloat(1.4530068811004437), diff(diff(F(x), x), x) = HFloat(0.09321390760388122), diff(diff(diff(F(x), x), x), x) = HFloat(-2.453032561333428)]

 

["data set a1", "data set a2", "data set a3", "data set a4"]

 

 

 

 

Download eq1_only.mw

@shashi598 

Let's try to synchronize our exchanges.

What I propose is for you to read my previous reply (that I updated meanwhile), and for me to wait for your return.
Maybe, or maybe not, the procedure LaneEmdenSolution  my last reply contains will give you some answers.

If not, I propose you to explain again what you want to achieve . For instance:

  • Is it enough for you to compute the solution (n=1) from 0 to Pi?
    If not, look below to the attached file.
     
  • Is the problem for n <> 1 of the same nature (a condition, or boundary condition) at some specific value of xi?
    The LaneEmdenSolution procedure was written assuming this, but I can be cometely out of the way.

See you soon

BTW, here is a procedure that builds the numerical solution of the Lane-Emden equafion on any range 0..some_value:

restart


Numerical solution of the Lane-Emden equation on arbitrary ranges

Procedure:

   1  Solve numerically the Emden equation  (result = EmdenN)

   2  For the Lane-Emden equation

        2.1   Use the known option option to instruct dsolve that it has to use the EmdenN solution
        2.2   Solve numerically a boundary value problem for the Lane-Emden equation (result = LaneEmden_bc)
                from 0 to a given abscissa xi = BC_IC_transition_point with conditions
       D(gamma)(0) = 0,
       gamma(BC_IC_transition_point)+BC_IC_transition_point*D(gamma)(BC_IC_transition_point) = 0

        2.3   Solve numerically an initial value problem for the Lane-Emden equation (result = LaneEmden_ic)
                from  xi = BC_IC_transition_point  to xi = EndPoint with conditions
       gamma(BC_IC_transition_point)    = eval(gamma(xi), LaneEmden_bc(BC_IC_transition_point)
       D(gamma)(BC_IC_transition_point) = eval(diff(gamma(xi), xi), LaneEmden_bc(BC_IC_transition_point)
                

LaneEmden := proc(n, alpha, BC_IC_transition_point, EndPoint)
  local gamma:
  local ode1, ode2, EmdenN, LaneEmden_bc, LaneEmden_ic, f, bc, End_bc, ic:

  ode1   := diff(xi^2*(diff(theta__0(xi), xi)), xi)/xi^2 = -theta__0(xi)^n;
  EmdenN := dsolve({ode1, theta__0(0) = 1, (D(theta__0))(0) = 0}, theta__0(xi), numeric);

  f := proc(z)
    if not type(evalf(z),'numeric') then
      'procname'(z);
    else
      eval(theta__0(xi), EmdenN(z));
    end if;
  end proc;

  printf("Emden = 0 at xi = %a\n", fsolve(f(xi)=0, xi=0..EndPoint));
  ode2         := diff(gamma(xi), xi, xi)-2*gamma(xi)/xi^2+alpha^2*gamma(xi) = -f(xi)^n*xi^2:
  bc           := D(gamma)(0) = 0, gamma(BC_IC_transition_point)+BC_IC_transition_point*D(gamma)(BC_IC_transition_point) = 0;
  LaneEmden_bc := dsolve({ode2, bc}, known=f, numeric, method=bvp[midrich], maxmesh=1024):

  End_bc       := eval([gamma(xi), diff(gamma(xi), xi)], LaneEmden_bc(BC_IC_transition_point));
  ic           := gamma(BC_IC_transition_point) = End_bc[1], D(gamma)(BC_IC_transition_point) = End_bc[2];
  LaneEmden_ic := dsolve({ode2, ic}, known=f, numeric):
  
  DocumentTools:-Tabulate(
    [
      plots:-display(
        plots:-odeplot(
          EmdenN
          , [xi, theta__0(xi)]
          , xi=0..EndPoint
          , color=blue
          , gridlines=true
          , title = cat("Emden, n=", N, ", numerical solution")
        )
      ),
      
      plots:-display(
        plots:-odeplot(
          LaneEmden_bc
          , [xi, gamma(xi)]
          , xi=0..BC_IC_transition_point
          , color=blue
          , gridlines=true
          , title = cat("Lane-Emden, n=", N, ", numerical solution")
        ),
        plots:-odeplot(
          LaneEmden_ic
          , [xi, gamma(xi)]
          , xi=BC_IC_transition_point..EndPoint
          , color=red
          , gridlines=true
          , title = cat("Lane-Emden, n=", N, ", numerical solution")
        )
      ),
      
      plots:-display(
        plots:-odeplot(
          LaneEmden_bc
          , [xi, gamma(xi)+xi*D(gamma)(xi)]
          , xi=0..BC_IC_transition_point
          , color=blue
          , gridlines=true
          , title = typeset('gamma(xi)+xi*D(gamma)(xi)', `, n`=N)
        ),
        plots:-odeplot(
          LaneEmden_ic
          , [xi, gamma(xi)+xi*D(gamma)(xi)]
          , xi=BC_IC_transition_point..EndPoint
          , color=red
          , gridlines=true
          , title = typeset('gamma(xi)+xi*D(gamma)(xi)', `, n`=N)
        )
      )
    ], width=80
  ):
end proc:

LaneEmden(1, 1.4, Pi, 10)

Emden = 0 at xi = 3.141592311

 

LaneEmden(3, 1.4, Pi, 10)

Emden = 0 at xi = 6.896848025

 

LaneEmden(3, 1.4, 6.896848025, 10)

Emden = 0 at xi = 6.896848025

 

 

Download General_Emden_and_Lane-Emden_2.mw

@shashi598

Here are the numerical solutions for the Emden and Lane-Emden equations when n=2.

I used the same condition at xi=Pi than for the case n=1.

restart

local gamma:

ode1 := n -> (diff(xi^2*(diff(theta__0(xi), xi)), xi))/xi^2 = -theta__0(xi)^n;

proc (n) options operator, arrow; (diff(xi^2*(diff(theta__0(xi), xi)), xi))/xi^2 = -theta__0(xi)^n end proc

(1)

EmdenN := dsolve({ode1(2), theta__0(0) = 1, (D(theta__0))(0) = 0}, theta__0(xi), numeric);

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 ) = ([0, 0, 0, Array(1..0, 1..2, {}, 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) = 0, (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, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.15142976267524639e-1, (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) = 1.0, (2) = .0}, 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) = 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) = -.3333333333333333}, 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, xi, Y, YP) option `[Y[1] = theta__0(xi), Y[2] = diff(theta__0(xi),xi)]`; if xi = 0 then if abs(Y[2]) <= 0. then YP[1] := 0; YP[2] := -(1/3)*Y[1]^2 else error "system with provided initial conditions is singular" end if else YP[1] := Y[2]; YP[2] := -Y[1]^2-2*Y[2]/xi end if; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, xi, Y, YP) option `[Y[1] = theta__0(xi), Y[2] = diff(theta__0(xi),xi)]`; if xi = 0 then if abs(Y[2]) <= 0. then YP[1] := 0; YP[2] := -(1/3)*Y[1]^2 else error "system with provided initial conditions is singular" end if else YP[1] := Y[2]; YP[2] := -Y[1]^2-2*Y[2]/xi end if; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.}); _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 error "initial conditions cannot be changed for systems with removable singularities"; _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) = [xi, theta__0(xi), diff(theta__0(xi), xi)], (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

(2)

f := proc(z)
  if not type(evalf(z),'numeric') then
    'procname'(z);
  else
    eval(theta__0(xi), EmdenN(z));
  end if;
end proc;

proc (z) if not type(evalf(z), 'numeric') then ('procname')(z) else eval(theta__0(xi), EmdenN(z)) end if end proc

(3)

ode2 := n -> diff(gamma(xi), xi, xi)-2*gamma(xi)/xi^2+alpha^2*gamma(xi) = -f(xi)^n*xi^2:
bc   := D(gamma)(0) = 0, gamma(Pi)+Pi*D(gamma)(Pi) = 0;
 

(D(gamma))(0) = 0, gamma(Pi)+Pi*(D(gamma))(Pi) = 0

(4)

LaneEmdenN := dsolve(eval({ode2(2),bc}, alpha=1.4), known=f, numeric, method=bvp[midrich])

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(21, {(1) = .0, (2) = .14513627423941433, (3) = .3300400490930955, (4) = .5165023585796639, (5) = .6984874769290668, (6) = .8754987420749759, (7) = 1.0477984333758916, (8) = 1.2161354551828685, (9) = 1.381491829739222, (10) = 1.544938482475059, (11) = 1.706990580432664, (12) = 1.86782403214045, (13) = 2.0268617606734813, (14) = 2.1829057195303156, (15) = 2.3345474597633578, (16) = 2.480765541674215, (17) = 2.621314804334309, (18) = 2.7565733129807373, (19) = 2.8873920925965884, (20) = 3.0152209358089883, (21) = 3.14159265358979}, datatype = float[8], order = C_order); Y := Matrix(21, 2, {(1, 1) = 0.3196359284514304e-7, (1, 2) = .0, (2, 1) = -0.9730558766353057e-3, (2, 2) = -0.13962548531557952e-1, (3, 1) = -0.5883248720420963e-2, (3, 2) = -0.4193569074785368e-1, (4, 1) = -0.1797318430674736e-1, (4, 2) = -0.9217458399181636e-1, (5, 1) = -0.4131348085259813e-1, (5, 2) = -.16919951608979755, (6, 1) = -0.799384622393236e-1, (6, 2) = -.27147172592215324, (7, 1) = -.1368808144020243, (7, 2) = -.3923733235831555, (8, 1) = -.21377046636790417, (8, 2) = -.522166351819157, (9, 1) = -.3107342879987383, (9, 2) = -.6495536186941127, (10, 1) = -.4264111902380307, (10, 2) = -.7627187681305828, (11, 1) = -.5574829390654967, (11, 2) = -.8497305519434499, (12, 1) = -.6987270372291136, (12, 2) = -.8997776058025547, (13, 1) = -.8428362081015748, (13, 2) = -.9044220887548388, (14, 1) = -.9811198896068852, (14, 2) = -.859412018823206, (15, 1) = -1.104969995970345, (15, 2) = -.7657798697605145, (16, 1) = -1.2074972138252416, (16, 2) = -.6292060639323462, (17, 1) = -1.2843268757686124, (17, 2) = -.45787966719328504, (18, 1) = -1.333238966633956, (18, 2) = -.2605172649515533, (19, 1) = -1.3534559765434562, (19, 2) = -0.4508440372973734e-1, (20, 1) = -1.3448316074602937, (20, 2) = .1821964354673438, (21, 1) = -1.3070870490799873, (21, 2) = .4160587298249581}, datatype = float[8], order = C_order); YP := Matrix(21, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = -0.13962548531557952e-1, (2, 2) = -.1113980704842691, (3, 1) = -0.4193569074785368e-1, (3, 2) = -.2015405048482742, (4, 1) = -0.9217458399181636e-1, (4, 2) = -.343687325666759, (5, 1) = -.16919951608979755, (5, 2) = -.5035675400369335, (6, 1) = -.27147172592215324, (6, 2) = -.647402113315466, (7, 1) = -.3923733235831555, (7, 2) = -.7471633832591599, (8, 1) = -.522166351819157, (8, 2) = -.783232537248921, (9, 1) = -.6495536186941127, (9, 2) = -.744437364628368, (10, 1) = -.7627187681305828, (10, 2) = -.6270886267407635, (11, 1) = -.8497305519434499, (11, 2) = -.4347025919309241, (12, 1) = -.8997776058025547, (12, 2) = -.1777770455058657, (13, 1) = -.9044220887548388, (13, 2) = .12613920234815157, (14, 1) = -.859412018823206, (14, 2) = .45393263278434093, (15, 1) = -.7657798697605145, (15, 2) = .780604700549791, (16, 1) = -.6292060639323462, (16, 2) = 1.0840315896768058, (17, 1) = -.45787966719328504, (17, 2) = 1.3481013630066627, (18, 1) = -.2605172649515533, (18, 2) = 1.5626840382177787, (19, 1) = -0.4508440372973734e-1, (19, 2) = 1.7222671918244137, (20, 1) = .1821964354673438, (20, 2) = 1.824295544689022, (21, 1) = .4160587298249581, (21, 2) = 1.866845549343699}, 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(21, {(1) = .0, (2) = .14513627423941433, (3) = .3300400490930955, (4) = .5165023585796639, (5) = .6984874769290668, (6) = .8754987420749759, (7) = 1.0477984333758916, (8) = 1.2161354551828685, (9) = 1.381491829739222, (10) = 1.544938482475059, (11) = 1.706990580432664, (12) = 1.86782403214045, (13) = 2.0268617606734813, (14) = 2.1829057195303156, (15) = 2.3345474597633578, (16) = 2.480765541674215, (17) = 2.621314804334309, (18) = 2.7565733129807373, (19) = 2.8873920925965884, (20) = 3.0152209358089883, (21) = 3.14159265358979}, datatype = float[8], order = C_order); Y := Matrix(21, 2, {(1, 1) = -0.25077737842358044e-7, (1, 2) = .0, (2, 1) = -0.40038445369463545e-8, (2, 2) = -0.47441888938412575e-7, (3, 1) = 0.24903733201110173e-9, (3, 2) = -0.2364646544742844e-9, (4, 1) = 0.2564373760022242e-9, (4, 2) = 0.38798227461428986e-9, (5, 1) = 0.31767481824355886e-9, (5, 2) = 0.5339123192726902e-9, (6, 1) = 0.39829193343698827e-9, (6, 2) = 0.539662826009311e-9, (7, 1) = 0.4916052606674395e-9, (7, 2) = 0.7950689370855202e-9, (8, 1) = 0.6174249803274765e-9, (8, 2) = 0.8784077304184107e-9, (9, 1) = 0.7584982296733483e-9, (9, 2) = 0.10697274951300486e-8, (10, 1) = 0.9226991856785253e-9, (10, 2) = 0.9272747882919353e-9, (11, 1) = 0.10582585071245972e-8, (11, 2) = 0.7328035392740489e-9, (12, 1) = 0.1157723351582924e-8, (12, 2) = 0.4937968779981205e-9, (13, 1) = 0.12199685991479275e-8, (13, 2) = 0.2625679217834483e-9, (14, 1) = 0.12603507952507571e-8, (14, 2) = 0.23115955398217412e-9, (15, 1) = 0.12733264772834125e-8, (15, 2) = -0.15640808896048543e-9, (16, 1) = 0.1228547519035937e-8, (16, 2) = -0.4526213494523792e-9, (17, 1) = 0.1189528338863035e-8, (17, 2) = -0.8599683933928513e-10, (18, 1) = 0.11596016323158177e-8, (18, 2) = -0.3540008313431599e-9, (19, 1) = 0.10771022348635273e-8, (19, 2) = -0.8285708059708356e-9, (20, 1) = 0.9564998889940215e-9, (20, 2) = -0.10538675420448198e-8, (21, 1) = 0.8848000583067432e-9, (21, 2) = -0.28164101482625913e-9}, 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[21] elif outpoint = "order" then return 8 elif outpoint = "error" then return HFloat(4.7441888938412575e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 21, [gamma(xi), diff(gamma(xi), xi)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[21] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[21] 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`(21, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(21, 2, X, Y, outpoint, yout, L, V) end if; [xi = outpoint, seq('[gamma(xi), diff(gamma(xi), xi)]'[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[21] elif outpoint = "order" then return 8 elif outpoint = "error" then return HFloat(4.7441888938412575e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 21, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[21] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[21] 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 ) = (true), ( 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`(21, 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 ) = (true), ( 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`(21, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(0..0, {}), (3) = [xi, gamma(xi), diff(gamma(xi), xi)], (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); [xi = res[1], seq('[gamma(xi), diff(gamma(xi), xi)]'[i] = res[i+1], i = 1 .. 2)] catch: error  end try end proc

(5)

DocumentTools:-Tabulate(
  [
    plots:-odeplot(
      EmdenN
      , [xi, theta__0(xi)]
      , xi=0..Pi
      , color=blue
      , gridlines=true
      , title = "Emden, n=2, numerical solution"
      ),
    plots:-odeplot(
      LaneEmdenN
      , [xi, gamma(xi)]
      , xi=0..Pi
      , color=blue
      , gridlines=true
      , title = "Lane-Emden, n=2, numerical solution"
    ),
    plots:-odeplot(
      LaneEmdenN
      , [xi, gamma(xi)+xi*D(gamma)(xi)]
      , xi=0..Pi
      , color=blue
      , gridlines=true
      , title = typeset('gamma(xi)+xi*D(gamma)(xi)', n=2)
    )
  ], width=80
):


# Check the value of gamma(xi)+xi*diff(gamma(xi), xi) at x=Pi

'gamma(Pi)+Pi*D(gamma)(Pi)' = eval(gamma(xi)+xi*diff(gamma(xi), xi), LaneEmdenN(Pi));

gamma(Pi)+Pi*(D(gamma))(Pi) = HFloat(4.440892098500626e-16)

(6)


Download The_case_n=2.mw

To complete this, you will find in this file General_Emden_and_Lane-Emden.mw a procedure named 
LaneEmdenSolution whose arguments are, in this order:

  1. The vamlue of n.
  2. The value of alpha.
  3. The value of the right end point X where the right boundary condition 
    gamma(X) + X * D(gamma)(X) = 0

    is imposed

This procedure draws the numerical solutions of the Emden and Lane-Emden equations and the evolution of

gamma(xi)+xi*diff(gamma(xi), xi)  , in the range 0.. right_end_point

 

@shashi598  I'm sorry but I believe I deleted your last reply.

Fortunately I had another window opened with your text in it: could you copy/paste it in a new reply?

So after going through all your files which explains every step in detail. So an overview of the approach as i understand taken in your file:

- The Emden equation was solved numerically using dsolve to get EmdenN. 

- This was then used in the Lane-Emden equation ode2 to define the source term.

- An attempt was made to solve the Lane-Emden equation numerically using dsolve, but it failed due to a singularity at the initial point.

- To get around this, the initial point was shifted to ε > 0 using a parameter.

- However, there were still issues matching the numerical solution LaneEmdenN to the exact solution LaneEmdenE at ε and π.

- To improve the match, the initial conditions were tuned by defining a cost function Control that measures the error between LaneEmdenN and LaneEmdenE at π.

- Control was minimized over the initial conditions to find optimal values that provide a close match to LaneEmdenE.

- The minimized initial conditions were then used in dsolve to get an improved numerical solution LaneEmdenN_opt.

- LaneEmdenN_opt was shown to match LaneEmdenE to high precision, solving the original problem.

So in summary, the key steps were:

1) Shift initial point to avoid singularity 

2) Tune initial conditions to match known solution behavior

3) Minimize error between numerical and exact solutions

This allows dsolve to get an accurate numerical solution without needing the exact analytic form. The same general approach could be applied to other singular ODEs.

So, I want to know in general if I dont have access to Exact solution i.e EmdenE and as a result to LaneEmdenE which are used in defining ic2E to get the high accuracy, in cases for example n=3, whats the best strategy?. Should i evaluate at ApproximateXi__1 where Xi__1 is Pi when n=1?. But have limited accuracy since ic2E is not be available. Putting it in a simple way imagine a blackbox function that takes n ,alpha, epsilon and outputs D(gamma)(xi__1) .

And at last I think these tricks needs to be applied when we have singular ODEs. So, in case where its not the case a straight forward approach will work that doesn't require epsilons.right?

I really appreciate the time and effort you have put in your answer. I learned several new things from your file. Thanks again!

As a reply to the text above: you are right on all the points and understood perfectly what did.
nevertheless I believe the second approach detailed here SecondApproach is much simpler and suficient if you don't want to compute the numerical solution of the Lane-Emden equation beyond xi=Pi.

The "epsilon-eta-tau" strateby is tailored to your problem and I cannot guarantee you it will still work for other values of the exponent n.

If you have something specific in mind, for instance n <> 1, please let me know, I would be interested in working on it.

Again I'm sorry for having deleted your reply

@dharr 

Thank you dharr for the explanation.
I didn't know about workbook (it seems Maple 2015 doesn't have this heature, the only entry is  ExcelTools[WorkbookData] and  ExcelTools[WorkbookData] which refers to former).



Look these help pages

  • Matrix
  • LinearAlgebra
    more specificaly EigenValues and Eigenvectors

@jalal 

Have you read one of my previous reply instructing you what a cirrect parh was???

I repeat myself if your target image has name Maple.jpg its full path is something like "//../../../Maple.jpg", to get it:

  • go to the directiory Images,
  • copy paste the name full path which should appear in the address bar,
  • paste it in your worksheet,
  • add  /Maple.jpg,
  • enclose all this by double quotes,
  • change all the backslashes by slashes (maybe it's no longer necessary in recent Maple versions?).

Are you blind not to see that this
is not a correct full path?

  • it contains C:                   (maybe this is accepted by Maple 2023?)
  • it contains backslashes   (maybe Maple 2023 understand backslashes?)
  • I doubt the the directory Maple 2023this even exists, 
  • if you copy/paste the link, why do you concatenate the result too currentdir() ???
    Look to the help pages what currentdir() and cat do mean.
    Clearly currentdir() is equal to  C:\Program Files\Maple 2023  in your case.

While you won't pass the correct path fo Read you will get an error, it is as simple as that.
Run this command to see if f is correct

FileTools:-Exists(f)

If the answer is false, as I suspect it is, then learn by yourself how to get a full path in Windows (I use Mac-OS and Linux so I can help you with that)

@AHSAN 

I don't understand,please upload your mw file.

A hint: your message simply means the list is too long to be displayed, example:

[1$10^6]
          [Length of output exceeds limit of 1000000]

BTW, "extended from 6 to 9" cannot be the cause of the message you get. Here I "extended from 6 to 12" :

interface(rtablesize=13):
ExtendedDOE := `<,>`(DOE$2):  # DOE repeted twice
ExtendedUpperBounds := [UpperBounds[], UpperBounds[]]:

ExtendedIntegral := Vector(12, i -> int(F(entries(ExtendedDOE[i], nolist)), x=-1..ExtendedUpperBounds[i])):
ExtendedMyTable := `<,>`(titles, `<|>`(ExtendedDOE, ExtendedIntegral))

You can verify by yourself this doesn't generate any message, warning nor error.

@AHSAN 

[0.5$6] means "the list made of 6 elements all equal to 0.5"
Look the help page about $

@DrYOUSSEF 

You're welcome.

I saw your Matlab example doffers from your Maple's on.
Feel free to tell me if you face difficulies to do with Maple what you did with Matlab.

@jalal 

Can you clearly describe, with somple words (no Maple here) what you do exactly?

Read(image) has absolutely no reason to fail if image is a string which contains a well formed full path to some image file with a supported extension (llo to the  ImageTools:-Read help page).

I am pretty sure you did something wrong:

  • image is not a string, 
  • image is not a well formed path (did you read my last reply?),
  • the file image doesn't exist,
  • the image file doesn't have a supported extension.

I suggest you to start by checking the existence of the  image file by doing this

FileTools:-Exists(image)

By the way, why don't you simply upload your mw file, this would make things easier for everybody?

@AHSAN 

Right, I updated my answer, please check it again

@jalal 

Read carefuly the ImageTools:-Read help page
First syntax:

Read( file, img, opts )

A few lines below it's written

file    -   string; the pathname of the image file to read


Ask yourself the question: is  this:///Images/Maple.jpg a string?
Obviously not, so Read will fail (for the moment your "Read" is cornered by the special symbol ":" , see the its help page).

Now, is "this:///Images/Maple.jpg" a valid path?
I assume you use Windows and that this: is a the name of some disk? Unfortunately Maple doesn't accept this ,otation: you must enter the full path of Maple.jpg, not a shortcut.
A full path is something like "//../../../Images/Maple.jpg", to get it:

  • go to the directiory Images,
  • copy paste the name full path which should appear in the address bar,
  • paste it in your worksheet,
  • add  /Maple.jpg,
  • enclose all this by double quotes,
  • change all the backslashes by slashes (maybe it's no longer necessary in recent Maple versions?).

Now you have a correct full path.

@jalal 

I thought you would have understood that my image had full path 

cat(currentdir(), "/Desktop/Maple.jpg"):

I f you have some image whose full path is My_Image_is_here, just do 

img := Read(My_Image_is_here):

I updated my previous answer and attached the mw file.

2 3 4 5 6 7 8 Last Page 4 of 119