mmcdara

6715 Reputation

18 Badges

8 years, 164 days

MaplePrimes Activity


These are answers submitted by mmcdara

The attached file adresses your two questions.
For the first one you have to use the translation and scaling properties of FT/FFT/DFT transforms.
For the second one you cannot keep a formal N and you must use the scaling property above.

For whatever reason the content of the attached file can't be displayed

FT_mmcdara.mw

A few details.mw here 

You could do this

NULL

restart

with(LinearAlgebra):

prel := {p1 = (1/2)*exp(I*a*x*(1/2)+I*b*t*(1/2))*(I*a*g[1](t, x)+2*(diff(g[1](t, x), x))), p2 = -(1/2)*exp(-I*a*x*(1/2)-I*b*t*(1/2))*(I*a*g[2](t, x)-2*(diff(g[2](t, x), x))), p3 = -(1/2)*exp(-I*a*x*(1/2)-I*b*t*(1/2))*(I*a*g[3](t, x)-2*(diff(g[3](t, x), x)))}:

A := Matrix([[rhs(prel[1]), rhs(prel[2]), rhs(prel[3])]]):

A1 := Transpose(A):

prel1 := {p4 = exp((1/2*I)*a*x+(1/2*I)*b*t)*(-I*lambda*g[1](t, x)+c[1]*g[2](t, x)+c[2]*g[3](t, x)), p5 = exp(-(1/2*I)*a*x-(1/2*I)*b*t)*(I*lambda*g[2](t, x)-c[1]*g[1](t, x)), p6 = exp(-(1/2*I)*a*x-(1/2*I)*b*t)*(I*lambda*g[3](t, x)-c[2]*g[1](t, x))}:

A2 := Matrix([[rhs(prel1[1]), rhs(prel1[2]), rhs(prel1[3])]]):

kernelopts(version);  # Newer versions ebable a better rendering while avoiding &.

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

# A1

A1_rel   := map(a -> isolate(a, select(has, indets(a, function), diff)[]), [entries(A1, nolist)]):
Unknowns := lhs~(%):

mat, vec := LinearAlgebra:-GenerateMatrix(A1_rel, Unknowns):

# This

mat &. vec = < Unknowns >:

# or this
mat . LinearAlgebra:-DiagonalMatrix(vec) = < Unknowns >;
 

(Matrix(3, 3, {(1, 1) = -((1/2)*I)*a*g[1](t, x), (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = ((1/2)*I)*a*g[2](t, x), (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = ((1/2)*I)*a*g[3](t, x)})) = (Vector(3, {(1) = diff(g[1](t, x), x), (2) = diff(g[2](t, x), x), (3) = diff(g[3](t, x), x)}))

(2)

# A3

Unknowns := convert(select(has, indets(A3), g), list);
mat, vec := LinearAlgebra:-GenerateMatrix([entries(A3, nolist)], Unknowns):

'A3' = mat &. < Unknowns >;

Unknowns := [g[1](t, x), g[2](t, x), g[3](t, x)]

 

A3 = `&.`(Matrix(%id = 18446744078317334390), Vector[column](%id = 18446744078317326334))

(3)

# Verify that lhs = rhs

eval(%, `&.` = `.`):
simplify([entries(lhs(%), nolist)] -~ [entries(rhs(%), nolist)]);

[0, 0, 0]

(4)

 

Download One_way_to_get_matrix_form.mw

restart
with(Units):
UnitFactors_1 := proc(F)
  local U, M, u, d:
  U := [op(parse(convert(op(F), string)))];
  M := 1:
  for u in U do
    if u::`^` then
      d := ldegree(u):
      if d < 0 then 
        M := M / Unit(op(1, u))^(-d):
      else 
        M := M * Unit(op(1, u))^(d):
      end if:
    else 
      M := M*Unit(u):
    end if;
  end do:
  M; 
end proc:


Newton := Unit('kg'*'m'/'s'^2):

lprint(Newton = UnitFactors_1(Newton));
     Units:-Unit(kg*m/s^2) = Units:-Unit(kg)*Units:-Unit(m)/Units:-Unit(s)^2

Download Maybe_this.mw

Based upon

GetUnit(some_compound_unit, conversion)

this file gives some hints to answer your second question but it is Far_from_perfect.mw


 

r1 := -1 <= x and x <= 0:
r2 := 0 <= x and x <= 1:
x  := solve({convert(r1, 'relation') or convert(r2, 'relation')})
                       {-1 <= x, x <= 1}

`and`(s[])
                       -1 <= x and x <= 1


 


In Excel the decimal separator is only a matter of display.
If you only want to display Maple integers with a comma (and not do calculus, see @Thomas Richard's answer) you can do this

restart

# Comma Separated Integer

CSI := proc(x)
  StringTools:-Substitute(convert(x, string), ".", ","):
  nprintf("%s", %)
end proc:
 

rand(-10.0 .. 10.0)();
CSI(%);

-3.51727964

 

`-3,51727964`

(1)

# two equivalent forms

V  := LinearAlgebra:-RandomVector(5, generator=-100.0 .. 100.0):
VC := Vector(5, i -> CSI(V[i])):

V, VC , `or`, CSI~(V)

"RTABLE(18446744074195580510,MATRIX([[93.5389863813118154], [99.2922663165458061], [98.5762610398334687], [-62.3236051993347502], [9.44411945119234986]]),Vector[column]),RTABLE(18446744074196708134,MATRIX([[`93,5389863813118154`], [`99,2922663165458061`], [`98,5762610398334687`], [`-62,3236051993347502`], [`9,44411945119234986`]]),Vector[column]),or,RTABLE(18446744074196708542,MATRIX([[`93,5389863813118154`], [`99,2922663165458061`], [`98,5762610398334687`], [`-62,3236051993347502`], [`9,44411945119234986`]]),Vector[column])"

(2)

# With a control of the number of digits

CSI := proc(x, n)
  local s, sl, sr:
  uses StringTools:
  s := convert(x, string):
  if x::integer then
    s := nprintf("%s", s)
  else
    s := Split(s, "."):
    nprintf("%s,%s", %[1], substring(%[2], 1..n)):
  end if:
end proc:

rand(-10.0 .. 10.0)();
CSI( %, 8);
CSI(%%, 3);

3.99720953

 

`3,99720953`

 

`3,997`

(3)

 


 

Download CSI.mw



Read carefully the attached file to understand where your errors are and how to correct them.
red texts explain where the previous errors come from.

 

restart

 

Successive errors and how to get rid of them

 

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i](x), x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := display(Graph, p)
    end if
  end do:
end do:

Error, final value in for loop must be numeric or character

 

# In the outer loop N is undefined

N := 10:  # it's up to you to provide the good value

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i](x), x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := display(Graph, p)
    end if
  end do:
end do:

Error, cannot determine if this expression is true or false: 0 <= finite_element_xi[0] and finite_element_xi[0] <= 1

 

# finite_element_xi is undefined

finite_element_xi := Array(0..10, [seq(rand(0. .. 10.)(), k=1..11)]):   # it's up to you to provide the good values

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i](x), x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := display(Graph, p)
    end if
  end do:
end do:

Error, (in plot) incorrect first argument finite_element_epsilon[0](x)*(R(7))(x)

 

# finite_element_epsilon is undefined

finite_element_epsilon := Array(0..10, [seq(rand(0. .. 10.)(), k=1..11)]):   # it's up to you to provide the good values

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i](x), x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := display(Graph, p)
    end if
  end do:
end do:

Error, (in plot) incorrect first argument 5.378582700*(R(7))(x)

 

# R(7)(x) is undefined

R(7)(x)

(R(7))(x)

(1)

# You gave the expression of the R sunction, so why didn't use it?

R := i -> E0*Heaviside(i+x0-x) + E1*Heaviside(i-(x+x0)):

# example

R(7);


# But this likely won't give what you expect to get

R(7)(x)

E0*Heaviside(7+x0-x)+E1*Heaviside(7-x-x0)

 

E0(x)*(Heaviside(7+x0-x))(x)+E1(x)*(Heaviside(7-x-x0))(x)

(2)


First definition of  R

R := i -> E0*Heaviside(i+x0-x) + E1*Heaviside(i-(x+x0)):

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i](x), x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := Graph, p
    end if
  end do:
end do:

plots:-display(Graph);

Error, (in plot) incorrect first argument 5.378582700*E0(x)*(Heaviside(7.+x0-1.*x))(x)+5.378582700*E1(x)*(Heaviside(7.-1.*x-1.*x0))(x)

 

Error, (in plots:-display) invalid input: `plots/display` uses a 1st argument, F, which is missing

 

# do not write finite_element_sigma[i](x)

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i], x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := Graph, p
    end if
  end do:
end do:

plots:-display(Graph);

Warning, expecting only range variable x in expression 5.378582700*E0*Heaviside(7.+x0-1.*x)+5.378582700*E1*Heaviside(7.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 3.465092938*E0*Heaviside(2.+x0-1.*x)+3.465092938*E1*Heaviside(2.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 1.209628080*E0*Heaviside(9.+x0-1.*x)+1.209628080*E1*Heaviside(9.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 9.101611067*E0*Heaviside(5.+x0-1.*x)+9.101611067*E1*Heaviside(5.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 6.269565965*E0*Heaviside(7.+x0-1.*x)+6.269565965*E1*Heaviside(7.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 5.849806928*E0*Heaviside(1.+x0-1.*x)+5.849806928*E1*Heaviside(1.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression .5108327385*E0*Heaviside(3.+x0-1.*x)+.5108327385*E1*Heaviside(3.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 7.653764366*E0*Heaviside(3.+x0-1.*x)+7.653764366*E1*Heaviside(3.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 3.363685982*E0*Heaviside(3.+x0-1.*x)+3.363685982*E1*Heaviside(3.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

Warning, expecting only range variable x in expression 2.075595849*E0*Heaviside(3.+x0-1.*x)+2.075595849*E1*Heaviside(3.-1.*x-1.*x0) to be plotted but found names [E0, E1, x0]

 

 

# E10, E1, x0 are undefined

E0 := 2:    # it's up to you to provide the good values
E1 := 1:    # it's up to you to provide the good values
x0 := 3:    # it's up to you to provide the good values

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j));
      p := plot(finite_element_sigma[i], x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := Graph, p
    end if
  end do:
end do:

plots:-display(Graph);

 


Second definition of  R

R := i -> x -> E0*Heaviside(i+x0-x) + E1*Heaviside(i-(x+x0)):

# example

R(7)(x);

2*Heaviside(10-x)+Heaviside(4-x)

(3)

Graph := NULL;
for i from 0 to N-1 do
  for j from 0 to 10 do
    if j <= finite_element_xi[i] and finite_element_xi[i] <= j+1 then
      finite_element_sigma[i] := evalf(finite_element_epsilon[i]*R(j)(x));
      p := plot(finite_element_sigma[i], x = finite_element_xi[i] .. finite_element_xi[i+1]);
      Graph := Graph, p
    end if
  end do:
end do:

plots:-display(Graph);

 

 


 

Download A_pattern.mw



Here is a Download Suggestion.mw based on the use of Explore Follow_me 

A screen capture of what you get:

 

Leading idea: find the zeroes of diff(s, phi):

restart;
W:=f*mu*M**2*(1-sqrt(1+2*phi/(mu*M**2)))+(1-f)*(1+3*beta-(1+3*beta-3*beta*phi+beta*phi**2)*exp(phi))+g*nu*M**2*(1-sqrt(1-2*phi/(nu*M**2)))+(1-g)*(1+3*beta-(1+3*beta+3*beta*phi+beta*phi**2)*exp(-phi)):

s:= subs(g=0.95,mu=1,beta=0.19,nu=0.5,M=2.277, f=0.4490, W):

plot(s,phi=-2.3..0.6);

# As it is seen for beta=0.19 and f=0.449 we have three consecutive local extrema. How can I find these critical values of (beta,f)?

 

ds    := diff(s, phi):
omega := -2.3..0.6:
plot(ds, phi=omega);

 

# Using solve: one solution is missing

fnormal~({solve(ds)});
Locations := select((x -> verify(x, omega, 'interval')), %);

Warning, solutions may have been lost

 

{-1.476544548, -.7758246505, -0., .8514078882}

 

{-1.476544548, -.7758246505, -0.}

(1)

# simplify(convert(ds, rational), size):
# solve(%):
# allvalues(%):

# Using fsolve: the method is governed by what you see on the plot above

loc_1 := fsolve(ds, phi=omega);
loc_2 := fsolve(ds, phi=loc_1..op(2, omega));
loc_3 := fsolve(ds, phi=op(1, omega)..loc_1);
loc_4 := fsolve(ds, phi=op(1, omega)..loc_3-1e-6);

Locations := fnormal~({loc_1, loc_2, loc_3, loc_4})

-.7758246505

 

-0.2963076064e-8

 

-1.476544548

 

-2.062009298

 

{-2.062009298, -1.476544548, -.7758246505, -0.}

(2)

# Using RootFinding:-NextZero: a safer and clever way than using fsolve

fds := unapply(ds, phi):

KeepSearching := true:
start         := -2.3:
RightBound    := 0.6:
Locations     := NULL:

while KeepSearching do
  loc := RootFinding:-NextZero(phi -> fds(phi), start);
  if loc < RightBound then
    Locations     := Locations, loc:
    start         := loc:
  else
    KeepSearching := false:
  end if
end do:

Locations := fnormal~([Locations])

[-2.062009299, -1.476544548, -.7758246505, -0.]

(3)

 

Download plot_mmcdara.mw

dsolve does not return a formal solution.
I don't lnow if it is possible to get one but I suggest you to dsolve numerically.

At the end of the attached fie you will find an attempt to solve formally using the option type='series'.
Nevertheless this seems a dead end unless you use a very large number of terms in the series expansion.

 

restart

with(plots):

NULL

xi := .5;

.5

 

.5

 

0.5e-1

 

diff(U(t), t) = .5*U(t)-U(t)*V(t)

 

diff(w(t), t) = U(t)*V(t)-w(t)

 

diff(V(t), t) = 0.5e-1-.5*V(t)+w(t)

 

U(0) = 1

 

w(0) = 0

 

V(0) = 0

(1)

# Solve numerically:

soln := dsolve({eq1, eq2, eq3, ic1, ic2, ic3}, 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) = 3, (2) = 3, (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) = .10095317511683091, (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..3, {(1) = 1.0, (2) = .0, (3) = .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..3, {(1) = .1, (2) = .1, (3) = .1}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 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, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = 0, (2) = 0, (3) = 0}, datatype = integer[8]), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..3, {(1) = 1.0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .5, (2) = 0.5e-1, (3) = .0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = U(t), Y[2] = V(t), Y[3] = w(t)]`; YP[1] := .5*Y[1]-Y[1]*Y[2]; YP[2] := 0.5e-1-.5*Y[2]+Y[3]; YP[3] := Y[1]*Y[2]-Y[3]; 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, X, Y, YP) option `[Y[1] = U(t), Y[2] = V(t), Y[3] = w(t)]`; YP[1] := .5*Y[1]-Y[1]*Y[2]; YP[2] := 0.5e-1-.5*Y[2]+Y[3]; YP[3] := Y[1]*Y[2]-Y[3]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..3, {(1) = 0., (2) = 1., (3) = 0.}); _vmap := array( 1 .. 3, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _xout = "map" then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_xin) = "initial" then _ini := rhs(_xin) elif lhs(_xin) = "parameters" then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) <> [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par <> [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _xin = "eventstatus" then if _nv = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nv < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nv do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nv+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_xin) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _xin = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _xout) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(0..0, {}), (3) = [t, U(t), V(t), w(t)], (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)

pn := plots:-display(
  plots:-odeplot(soln, [t, U(t)], t=0..10, color=red  , legend=typeset(U(t))),
  plots:-odeplot(soln, [t, V(t)], t=0..10, color=blue , legend=typeset(V(t))),
  plots:-odeplot(soln, [t, w(t)], t=0..10, color=green, legend=typeset(w(t)))
):

display(pn)

 

Order := 20:

sols:= dsolve({eq1, eq2, eq3, ic1, ic2, ic3}, {U(t), V(t), w(t)}, type='series'):
sols := map(convert, sols, polynom):

(3)

ps := plots:-display(
  plot(eval(U(t), sols), t=0..10, color=red  , style=point, symbol=circle),
  plot(eval(V(t), sols), t=0..10, color=blue , style=point, symbol=circle),
  plot(eval(w(t), sols), t=0..10, color=green, style=point, symbol=circle)
):

display(pn, ps, view=[default, 0..4])

 
   

Do_It_Numerically.mw

There is no need to build the Rough (Rough-Hurwitz) matrix for a polynomial of order 3.
The conditions for its 3 roots have a strictly negative real parts are very simple.

I propose you do the things this way

restart

with(LinearAlgebra):

J := Matrix(3, 3, [[0, 0, -m+Rstar/m], [xi, -1, m-Rstar/m], [0, 1, -m]])

J := Matrix(3, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = -m+Rstar/m, (2, 1) = xi, (2, 2) = -1, (2, 3) = m-Rstar/m, (3, 1) = 0, (3, 2) = 1, (3, 3) = -m})

(1)

char_poly := CharacteristicPolynomial(J, lambda)

lambda^3-(-1-m)*lambda^2+Rstar*lambda/m-xi*(-m^2+Rstar)/m

(2)

# Coefficients of lambda in char_poly sorted by decreasing powers of lambda

c := [coeffs(char_poly, lambda, 'p')];
sort([p]);
c := c[sort([p], output=permutation)]

[-xi*(-m^2+Rstar)/m, Rstar/m, 1, 1+m]

 

[1, lambda, lambda^2, lambda^3]

 

[-xi*(-m^2+Rstar)/m, Rstar/m, 1+m, 1]

(3)

# Condiitons for char_poly to be a Hurwitz polynomial

HurwitzConditions := { (c >~ 0)[], c[2]*c[3] - c[1]*c[4] > 0};

{0 < 1, 0 < Rstar/m, 0 < -xi*(-m^2+Rstar)/m, 0 < 1+m, 0 < xi*(-m^2+Rstar)/m+Rstar*(1+m)/m}

(4)

# char_poly is a Hurwitz polynomial iif

sol := {solve(HurwitzConditions)}:
print~(%):
 

{xi = -m-1, 0 < m, m^2 < Rstar}

 

{0 < m, 0 < xi, Rstar < m^2, xi*m^2/(xi+m+1) < Rstar}

 

{0 < m, Rstar < xi*m^2/(xi+m+1), xi < -m-1, m^2 < Rstar}

 

{0 < m, xi < 0, m^2 < Rstar, -m-1 < xi}

 

{-1 < m, Rstar < xi*m^2/(xi+m+1), m < 0, xi < 0, -m-1 < xi}

(5)

# Check that random choices of (m, xi, Rstar) which verifie sol[2] lead
# to characteristic polynomials whose roots have a negative real part.

ind := indets(sol):

K    := 1:
sol[K];
V    := {m = rand(0.0 .. 1.)()}:
W    := select(has, eval(sol[K], V), ind):
V    := V union select(type, W, `=`):
W    := select(has, eval(sol[K], V), ind):
V    := V union {Rstar = rand(lhs(W[1])..2*lhs(W[1]))()};

eval(char_poly, V):
evalf([solve(%)]):
Re~(%);

{xi = -m-1, 0 < m, m^2 < Rstar}

 

{Rstar = 0.8681332282e-1, m = .2322382978, xi = -1.232238298}

 

[-0.9917798169e-1, -1.033882335, -0.9917798169e-1]

(6)

# Check that random choices of (m, xi, Rstar) which verifie sol[2] lead
# to characteristic polynomials whose roots have a negative real part.

ind := indets(sol):

K    := 2:
sol[K];
V    := {m = rand(0.0 .. 1.)(), xi = rand(0.0 .. 1.)()}:
W    := select(has, eval(sol[K], %), ind):
V    := V union {Rstar = rand(lhs(W[1])..rhs(W[2]))()};

eval(char_poly, V):
evalf([solve(%)]):
Re~(%);

{0 < m, 0 < xi, Rstar < m^2, xi*m^2/(xi+m+1) < Rstar}

 

{Rstar = 0.3847120558e-2, m = 0.9447763000e-1, xi = 0.6722224402e-1}

 

[-0.1761063369e-1, -1.059256363, -0.1761063369e-1]

(7)

# Check that random choices of (m, xi, Rstar) which verifie sol[3] lead
# to characteristic polynomials whose roots have a negative real part.

ind := indets(sol):

K    := 3:
sol[K];
V    := {m = rand(0.0 .. 1.)()}:
W    := select(has, eval(sol[K], V), ind):
V    := V union {xi = rand(2*rhs(W[3])..rhs(W[3]))()}:
W    := select(has, eval(sol[K], V), ind):
V    := V union {Rstar = rand(lhs(W[1])..rhs(W[2]))()};

eval(char_poly, V):
evalf([solve(%)]):
Re~(%);

{0 < m, Rstar < xi*m^2/(xi+m+1), xi < -m-1, m^2 < Rstar}

 

{Rstar = 0.3401466279e-4, m = 0.5199090505e-2, xi = -1.910165343}

 

[-0.1987352406e-2, -1.001224386, -0.1987352406e-2]

(8)

# Check that random choices of (m, xi, Rstar) which verifie sol[4] lead
# to characteristic polynomials whose roots have a negative real part.

ind := indets(sol):

K    := 4:
sol[K];
V    := {m = rand(0.0 .. 1.)()}:
W    := select(has, eval(sol[K], V), ind):
V    := V union {xi = rand(lhs(W[1])..rhs(W[3]))()}:
W    := select(has, eval(sol[K], V), ind):
V    := V union {Rstar = rand(lhs(W[1])..2*lhs(W[1]))()};

eval(char_poly, V):
evalf([solve(%)]):
Re~(%);

{0 < m, xi < 0, m^2 < Rstar, -m-1 < xi}

 

{Rstar = .8538659689, m = .8412320805, xi = -1.427625121}

 

[-.3490193892, -1.143193302, -.3490193892]

(9)

# Check that random choices of (m, xi, Rstar) which verifie sol[5] lead
# to characteristic polynomials whose roots have a negative real part.

ind := indets(sol):

K    := 5:
sol[K];
V    := {m = rand(-1.0 .. 0.)()};
W    := select(has, eval(sol[K], V), ind);
V    := V union {xi = rand(lhs(W[1])..rhs(W[3]))()};
W    := select(has, eval(sol[K], V), ind);
V    := V union {Rstar = rand(2*rhs(W[1])..rhs(W[1]))()};

eval(char_poly, V):
evalf([solve(%)]):
Re~(%);

{-1 < m, Rstar < xi*m^2/(xi+m+1), m < 0, xi < 0, -m-1 < xi}

 

{m = -0.3278705062e-1}

 

{-.9672129494 < xi, Rstar < 0.1074990688e-2*xi/(xi+.9672129494), xi < 0}

 

{m = -0.3278705062e-1, xi = -.7612353590}

 

{Rstar < -0.3972863848e-2}

 

{Rstar = -0.5790344183e-2, m = -0.3278705062e-1, xi = -.7612353590}

 

[-0.5228045574e-2, -.9567568583, -0.5228045574e-2]

(10)

Download Hurwitz_mmcdara.mw

restart:
lst := [24300, 18907875, 151200, 147000]:

ilst := map(ifactor, lst);
     [   2    5    2     2    3    5     5    3    2         3       3   2]
     [(2)  (3)  (5) , (3)  (5)  (7) , (2)  (3)  (5)  (7), (2) (3) (5) (7) ]

xlst := eval(ilst, ``(2)=``(x))
     [   2    5    2     2    3    5     5    3    2         3       3   2]
     [(x)  (3)  (5) , (3)  (5)  (7) , (x)  (3)  (5)  (7), (x) (3) (5) (7) ]

     

One_way.mw

To understand why this works use lprint:

lprint(ilst[1])
``(2)^2*``(3)^5*``(5)^2

As (2)^p is ``(2)^p `` prevents the evaluation), just replace ``(2) by ``(x) ( ``(x) will preserve the representation (x)^p)

To retrieve the numbers:

expand(xlst)
             [      2                  5         3]
             [6075 x , 18907875, 4725 x , 18375 x ]

Three errors:

  1. You define delta(k) at the top of your worksheet but use delta[k] further on.
  2. You use sum instead of add.
  3. You did some mistake in the indices of Theta in the loop.

restart; _local(gamma, delta, Zeta)

with(PDEtools):

Theta[0] := 1:

for k from 0 to 7 do Theta[k+2] := -(beta*add((k-r+1)*Theta[k-r+1]*(r+1)*Theta[r+1], r = 0 .. k)+beta*add(Theta[k-r]*(r+1)*(r+2)*Theta[r+2], r = 0 .. k)+beta*add(add(Theta[r-m]*(k-r+1)*Theta[k-r+1]/(1+delta[m-1]), m = 0 .. r), r = 0 .. k)+add((k-r+1)*Theta[k-r+1]/(1+delta[r-1]), r = 0 .. k)-2*lambda*Theta[k])/((k+1)*(k+2)) end do

-.1500000000*A^2-.3000000000*Theta[2]-.6500000000*A+.1000000000

 

Error, too many levels of recursion

 

# For k=0 the computation of T2 is responsible of the error.
# When r=0 you invoke Theta[r+2]= Theta[2]=Theta[k+2] (being processed) for k=2.
#
# Check your indices.

for k  from 0 to 7 do
  Theta_Indices_in_T1 := seq([k-r+1, r+1], r = 0 .. k);
  T1 := beta*add((k-r+1)*Theta[k-r+1]*(r+1)*Theta[r+1], r = 0 .. k);
  Theta_Indices_in_T2 := seq([k-r, r+2], r = 0 .. k);
  T2 := beta*add(Theta[k-r]*(r+1)*(r+2)*Theta[r+2], r = 0 .. k);

  T3 := beta*add(add(Theta[r-m]*(k-r+1)*Theta[k-r+1]/(1+delta[m-1]), m = 0 .. r), r = 0 .. k);

  T4 :=add((k-r+1)*Theta[k-r+1]/(1+delta[r-1]), r = 0 .. k)-2*lambda*Theta[k];

  Theta[k+2] := -1/((k+1)*(k+2))*(T1+T2+T3+T4)
end do;

[1, 1]

 

.3*A^2

 

[0, 2]

 

Error, too many levels of recursion

 

 

Download AF_mmcdara.mw

My advice: Verify the expressions of Theta[k+2]

The radius of convergence of function tanh being Pi/2, there necessarily exists a finite range for xx and yy outside of which the Taylor expansion doesn't converge whatever the nuimber of terms you use.

This is reason why your plot (and @dharr's) exhibit sush large values.

More of this, given that the range for yy where h (@dharr's g) has significant variations (obviously has values in (0, 1); along xx the variations of h  are smaller) is 0.5512527188e-1 .. 0.5569069537e-1  (definition given in the file [BL, BR]), you can simplify f by taking only a 6 terms, not the one hundred you manipulate.

All the details are in the attached file.

So, to answeer your question

         "Why Taylor series can not estimate my function in desired interval [-1<x,y<1]?"

         " Because your are not in the range where this expansion converges"

The convergence range is

yy = 0.55291125973999346567e-1 .. 0.55524841270134109157e-1

The xx convergence range is likely larger for the reason I gave below (slow variations in the xx direction). A rough estimation is 

fsolve(g(eval(f0, yy=AT))=0.001) .. fsolve(g(eval(f0, yy=AT))=0.999);
        -3.3962547 .. 0.1126052

 

 

restart

with(Student[MultivariateCalculus]):

f := 35122173917479363738100862234581108137514304171*xx^2*(1/22300745198530623141535718272648361505980416)-2255097230860381206152749351617455809672044745*xx*yy^9*(1/11150372599265311570767859136324180752990208)+2168816628024980374461014350770096009019357665*xx*yy^8*(1/5575186299632655785383929568162090376495104)-17449701902039745490242163912540688306429882361*xx^2*yy*(1/696898287454081973172991196020261297061888)-11540959773500599403794316292492996114189538863*xx^2*yy^2*(1/5575186299632655785383929568162090376495104)+27287439738914744607616926917914225474665410565*xx^2*yy^3*(1/174224571863520493293247799005065324265472)+929769947314964740179937673332890647768037984465*xx^2*yy^4*(1/11150372599265311570767859136324180752990208)-100809382380090436397261413740272360141145204891*xx^2*yy^5*(1/348449143727040986586495598010130648530944)-930314746723434588666177195703059675161177190255*xx^2*yy^6*(1/5575186299632655785383929568162090376495104)+36390552938954376406834468187448925576623439893*xx^2*yy^7*(1/174224571863520493293247799005065324265472)+1872760743346397986120124413411813119412045269675*xx^2*yy^8*(1/22300745198530623141535718272648361505980416)-35643509355104072817665294345590475660747146425*xx^2*yy^9*(1/696898287454081973172991196020261297061888)-125283292999146417157156696376640452081866835*xx^3*(1/1393796574908163946345982392040522594123776)+5011420945327438626354964312196465908094234685*xx^3*yy*(1/11150372599265311570767859136324180752990208)+29341459645317546529685572705520876577051855*xx^3*yy^2*(1/87112285931760246646623899502532662132736)-15637727799880882327290754576104647826715168925*xx^3*yy^3*(1/11150372599265311570767859136324180752990208)-62755544772437504320590342390381422715234113715/89202980794122492566142873090593446023921664-851688199122087410134053760306093104684621525*xx^3*yy^4*(1/696898287454081973172991196020261297061888)+23458516464006675395891679247259419002768896835*xx^3*yy^5*(1/11150372599265311570767859136324180752990208)+39584968580329795728950940517214770307434335*xx^3*yy^6*(1/21778071482940061661655974875633165533184)-20361225581568567923686744589522827658576624955*xx^3*yy^7*(1/11150372599265311570767859136324180752990208)-1174244552874873223035231031480900497934023075*xx^3*yy^8*(1/1393796574908163946345982392040522594123776)+35696532930567486560276536615522532283474689213*yy*(1/2787593149816327892691964784081045188247552)+43423414494451507811145033075147441881593811799*yy^2*(1/22300745198530623141535718272648361505980416)+941109349474535911451616661821106567867537125*xx^3*yy^9*(1/1393796574908163946345982392040522594123776)-48412290717709997717153300332089796247538326265*xx^4*(1/44601490397061246283071436545296723011960832)-56566850002827011453690682806041619180254985625*yy^3*(1/696898287454081973172991196020261297061888)+17196469545705046799299985950707233685621881055*xx^4*yy*(1/1393796574908163946345982392040522594123776)-9551461763890264957289963973620923748598225435*xx^4*yy^2*(1/11150372599265311570767859136324180752990208)-26051472095770585704126329008135447818638784275*xx^4*yy^3*(1/348449143727040986586495598010130648530944)-765302392604646459013613426858243443467023490875*xx^4*yy^4*(1/22300745198530623141535718272648361505980416)+94251624724512021502035994822030873708141367565*xx^4*yy^5*(1/696898287454081973172991196020261297061888)+843981485493394825713526892530506348990296828805*xx^4*yy^6*(1/11150372599265311570767859136324180752990208)-2038600361316622246653155899145012259420048867785*yy^4*(1/44601490397061246283071436545296723011960832)-33218490572036542393092937176469859040906121155*xx^4*yy^7*(1/348449143727040986586495598010130648530944)-1758702445038817232726176779731884586549332868025*xx^4*yy^8*(1/44601490397061246283071436545296723011960832)+211134394987302797546644924545169826774270265159*yy^5*(1/1393796574908163946345982392040522594123776)+31380186488931551370058361496245928395816772575*xx^4*yy^9*(1/1393796574908163946345982392040522594123776)+184838927094446995029201369223921105703104647*xx^5*(1/2787593149816327892691964784081045188247552)+1970986683407627074325019523003479974617451789943*yy^6*(1/22300745198530623141535718272648361505980416)-6817973449093402642853212701104432585928821163*xx^5*yy*(1/22300745198530623141535718272648361505980416)-113510140727511300460098712979462156361337425*xx^5*yy^2*(1/348449143727040986586495598010130648530944)+23570688854853763073042723518782612790921757535*xx^5*yy^3*(1/22300745198530623141535718272648361505980416)+1613038118657167505912389296857854524947676825*xx^5*yy^4*(1/1393796574908163946345982392040522594123776)-44608078263668464626393951292252447406629869273*xx^5*yy^5*(1/22300745198530623141535718272648361505980416)-588774433706353379897742534304221654039246663*xx^5*yy^6*(1/348449143727040986586495598010130648530944)+47950825635610780986659544491454706340397108297*xx^5*yy^7*(1/22300745198530623141535718272648361505980416)+2207379816207475241162406248223006569040862935*xx^5*yy^8*(1/2787593149816327892691964784081045188247552)-77131555128675321096947207038878222843991869993*yy^7*(1/696898287454081973172991196020261297061888)-5023626067733175609651265492842895195168362165*xx^5*yy^9*(1/5575186299632655785383929568162090376495104)+5795161625895678368156852916105373987594511979*xx^6*(1/22300745198530623141535718272648361505980416)-3917684154726736823398471536296978037714283086195*yy^8*(1/89202980794122492566142873090593446023921664)-539977758872163289054492124375185771143918033*xx^6*yy*(1/696898287454081973172991196020261297061888)+782685832362921584689673760969891945953777553*xx^6*yy^2*(1/5575186299632655785383929568162090376495104)+749877940244270735637721966049124917356845885*xx^6*yy^3*(1/174224571863520493293247799005065324265472)+14159347676475748959036290080103848146860867025*xx^6*yy^4*(1/11150372599265311570767859136324180752990208)-2937701213452088192123555543440803264914467299*xx^6*yy^5*(1/348449143727040986586495598010130648530944)-23673134207774883972271882396704370580007933039*xx^6*yy^6*(1/5575186299632655785383929568162090376495104)+1173296429365947392287371443632107462978009165*xx^6*yy^7*(1/174224571863520493293247799005065324265472)+57447439083834576362467553225131370438848237035*xx^6*yy^8*(1/22300745198530623141535718272648361505980416)-1277356081222180962342283013232991241852904465*xx^6*yy^9*(1/696898287454081973172991196020261297061888)-29946355461657315300256240552185966952551471*xx^7*(1/1393796574908163946345982392040522594123776)+998213736763384913910074759047227544847506773*xx^7*yy*(1/11150372599265311570767859136324180752990208)+10578825782023300845453772557509072093336001*xx^7*yy^2*(1/43556142965880123323311949751266331066368)-4303517165264733669855129139552505045324631645*xx^7*yy^3*(1/11150372599265311570767859136324180752990208)+76828297887427851822683521168415270943435162685*yy^9*(1/2787593149816327892691964784081045188247552)-652299342907430898149182084981866414949696905*xx^7*yy^4*(1/696898287454081973172991196020261297061888)+11170081785792631086653879206603595320491089331*xx^7*yy^5*(1/11150372599265311570767859136324180752990208)+116540829629507365267125159526451609264014215*xx^7*yy^6*(1/87112285931760246646623899502532662132736)-14785537121406447202257499440081382142298519099*xx^7*yy^7*(1/11150372599265311570767859136324180752990208)+220816865194317615868568855814620996552449073*xx*(1/5575186299632655785383929568162090376495104)-868641325364973493898126340263842300348545855*xx^7*yy^8*(1/1393796574908163946345982392040522594123776)+216255546256559295251079313253452049445763455*xx^7*yy^9*(1/348449143727040986586495598010130648530944)-4089215965643055747590786827106386135115380275*xx^8*(1/89202980794122492566142873090593446023921664)+1869246621670048362557342074310025153518449965*xx^8*yy*(1/2787593149816327892691964784081045188247552)+18712604797880071317805036942199122521197359575*xx^8*yy^2*(1/22300745198530623141535718272648361505980416)-3479476522267890993628796487849129439635143625*xx^8*yy^3*(1/696898287454081973172991196020261297061888)-206512033439850904054937113093163624192322042825*xx^8*yy^4*(1/44601490397061246283071436545296723011960832)+15350689937843699961175740256400109996121380375*xx^8*yy^5*(1/1393796574908163946345982392040522594123776)+157001869330425518481531763580902779395436599415*xx^8*yy^6*(1/22300745198530623141535718272648361505980416)-6686861200533386632065997818427854246215113305*xx^8*yy^7*(1/696898287454081973172991196020261297061888)-9205355621994819342146712860571987786619361601*xx*yy*(1/44601490397061246283071436545296723011960832)-285743684916570536194588196441080828723328178675*xx^8*yy^8*(1/89202980794122492566142873090593446023921664)+8094790880015327525694605814920739418439287725*xx^8*yy^9*(1/2787593149816327892691964784081045188247552)+30423874459994412977383604476886160940746185*xx^9*(1/5575186299632655785383929568162090376495104)-1197236208181378637639504269592639035279087665*xx^9*yy*(1/44601490397061246283071436545296723011960832)-72716798311978341010558827315982986191821905*xx^9*yy^2*(1/696898287454081973172991196020261297061888)+5138909461003175489938484170634052266819688725*xx^9*yy^3*(1/44601490397061246283071436545296723011960832)+1206817075246069632318716986669541278160772775*xx^9*yy^4*(1/2787593149816327892691964784081045188247552)-12993287722661922638788467553649639108437064835*xx^9*yy^5*(1/44601490397061246283071436545296723011960832)-431284328058774504067793959976795724976545555*xx^9*yy^6*(1/696898287454081973172991196020261297061888)+17639360745426635511855086638766468926126459875*xx^9*yy^7*(1/44601490397061246283071436545296723011960832)-104255809907916433055923335622932126645726549*xx*yy^2*(1/696898287454081973172991196020261297061888)-2146702909675882809503682033933399905335826325*xx^9*yy^9*(1/11150372599265311570767859136324180752990208)+1587967252519403636411870604735180043125989625*xx^9*yy^8*(1/5575186299632655785383929568162090376495104)+27484692689867334306687311759874973819976026005*xx*yy^3*(1/44601490397061246283071436545296723011960832)+1583056855557692418384969876461998197073089695*xx*yy^4*(1/2787593149816327892691964784081045188247552)-36304948749180317956941914133403396762716230691*xx*yy^5*(1/44601490397061246283071436545296723011960832)-590212436135125327923049635849260481403670583*xx*yy^6*(1/696898287454081973172991196020261297061888)+27046038795224386955728969793334632924015008227*xx*yy^7*(1/44601490397061246283071436545296723011960832):

# Preliminaries

f0 := evalf(f):
g  := phi -> .5*(1+tanh(phi)):  # note that 0 <= g(..) <= 1

Tf := (n, p, q) -> mtaylor(f0, [xx=p, yy=q], n);
Tg := (m, n, p, q) -> mtaylor(g(Tf(n, p, q)), [xx=p, yy=q], m);

# examples

Tf(5, 0, 0):
Tg(4, 5, 0, 0):

 

proc (n, p, q) options operator, arrow; mtaylor(f0, [xx = p, yy = q], n) end proc

 

proc (m, n, p, q) options operator, arrow; mtaylor(g(Tf(n, p, q)), [xx = p, yy = q], m) end proc

(1)

# Observe expression g(f0)):

# Observation 1:
#
# As the expression below is numerical equal to 0, and because the min value
# of g(any_function) is 0 too, xx=yy=0 is already extremely far from the
# region where g(..) takes values significantly larger than 0 and lower then 1.


eval(f0, [xx=0, yy=0]);
g(%);
 

-703.5139881

 

0.

(2)

# Observation 2:
#
# Can we get an approximation of where the previous region takes place?
# To do this we search(arbitrarily on the direction <xx, yy=xx> and get

BL := fsolve(eval(g(f0), yy=xx)=0.001);
BR := fsolve(eval(g(f0), yy=xx)=0.999);
plot3d(
  g(f0)
  , xx=BL..BR, yy=BL..BR
  , color = blue
  , style = surface
);

0.5512527188e-1

 

0.5569069537e-1

 

 

# Consider now the taylor expansion of g(f0) around xx = yy = AT
# where AT stands for (BL+BR)/2).
#
# Comparing the values of g(g0) and TG(5, AT, AT) shows a good agreement.


AT := (BL+BR)/2;
eval(g(f0), [xx=AT, yy=AT]);


Tg(5, (BL+BR)/2, (BL+BR)/2):
eval(%, [xx=AT, yy=AT]);

0.5540798362e-1

 

.5005873193

 

.500587183

(3)

# Before computing the Taylor expansion of g(f0), let us
# begin observing how close could be g(f0) and g(Tf(n, AT, AT)).
#
# Taking arbitrarily n=2 already gives a good agreement.
# For more security I will nevertheless use the value n = 3.

plot3d(
  [g(f0),  g(Tf(3, AT, AT))]
  , xx=BL..BR, yy=BL..BR
  , color = [blue, red]
  , style = [surface$2]
);

 

# Finally ask yourself theis simple question:
#  "Can the Taylor expansion of tanh(x) around x=0 be reasonably acute
#   in the range, let's say -4..4, where on considers than tanh(x)
#   takes values in its almost complete rnge of variation 1..1?@
#
# Let us see:

plot(
  [tanh(x), seq(mtaylor(tanh(x), x, k), k=4..16, 4)]
  , x=-4..4
  , color=[blue, red, orange, cyan, green]
  , legend=[typeset(tanh(x)), seq(cat("k=", k), k=4..16, 4)]
  , view=[default, -2..2]
  , gridlines=true
)

 

# The conclusion is obvious: as no Taylor expansion of tanh(x) gives
# an acceptable representation of tanh(x) outside of a limited range
# (here around -1..1), there is absolutely no chance at all that
# a Taylor expansion og g(f0) will give you a reliable representation
# in a quite limited range around yy=AT (as you see the variation of
# g(f0) is far more rapid along yy than along xx).


# Defining the range where tanh(x) has significant variations this way

SignificantRange := fsolve(tanh(x)=-0.999)..fsolve(tanh(x)=0.999);

# one observes this range extends far from 0 for about 2.4 times the radius of
# convergence of its Taylor expansion.
# Converting this radius of convergence in terms of BR and BL then gives:

xi := (Pi/2) / op(2, SignificantRange);

# and then

ConvergenceRange := AT-(AT-BL)*xi .. AT+(BR-AT)*xi;

g35f3 := Tg(35, 3, AT, AT):

plot3d(
  [g(f0), g35f3]
  , xx=ConvergenceRange, yy=ConvergenceRange
  , color = [blue, red]
  , style = [surface$2]
);

-3.8002011672502000318 .. 3.8002011672502000318

 

.41334557242176583540

 

0.55291125973999346567e-1 .. 0.55524841270134109157e-1

 

 

# But if push further out from this range

PossibleRange := AT-(AT-BL)*(xi*1.1) .. AT+(BR-AT)*(xi*1.1);


plot3d(
  [g(f0), g35f3]
  , xx=PossibleRange, yy=PossibleRange
  , color = [blue, red]
  , style = [surface$2]
);

0.55279440209399281223e-1 .. 0.55536527035147520073e-1

 

 

``

Download taylorProblem_mmcdara.mw

Generally speaking things are done in the other way: starting from an ODE/PDE one derive a numerical scheme which is convergent and consistent with this equation (a fex other properties are required).

The only situation where we start from a discrete equaation (or a set of)  and want to buid a continuous ODE/PDE is when you want to answer this question

"I have a continuous ODE/PDE C  and its discrete version D, I know that D doesn't represents exactly C and because of some truncation error I would like to tknow what is the continuous ODE/PDE Ctrue that D represents withe a null truncation error

See here for a Maple example and the references within.
If you are in this framework please let me know.

Otherwise here is a step by step explanation  on how to find a continuous PDE that z11 would discretize:
(do not use "h" and "1" to denote the same space step, firstly it's confusing, and secondly one can get nothing wifh that: use "h" only)

restart

with(LinearAlgebra):

with(PDEtools):

with(Physics):

with(plots):

Physics:-Setup(mathematicalnotation = true);

[mathematicalnotation = true]

(1)

NULL

U := proc (i, t) options operator, arrow; Matrix([[1+I*(q(i+h, t)-q(i, t))/lambda, I*(r(i+h, t)-r(i, t))/lambda], [I*(r(i+h, t)-r(i, t))/lambda, 1-I*(q(i+h, t)-q(i, t))/lambda]]) end proc:

NULL

V := proc (i, t) options operator, arrow; Matrix([[-((1/2)*I)*lambda, -r(i, t)], [r(i, t), ((1/2)*I)*lambda]]) end proc:

 

z := diff(U(i, t), t)+Typesetting:-delayDotProduct(U(i, t), V(i, t))-Typesetting:-delayDotProduct(V(i+h, t), U(i, t)):

z11 := simplify(Physics:-`*`(Physics:-`*`(Physics:-`^`(h, -1), lambda), z[1, 1]), size) = 0;

I*(r(i+h, t)^2-r(i, t)^2+(D[2](q))(i+h, t)-(diff(q(i, t), t)))/h = 0

(2)

R0, NoR0 := selectremove(has, [op(expand(lhs(z11)))], r);
R0, NoR0 := map(add, [R0, NoR0])[]

[I*r(i+h, t)^2/h, -I*r(i, t)^2/h], [I*(D[2](q))(i+h, t)/h, -I*(diff(q(i, t), t))/h]

 

I*r(i+h, t)^2/h-I*r(i, t)^2/h, -I*(diff(q(i, t), t))/h+I*(D[2](q))(i+h, t)/h

(3)

R0 := factor(R0)

I*(r(i+h, t)-r(i, t))*(r(i+h, t)+r(i, t))/h

(4)

# Remark:
#
# The notation f(i+(1/2)*h, t) is commonly ised to represent symbolically the
# mean value of fome function f(x, t) at time t within the interval [i, i+h].
#
# More precisely, in discretization scheme f(i+(1/2)*h, t) is th approximation
# of int(r(x, t), x=i..i+h) got by the mid-point rule.
#
# This strategy, when it comes to a function representing a mass is named
# "mass lumping". This name is used whatever the function f represents
#
# Thus here

MassLumping := r(i+(1/2)*h, t) = ``(r(i+h, t)+r(i, t))/2

r(i+(1/2)*h, t) = (1/2)*``(r(i+h, t)+r(i, t))

(5)

# Generally one starts from the continuous equation and then derive a discretization
# scheme from it.
# For instance, assuming is mass-liming is used, a term such as r(x, t)*diff(r(x, t), x)
# could be discretized as:
r(x, t)*diff(r(x, t), x) = r(i+(1/2)*h, t) . ``((r(i+h, t)-r(i, t)) / h);

r(x, t)*(diff(r(x, t), x)) = r(i+(1/2)*h, t)*``((r(i+h, t)-r(i, t))/h)

(6)

# Now let's try to buid the continuous PDE from its discretzation
# ASSUMING THE MASS-LUMPING STRATEGY IS USED
#
# Step 1 , for convenience set: I/h = C

R0 := algsubs(I/h = C, R0);

(r(i+h, t)-r(i, t))*(r(i+h, t)+r(i, t))*C

(7)

# Set 2:


FromMassLumping := 2*~(rhs=lhs)(value(MassLumping));

R := subsop(2=rhs(FromMassLumping), R0)

``(r(i+h, t)+r(i, t)) = 2*r(i+(1/2)*h, t)

 

2*(r(i+h, t)-r(i, t))*r(i+(1/2)*h, t)*C

(8)

# Set 3: identify the second term in R using a 2nd order Taylor expansion

MyRule := op(2, R) = convert(convert(taylor(op(2, R), h, 2), polynom), diff)

r(i+h, t)-r(i, t) = (diff(r(i, t), i))*h

(9)

# Set 4: use MyRule to rewrite R

R := eval(eval(R, C=I/h), MyRule)

(2*I)*(diff(r(i, t), i))*r(i+(1/2)*h, t)

(10)

# Set 5: use a 1st order expansion of r(i+(1/2)*h, t) as h --> 0

UnlumpedMass := op(-1, R) = convert(taylor(op(-1, R), h, 1), polynom)

r(i+(1/2)*h, t) = r(i, t)

(11)

# Set 6: use a 1st order expansion of r(i+(1/2)*h, t) as h --> 0

R := eval(R, UnlumpedMass)

(2*I)*(diff(r(i, t), i))*r(i, t)

(12)

# Set 7: finally replace "i" by "x"

R := eval(R, i=x)

(2*I)*(diff(r(x, t), x))*r(x, t)

(13)

# Step 8: focus on NoR:
#
# Basically I apply here some of the same steps as above

NoR := algsubs(I/h = C, NoR0);
NoR := eval(NoR, i=x);
NoR := convert(convert(taylor(NoR, h, 2), polynom), diff);
NoR := eval(NoR, C=I/h)

-(diff(q(i, t), t))*C+(D[2](q))(i+h, t)*C

 

-(diff(q(x, t), t))*C+(D[2](q))(x+h, t)*C

 

(diff(q(x, t), x, t))*C*h

 

I*(diff(diff(q(x, t), t), x))

(14)

# Step 9: assembling

ContinuousPDE := R + NoR

(2*I)*(diff(r(x, t), x))*r(x, t)+I*(diff(diff(q(x, t), t), x))

(15)

 

Download ContinuousEquation.mw

I've been stuck several hours until I saw that the expression of eq I copid-pasted from your file 123.mw was WRONG.
You wrote indeed

eq := a^3*b*T^2*(diff(V(xi), `$`(xi, 2)))+a^3*b*T*(diff(V(xi), xi))+3*a^2*b*V(xi)^2-(3*a*c+2*b*omega)*V(xi)

instead of

eq := a^3*b*xi^2*(diff(V(xi), `$`(xi, 2)))+a^3*b*xi*(diff(V(xi), xi))+3*a^2*b*V(xi)^2-(3*a*c+2*b*omega)*V(xi)

!

Once the corrections are done one can get several solutions among them the two solutions given at formula (3.4) in the image you provide:

restart

 

From equation (3.4)
 

`eq (3.4)` := a^3*b*xi^2*(diff(V(xi), `$`(xi, 2)))+a^3*b*xi*(diff(V(xi), xi))+3*a^2*b*V(xi)^2-(3*a*c+2*b*omega)*V(xi)

a^3*b*xi^2*(diff(diff(V(xi), xi), xi))+a^3*b*xi*(diff(V(xi), xi))+3*a^2*b*V(xi)^2-(3*a*c+2*b*omega)*V(xi)

(1)


The "constant V" case:

# The "constant V" case:
# Let K a non null constant

Cst := factor(eval(`eq (3.4)`, V(xi)=K)):

# K being non nul by definition one keeps onlu

Cst := Cst/K:

# Then Cst is null if

isolate(Cst, omega):

# The special case displayed in the excerpt you reproduce corresponds to K=a/3
# (why this choice?).
map(factor, eval(%, K=a/3))

omega = (1/2)*a*(a^2*b-3*c)/b

(2)


The "non constant V" case:

verbose := false:

Guess := xi -> (p[0]+p[1]*xi+p[2]*xi^(2)+p[3]*xi^(3))/(q[0]+q[1]*xi+q[2]*xi^(2)+q[3]*xi^(3))

proc (xi) options operator, arrow; (p[0]+p[1]*xi+p[2]*xi^2+p[3]*xi^3)/(q[0]+q[1]*xi+q[2]*xi^2+q[3]*xi^3) end proc

(3)

# Plug this guess into `eq (3.4)`

f := eval(`eq (3.4)`, V=(xi -> Guess(xi))):

if verbose then print(f): end if:

# Assuming that the denominator doesn't vanish one can concentrate on the numerator of f.
# This numerator is to be seen seen like a polynom with indeterminate xi (9th degree)?
# For it to be identically null whatever xi, it is necessary that all the coefficients
# of this polynom are equal to 0

collect(numer(f), xi):
coefficients := [coeffs(%, xi)]:
if verbose then print(%): end if:

SOL := solve(coefficients):
if verbose then print~({SOL}): end if:

SOL := allvalues([SOL]):

AllPossibleSolutions := NULL:

for s in map(op, {SOL}) do
  try
   eval(Guess(xi), s):
   AllPossibleSolutions := AllPossibleSolutions, simplify(%);
  catch:
  end try
end do:

AllNonConstantSolutions := {AllPossibleSolutions}:                    # eliminate potential multiple occurrences
AllNonConstantSolutions := select(has, AllNonConstantSolutions, xi):  # select non constant guesses
AllNonConstantSolutions := remove(has, AllNonConstantSolutions, I):   # remove possibly complex solutions

print~(AllNonConstantSolutions):

(xi^3*p[3]+xi^2*p[2]+xi*p[1]+p[0])/(xi^3*q[3]+xi^2*q[2]+xi*q[1]+q[0])

 

(1/3)*(-xi^2*p[3]+4*(p[1]*p[3])^(1/2)*xi-p[1])*a/(xi^2*p[3]+2*(p[1]*p[3])^(1/2)*xi+p[1])

 

(1/3)*(xi^2*p[3]+4*(p[1]*p[3])^(1/2)*xi+p[1])*a/(-xi^2*p[3]+2*(p[1]*p[3])^(1/2)*xi-p[1])

 

(1/3)*(6*2^(2/3)*(p[0]^2*p[3])^(2/3)*xi^2+2*p[3]*xi^3*p[0]+9*2^(1/3)*(p[0]^2*p[3])^(1/3)*xi*p[0]+2*p[0]^2)*a/(p[0]*(-2*p[3]*xi^3+3*2^(1/3)*(p[0]^2*p[3])^(1/3)*xi-2*p[0]))

 

-4*p[2]*a*p[1]*xi/(4*xi^2*p[2]^2-4*xi*p[1]*p[2]+p[1]^2)

 

4*p[2]*xi*a^2*q[1]/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2)

(4)

# Check the last solution
#
# Note the result is obviously not 0
eval(`eq (3.4)`, diff=Diff);
eval(%, V(xi) = AllNonConstantSolutions[-1]);
simplify(value(%));

a^3*b*xi^2*(Diff(Diff(V(xi), xi), xi))+a^3*b*xi*(Diff(V(xi), xi))+3*a^2*b*V(xi)^2-(2*b*omega+3*c*a)*V(xi)

 

a^3*b*xi^2*(Diff(Diff(4*p[2]*xi*a^2*q[1]/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2), xi), xi))+a^3*b*xi*(Diff(4*p[2]*xi*a^2*q[1]/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2), xi))+48*a^6*b*p[2]^2*xi^2*q[1]^2/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2)^2-4*(2*b*omega+3*c*a)*p[2]*xi*a^2*q[1]/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2)

 

4*a^2*xi*p[2]*q[1]*(b*a^3-2*b*omega-3*c*a)/(4*a^2*q[1]^2+4*a*xi*p[2]*q[1]+xi^2*p[2]^2)

(5)

# A few words
#
# The first solution is generic and not interesting:
#
# The last solution corresponds to the solution given in equation (3.5)
# once done the transformation {a*q[1] -> q[1], p[2] -> q[2]} (remember a <> 0).
# The previous one is also the solution given in equation (3.5)
# under the transformation p[1] --> q[1] and p[2] -->  -q[2]).
#
# I didn't dig into these solutions to understand the meaning of
# AllPossibleSolutions[2..4].
 

# Give a look now to constant solutions

AllConstantSolutions := {AllPossibleSolutions}:                 # eliminate potential multiple occurrences
AllConstantSolutions := remove(has, AllConstantSolutions, xi):  # select non constant guesses
AllConstantSolutions := remove(has, AllConstantSolutions, I):   # remove possibly complex solutions

print~(AllConstantSolutions):

0

 

-(4/3)*a

 

-(1/3)*a

 

(1/3)*(2*b*omega+3*c*a)/(b*a^2)

(6)

# A few words
#
# The first solution is obvious
#
# The last solution corresponds to the constant olution given in equation (3.5)
 

 

Download 123_mmcdara_2.mw

It remains a point which puzzles me look to the text in red in the attached file)

It would be interesting to have more information on the paper you cite.
It looks like the non constant solution is the eigen function of the operator which describes lhs(`eq (3.4)`) and the constant solution is the associated eigen value.

First 7 8 9 10 11 12 13 Last Page 9 of 58