mmcdara

7891 Reputation

22 Badges

9 years, 54 days

MaplePrimes Activity


These are answers submitted by mmcdara

I do not understand why you talk about the Physics package.

Is it this package that you really want to use (seems to me a little be complicated for the question you ask).
If you want something else why not

restart
interface(version)
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 

   21 2015 Build ID 1097895
with(VectorCalculus):
v := <c, d>;  # the display is smarter in a worksheet
           v := c*e[x]+d*e[y]
position := <p, q > + int(v, s)
           position := (c*s+p)*e[x]+(d*s+q)*e[y]

Without any package;

restart
v := <c, d>;
p := t -> <x(t), y(t)>:
         
position := eval(p(t), dsolve({ diff~(p(t), t)=v, p(0)=<alpha, beta> }))
          

Concerning "_i"

You can change _i by _WhatYouWant and get exactly the same kind of results (keep in mind what I told you yb a prevo-ious question about names beginning with an underscore https://www.mapleprimes.com/questions/235461-What-Is-The-Type--obtained-For)
_i has absolutely nothing particular in general:

about(Pi)
Pi:
  is assumed to be: Pi
  a known property having {irrational} as immediate parents
  and {BottomProp} as immediate children.
  mutually exclusive with {0, 1, integer, prime, composite, fraction, rational}

about(_i)
_i:
  nothing known about this object

When you use the Physics package things may change.
See  < Overview of the Physics[Vectors] Subpackage > :

Regarding projected vectors, the Vectors subpackage is designed to work only with cartesian, cylindrical and spherical orthonormal basis and the related systems of coordinates (see Identify), according to
           (_i, _j, _k)

          ...
and further
NOTE: these variables x, y, z, rho, phi, r and theta, as well as _i, _j, _k, _rho, _phi, _r and _theta, respectively used to represent the coordinates and the unit vectors, are automatically protected when the Physics[Vectors] subpackage is loaded.


Concerning "D"

# here f is explicitely defined as a function a a single argument u
f := u -> u*v:
D(f)
                          u -> v

# nothing but the product rule you learnt at school
# https://en.wikipedia.org/wiki/Product_rule
g := u*v:
D(g)
                        D(u) v + u D(v)

Finally, the correct syntax is not D(f(u)) but

D(f)(u)
                               v
D(f)(t)
                               v

Look to D help page to see how to use D correctly
When tou write D(f(u)) the first step is the evaluation of f(u), so it is  D(u*v) that you compute, and thus the result you got.

Question 1
Given two vectors A and B of same type (both row vectors or both column vectors) and same "length", and given two numbers p and q then

C := p*A + q*B

buids a vector C of the same type and length whose element C[i] = p*A[i]+q*B[i]

A := <1 | 2>:
B := <2 | 1>:
C := 2*A + 3*B;
           C :=  [ 8 7 ]

For other componentwise operations on vectors or matrices use ~:

E := A *~ B
            E := Vector[row](2, {(1) = 2, (2) = 2})
F := cos~(A) *~ exp~(B)
            F := Vector[row](2, {(1) = cos(1)*exp(2), (2) = cos(2)*exp(1)})

Question 2
About _names the things are very clear: never ever use such names.
If you are fan with underscores as prefix, just double them:

__a := 3:
__b := 4:
__c := __a + __b;
                               7

This will spare you a lot of problems.
Even if a single underscore can lead to no error at all, your are never sure of that:

# all is fine here
_toto := 3:
_toto^2
                               9

Question 3
Look to the type help page and click on +:

  • type/`+` - check for an expression of type `+`
  • type/`*` - check for an expression of type `*`
  • type/`^` - check for an expression of type `^`

The fact c:=a+b is of  `+` type comes from the way an algebraic operation (here a sum) is represented by a syntactic graph:

c := a+b:
whattype(c)
                               +
ToInert(c)
         _Inert_SUM(_Inert_NAME("a"), _Inert_NAME("b"))

... unless you have a problem with your version.
(BTW your worksheet doesn't contain any plot command: wher do your plots come from ???)

In the RootVector help page search for the string plot and do what it's said:

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

with(VectorCalculus):

w := RootedVector(root=[-2, 1], <1, 2>):
About(w);

Matrix([[`Type: `, `Rooted Vector`], [`Components: `, [1, 2]], [`Coordinates: `, cartesian], [`Root Point: `, [-2, 1]]])

(2)

PlotVector(w, scaling = constrained)

 

 

Download PlotRootedVector_mmcdara.mw

I guess the ambuity comes from the use of the names "create" and "indexed".

Let's take the case of a procedure through two examples. 
In the first one procedure f assigns to a variable a the value 1, but Maple returns a warning telling you it considers a as a local variable. In the second example a is explicitely declared local

f := proc()
a := 1:
end proc
Warning, `a` is implicitly declared local to procedure `f`


interface(warnlevel=0): 
a:=2: 
f := proc() 
a := 1: 
end proc: 
f(); 
a;
                               1
                               2
f := proc()
  local a:
  a := 1:
end proc

a := 'a'; # 
f(); 
# a is still unknown out of procedure f
a; 
# a way to assign 
assign(a=f()): 
a;
                               a
                               1
                               a
# and another one
print():
a:='a'; 
a:=f(): 
a;              
                               a
                               1
                               a

From help page < local > ... If present, specifies the local variables reserved for use by the procedure...
From help page < assign >... assign(a, B) and assign(a = B) commands make the assignment a := B and return NULL.

assign associates a name (a) with the value of an expression (B).

About the lines a:='a' the mechanism of this clearing operation is illustrated here

restart:
anames(user);
a := 1;
anames(user);
                               1
                               a
a := 'a':
anames(user);  # nothing returned, a no longer exists

The use of local (or global too)  enable declaring names, not really (IMO) creating variables ; a name can be associated with an expression and it's common to say this name is a variable
(
I don't know is this reference can be found freely on the web "Introduction to Maple, André Heck, Springer-Verlag, 1993" ?
If it is so, from page 63: "With the procedure assign you can get the status of individual variables".
Then assign, or :=, both give to a name the status of variable ; I guess one can say that assign creates variables.
)

According to the book "Maple V, language Reference Manual, Char et al., 1991", the term variable is used quite lately in it, mainly in refereces to the previous clearing process and he use of the global statement.

global acts basically as local does, excepted that the use of global a; makes a to be known at all levels in your worksheet:

restart:

f := proc()
global a:
a:=1:
end proc:

anames(user);
f():
a;
                               f
                               1

From verion 2019 (I think) it is no monger possible to use the statement global at the upper level of the worksheet, that is to write something like this

restart:
global a:
                               f
                               1

So let me rewrite your question as  "Is it at all possible to assign indexed names"
The answer is yes. From < indexed > help page:

  • An indexed expression of the form name[expression sequence] represents a selection operation.
  • An indexed name is a valid name.  In particular, since A[1,2,3] is a valid name, so are A[1,2,3][x,y] and A[1,2,3][x,y][2,1].
  • The use of the indexed name b[1] does not imply that b is an array.  For instance, if b is an unassigned name, a := b[1] + b[2] + b[1000] simply forms a sum of three indexed names.
  • If an assignment is made to name, then name[expression sequence] represents a selection from name using the index sequence expression sequence.  For more information, see selection.

Here are a few valid names:

  • R1, R2, R3, ...
  • R[1], R[2], R[3], ...

Only the last ones are indexed names:

restart:
R[1] := 1:
R1   := 2:
R[1], R1;  # R[1] is not R1 !!!
print("--------------------------"):

restart:
type(R[1], indexed);
type(R1, indexed);
                              1, 2
                  "--------------------------"
                              true
                             false

An important thing (see bove) is that "The use of the indexed name b[1] does not imply that b is an array" (nor a vector).
The index is not necessarilly an integer:

restart:
type(R[p], indexed);
# but...
type(R[p], indexed[integer]);
                              true
                             false

Be carefull, some names which appear as indexed names are nor indexed names:

restart:
L := [R[1], R1, R__1];
lprint(L);          # look to < lprint > help page
type~(L, indexed);  # look to < ~ > (operators, elementwise (~) ) help page
                        [R[1], R1, R__1]
[R[1], R1, R__1]
                      [true, false, false]

How to assign indexed and non indexed names?
What won't work:

seq(R[n], n=1..3);
f := proc()
  local seq(R[n], n=1..3)
end proc:
                        R[1], R[2], R[3]
Error, `(` unexpected

f := proc()
  local R[1], R[2], R[3]:
end proc;

Error, `[` unexpected

seq(R||n, n=1..3);
f := proc()
  local seq(R||n, n=1..3)
end proc:
                           R1, R2, R3
Error, `(` unexpected

seq(R__||n, n=1..3);
f := proc()
  local seq(R__||n, n=1..3)
end proc:
                        R__1, R__2, R__3
Error, `(` unexpected

And what works

f := proc()
  local R1, R2, R3:
end proc;

f := proc()
  local R__1, R__2, R__3:
end proc;

but neither R1 nor R__1 are indexed names.

If you know the number n of indexed names you want to create 

restart
f := proc(n)
  local R := Vector(n, symbol=R):
  local i:
  for i from 1 to n do R[i]:=i end do:   return R; end proc:

res := f(3); 
            Vector(3, {(1) = R[1], (2) = R[2], (3) = R[3]})

assign(seq(R[i]=res[i], i=1..3)):  # multiple assignment

# check for the values of R[1], R[2] and R[3]
'R[1]' = R[1];
'R[2]' = R[2];
'R[3]' = R[3];
                            R[1] = 1
                            R[2] = 2
                            R[3] = 3

Finally, and it is how I understant you question, you can associate indexed names with expressions at the upper level while doing this

restart:
assign(seq(R[i]=t^(i-1)*cos((i-1)*Pi/2), i=1..3)):

'R[1]' = R[1];
'R[2]' = R[2];
'R[3]' = R[3];
                            R[1] = 1
                            R[2] = 0
                                    2
                           R[3] = -t 

and, more specifically:

restart:

MyFiles := FileTools:-ListDirectory(cat(currentdir()))[1..3];
        MyFiles := ["EgyptianFraction.mw", "matrix_inverse_mmcdara.mw", "Formal_ODE_Solution.mw"]

assign(seq(R[i]=MyFiles[i], i=1..3)):

'R[1]' = R[1];
'R[2]' = R[2];
'R[3]' = R[3];

                  R[1] = "EgyptianFraction.mw"
               R[2] = "matrix_inverse_mmcdara.mw"
                R[3] = "Formal_ODE_Solution.mw"

Since I am not familiar enough with the Physics package, here is an workaround, for what it is worth.

e := expand(lhs(Newton_generalized_MatForm)):
select(has, [op(convert(e, D))], :-D(`&varkappa;_`)(t)):
convert(coeff(eval(add(%), :-D(`&varkappa;_`)(t)=J), J), diff)



Nevertheless I can't advise you enough to await a better solution ( @ecterrab ? )

If you want to store several Maple-generated matrices converted into Python code, I propose you this:

restart:
# just a notional example 
with(LinearAlgebra):
t := table([seq(i=RandomMatrix(4, 4), i=1..100)]):

# redirect the default output (terminal) to a file named "python.txt"
f := cat(currentdir(),"/Desktop/python.txt"): 
writeto(f):
for i in sort([indices(t, nolist)]) do
  CodeGeneration:-Python(t[i])
end do:

# reset the default output for subsequent work, if any
writeto(terminal);

python.txt

If you want to read from Maple the Python matrices the file above contains, do this

restart
f    := cat(currentdir(),"/Desktop/python.txt"):
T    := table([]):
line := readline(f):
i    := 1:
while line <> 0 do
   if line <> "> writeto(terminal);" then
     T[i] := convert(parse(StringTools:-Split(StringTools:-Split(line, "(")[-1], ")")[1]), Matrix):
   end if:
   line := readline(f):
   i    := i+1:
end do:
eval(T)

PythonMatrices_mmcdara.mw

It is always possible to rename the vertices as you want:

restart

with(GroupTheory):

d := DrawSubgroupLattice(GaloisGroup(x^3 - 2, x), 'indices', highlight={}):

# Identify the way the vertex names are displayed

VertexFonts := select(has, select(has, [op(d)], TEXT), BOLD)

[TEXT([HFloat(0.0), 0], 1, FONT(HELVETICA, BOLD, 12)), TEXT([HFloat(-0.8944271909999159), 1], 2, FONT(HELVETICA, BOLD, 12)), TEXT([HFloat(-0.4472135954999579), 1], 3, FONT(HELVETICA, BOLD, 12)), TEXT([HFloat(0.0), 1], 4, FONT(HELVETICA, BOLD, 12)), TEXT([HFloat(0.8944271909999159), 1], 5, FONT(HELVETICA, BOLD, 12)), TEXT([HFloat(0.0), 2], 6, FONT(HELVETICA, BOLD, 12))]

(1)

# Change the vertex names
# see here for ASCII character codes http://www.addressmunger.com/special_ascii_characters/


`#mo("&#x211a;")`:
t1 := TEXT(subsop(2=%, [op(VertexFonts[1])])[]);
`#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("1")),mo("&#x29;"))`:

t2 := TEXT(subsop(2=%, [op(VertexFonts[2])])[]);

`#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("2")),mo("&#x29;"))`:
t3 := TEXT(subsop(2=%, [op(VertexFonts[3])])[]);

`#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("3")),mo("&#x29;"))`:
t4 := TEXT(subsop(2=%, [op(VertexFonts[4])])[]);

`#mrow(mo("&#x211a;"),mo("&#x28;"),mo("&#x221a;"),mo("3"),mi("i"),mo("&#x29;"))`:
t5 := TEXT(subsop(2=%, [op(VertexFonts[5])])[]);

`#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("1")),mo("&#x2c;"),msub(mo("r"),mo("2")),mo("&#x2c;"),msub(mo("r"),mo("3")),mo("&#x29;"))`:
t6 := TEXT(subsop(2=%, [op(VertexFonts[6])])[]);
 

TEXT([HFloat(0.0), 0], `#mo("&#x211a;")`, FONT(HELVETICA, BOLD, 12))

 

TEXT([HFloat(-0.8944271909999159), 1], `#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("1")),mo("&#x29;"))`, FONT(HELVETICA, BOLD, 12))

 

TEXT([HFloat(-0.4472135954999579), 1], `#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("2")),mo("&#x29;"))`, FONT(HELVETICA, BOLD, 12))

 

TEXT([HFloat(0.0), 1], `#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("3")),mo("&#x29;"))`, FONT(HELVETICA, BOLD, 12))

 

TEXT([HFloat(0.8944271909999159), 1], `#mrow(mo("&#x211a;"),mo("&#x28;"),mo("&#x221a;"),mo("3"),mi("i"),mo("&#x29;"))`, FONT(HELVETICA, BOLD, 12))

 

TEXT([HFloat(0.0), 2], `#mrow(mo("&#x211a;"),mo("&#x28;"),msub(mo("r"),mo("1")),mo("&#x2c;"),msub(mo("r"),mo("2")),mo("&#x2c;"),msub(mo("r"),mo("3")),mo("&#x29;"))`, FONT(HELVETICA, BOLD, 12))

(2)

# Apply the rewritting rule "R" in which the colors of the box which surround
# vertex names are forced to white.

R  := convert(VertexFonts=~[t1, t2, t3, t4, t5, t6], set)
      union
      {op(op(d)[1])[-2] = COLOR(RGB, 1$(3*numelems([op(op(d)[1])])))}:

PLOT(op(eval([op(d)], R)))

 

 

Download ExtensionField_mmcdara.mw

Generating automatically the vertex names is more complex while not impossible.
Note that non-breaking spaces can also be added in the vertex names for a better rendering and that their colors can be adjusted the same way.

Executing showstat(GroupTheory:-DrawSubgroupLattice) reveals DrawSubgroupLattice offers more capabilities then the corresponding help page (Maple 2015.2) describes (look to SubgroupLattice for more help).

  {
    assignlattice::name := undefined, 
    center := undefined, 
    derived := false, 
    directed::truefalse := false, 
    [edgecolor, edgecolour] := "grey", 
    highlight::{object, set, list({object, set, {object, set, list({object, set})} = anything}), {object, set, list({object, set})} = anything} := [], 
    indices::truefalse := false, 
    labels::identical(:-integers,:-none,:-zuppos,:-ids) := :-integers, 
    normal := true, 
    output::{list(identical(:-graph,:-plot)), 
    identical(:-graph,:-plot)} := :-plot, 
    title := undefined, 
    titlefont := undefined, 
    [vertexcolor, vertexcolour] := "white"
  }


In particular, if you want more flexibility in customizing the graph:

with(GraphTheory):
Gr := DrawSubgroupLattice(g,  'output'=':-graph');
# Then you can use all the features GraphTheory proposes,
# for instance:
Edges(Gr);
GraphTheory:-Vertices(Gr);

Other way:

L  := SubgroupLattice(g);
Gr := convert(L, 'graph')

 

Even if I guess you have already thought about it

map(D[1], z(u,v)):
type(%, Vector);
      true

diff_mmcdara.mw


For fun (maybe...)

Your polyhedron is a half truncated octahedron 
https://en.wikipedia.org/wiki/Truncated_octahedron
https://mathcurve.com/polyedres/octaedre_tronque/octaedre_tronque.shtml 
 (in french)

The title refers to the equation its boundary verifies (last reference above)

HalfTruncatedOctahedron.mw

This worksheet also contains a few lines to display all the poyhedra that plots:-polyhedraplot knows.
Could be useful


UPDATED

If it is so, here is way to get it and form a finite difference approximation of the equation 
diff(f(x), x$2)=S(x) when Dirichlet BC hold.

The first part of the worksheet is aimed to derive centered divided difference approximations of Diff(f(x), x) and Diff(f(x), x$2)  (kind of abstract version of fdiff).
The second part of the worksheet is an illutrated aookication of the last result to a numerical approximation of the1D Poisson equation f"(x)-S=0 over (1, 10) with Dirichlet BCs at x=1 and x=10.

The first instance of matrix M is the second-difference matrix of size N by N you are looking for. 
 

restart:

R := [f(x+h) = subs(z-x=h, mtaylor(f(z), z=x, 3)),  f(x-h) = subs(z-x=-h, mtaylor(f(z), z=x, 3))]

[f(x+h) = f(x)+(D(f))(x)*h+(1/2)*((D@@2)(f))(x)*h^2, f(x-h) = f(x)-(D(f))(x)*h+(1/2)*((D@@2)(f))(x)*h^2]

(1)

A := add([a, b] *~ R):

U := convert( remove(has, indets(R, function), h), list):

A := collect(A, U):
map(u -> coeff(rhs(A), u), U):
#print~(% =~ [0, 1, 0]):
solve(% =~ [0, 1, 0], [a, b])[]:

`Centered 1st Order app` := unapply(eval(lhs(A), %), x)

proc (x) options operator, arrow; (1/2)*f(x+h)/h-(1/2)*f(x-h)/h end proc

(2)

A := add([a, b, c] *~ [R[], f(x)=f(x)]):

A := collect(A, U):
map(u -> coeff(rhs(A), u), U):
#print~(% =~ [0, 1, 0]):
solve(% =~ [0, 0, 1], [a, b, c])[]:

`Centered 2nd Order app` := unapply(eval(lhs(A), %), x)

proc (x) options operator, arrow; f(x+h)/h^2+f(x-h)/h^2-2*f(x)/h^2 end proc

(3)

N := 10:
X := Vector(N, i -> (i-1)*h):

Eq := convert( `Centered 2nd Order app`~(X) - Vector(10, i -> s[i-1]), list):
Eq := eval(
        Eq,
        [
          f(-h)=-f(h),
          f(N*h)=-f((N-2)*h)
        ]
      ):

M, B := LinearAlgebra:-GenerateMatrix(Eq, convert(f~(X), list));

M, B := M, eval(B, [s[0]=DirCond[0]*M[1, 1], s[N-1]=DirCond[(N-1)*h] *M[N, N]])

 

 

M, B := Matrix(10, 10, {(1, 1) = -2/h^2, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (1, 10) = 0, (2, 1) = 1/h^2, (2, 2) = -2/h^2, (2, 3) = 1/h^2, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 0, (3, 1) = 0, (3, 2) = 1/h^2, (3, 3) = -2/h^2, (3, 4) = 1/h^2, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (3, 10) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 1/h^2, (4, 4) = -2/h^2, (4, 5) = 1/h^2, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (4, 10) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 1/h^2, (5, 5) = -2/h^2, (5, 6) = 1/h^2, (5, 7) = 0, (5, 8) = 0, (5, 9) = 0, (5, 10) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 1/h^2, (6, 6) = -2/h^2, (6, 7) = 1/h^2, (6, 8) = 0, (6, 9) = 0, (6, 10) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 1/h^2, (7, 7) = -2/h^2, (7, 8) = 1/h^2, (7, 9) = 0, (7, 10) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = 1/h^2, (8, 8) = -2/h^2, (8, 9) = 1/h^2, (8, 10) = 0, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = 0, (9, 6) = 0, (9, 7) = 0, (9, 8) = 1/h^2, (9, 9) = -2/h^2, (9, 10) = 1/h^2, (10, 1) = 0, (10, 2) = 0, (10, 3) = 0, (10, 4) = 0, (10, 5) = 0, (10, 6) = 0, (10, 7) = 0, (10, 8) = 0, (10, 9) = 0, (10, 10) = -2/h^2}), Vector(10, {(1) = -2*DirCond[0]/h^2, (2) = s[1], (3) = s[2], (4) = s[3], (5) = s[4], (6) = s[5], (7) = s[6], (8) = s[7], (9) = s[8], (10) = -2*DirCond[9*h]/h^2})

(4)

sol := LinearAlgebra:-LinearSolve(M, B)

 

(5)

eval(sol, [seq(s[i-1]=-1, i=1..N), DirCond[0]=1, DirCond[(N-1)*h]=0, h=1]):
p1 := dataplot(%, color=red, legend="Num. approx."):

p2 := plot(rhs(dsolve({diff(f(x), x$2)=-1, f(1)=1, f(10)=0})), x=1..10, color=blue, legend="Exact sol."):
plots:-display(p1,p2);
 

 

 


 

Download DD_2.mw



before asking again the same question.
As I said in while answering your previous question, you probably wrote something wrong in the expression you solve for Theta[nu+2] as it refers to values of Theta[n < 0] that are not already defined or to values Theta[1-m] with undefined m.
So this is not even a correct recurrence relation you have to solve.

My feeling is that you use a time-marching scheme (time beung "nu") to solve a partial differential equation whose unknown is Theta(x, nu), starting from the IC Theta(x, 0)=delta(x) and with Neuman or Fourier BCs of convective or radiative type.
If I am right saying this, there are probably better things to do this.


HERE IS YOUR FILE CORRECTED, READ IT... PLEASE
Download ReadMeCarefully.mw

As 2D mode is known as to ease typo errors, here if the 1D mode version

 

restart;
_local(gamma, delta, Zeta)

Theta[0] := 1; Theta[1] := Gamma; delta := Array(-1 .. 30, 0); delta[0] := 1; beta := 2; N[cc] := 1; N[rc] := .5; Q[int] := .2; gamma := .3; M := .5; Theta__a := .2

Theta[0] := 1

 

Theta[1] := GAMMA

 

Array(%id = 18446744078298501118)

 

1

 

2

 

1

 

.5

 

.2

 

.3

 

.5

 

.2

(1)

for v from 0 to 3 do
expr :=
-Q[int]*gamma*Theta__a*delta[v]
-Q[int]*gamma*delta[v-1]*Theta__a
+M*Theta__a*delta[v]/(1-Theta__a)
+M*Theta__a*delta[v-1]/(1-Theta__a)
-M*add(delta[w-1]*Theta[v-w], w = 0 .. v)/(1-Theta__a)
-M*Theta[v]/(1-Theta__a)
+Q[int]*gamma*add(delta[w-1]*Theta[v-w], w = 0 .. v)
+Q[int]*delta[v-1]+add(delta[w-1]*(v-w+1)*(v-w+2)*Theta[v-w+2], w = 0 .. v)
-N[rc]*add(add(add(add(delta[l-1]*Theta[w-l]*Theta[Zeta-w]*Theta[w-Zeta]*Theta[v-w], l = 0 .. w), w = 0 .. Zeta), Zeta = 0 .. w), w = 0 .. v)
+Q[int]*delta[v]
-N[rc]*add(add(add(Theta[w]*Theta[Zeta-w]*Theta[w-Zeta]*Theta[v-w], w = 0 .. Zeta), Zeta = 0 .. w), w = 0 .. v)
-N[cc]*add(delta[w-1]*Theta[v-w], w = 0 .. v)+beta*add((v-w+1)*Theta[v-w+1]*(w+1)*Theta[w+1], w = 0 .. v)
+beta*add(add(delta[Zeta-1]*(w-Zeta+1)*Theta[w-Zeta+1]*(v-w+1)*Theta[v-w+1], Zeta = 0 .. w), w = 0 .. v)
-N[cc]*Theta[v]+beta*add(add(delta[Zeta-1]*Theta[w-m]*(v-w+1)*(v-w+2)*Theta[v-w+2], Zeta = 0 .. w), w = 0 .. v)
+beta*add(Theta[v-w]*(w+1)*Theta[w+1], w = 0 .. v)
+(v+1)*Theta[v+1]+beta*add(Theta[v-w]*(w+1)(w+2)*Theta[w+2], w = 0 .. v)
+Q[int]*gamma*delta[v]
+N[rc]*(Theta__a)^4*delta[v-1]
+N[cc]*Theta__a*delta[v]
+N[rc]*(Theta__a)^4*delta[v]
+N[cc]*Theta__a*delta[v-1]
+(v+1)*(v+2)*Theta[v+2]
;

Theta[v+2] := solve(expr, Theta[v+2]);
print(%); print(); print()
end do:

.3878000000-.5000000000*Gamma^2-.7500000000*Gamma

 

 

 

-.1551200000+0.5000000000e-1*Gamma^2*Theta[-1]+.5247000000*Gamma+.5000000000*Gamma^3+.7500000000*Gamma^2-.1551200000*Theta[1-m]+.2000000000*Theta[1-m]*Gamma^2+.3000000000*Theta[1-m]*Gamma

 

 

 

-.2585850000*Gamma-.6502611111*Gamma^2+0.4177467778e-2*Theta[-2]+.2326800000*Theta[1-m]-0.8617777778e-1*Theta[2-m]-0.5555555556e-1*Gamma^2*Theta[-1]-0.4444444444e-1*Gamma^3*Theta[-1]-.9333333333*Theta[1-m]*Gamma^2-.4619155556*Theta[1-m]*Gamma+0.4852777778e-2*Theta[-2]*Gamma^2-0.1615833333e-1*Theta[-2]*Gamma+0.6944444444e-2*Theta[-2]*Gamma^4+0.2083333333e-1*Theta[-2]*Gamma^3-.5111111111*Theta[1-m]*Gamma^3+.1034133333*Theta[1-m]^2-.1333333333*Theta[1-m]^2*Gamma^2-.2000000000*Theta[1-m]^2*Gamma+.1111111111*Theta[2-m]*Gamma^2+.1666666667*Theta[2-m]*Gamma-1.111111111*Gamma^3+0.2154444444e-1*Gamma*Theta[-1]-0.3333333333e-1*Theta[1-m]*Gamma^2*Theta[-1]-.5833333333*Gamma^4+.1238159222

 

 

 

.1582309790*Gamma+.3533727379*Gamma^2+0.3938055555e-1*Gamma^2*Theta[-1]+0.8621031744e-1*Gamma^3*Theta[-1]-0.2770000000e-3*Theta[-3]*Theta[1-m]*Gamma^2*Theta[-1]+0.3571428571e-3*Theta[-3]*Gamma^4*Theta[-1]*Theta[1-m]+0.5357142857e-3*Theta[-3]*Gamma^3*Theta[-1]*Theta[1-m]+0.4296824000e-3*Theta[-3]-0.5540000000e-1*Theta[3-m]+1.610350317*Theta[1-m]*Gamma^2+.3404483332*Theta[1-m]*Gamma+0.3714880914e-3*Theta[-2]*Gamma^2+0.1428781389e-1*Theta[-2]*Gamma-0.3125000000e-1*Theta[-2]*Gamma^4-0.2769146825e-1*Theta[-2]*Gamma^3+2.302380952*Theta[1-m]*Gamma^3+1.071428571*Theta[1-m]^2*Gamma^2+.4861028572*Theta[1-m]^2*Gamma-.5476190476*Theta[2-m]*Gamma^2-.3000174604*Theta[2-m]*Gamma-0.1292666666e-1*Gamma*Theta[-1]-.2639680733*Theta[1-m]+1.311193254*Gamma^3-0.3043583668e-2*Theta[-2]+.7261904762*Gamma^5+.1403466666*Theta[2-m]+0.9226190476e-1*Theta[1-m]*Gamma^2*Theta[-1]+0.7499999999e-1*Gamma^3*Theta[-1]*Theta[1-m]-0.2770000000e-3*Theta[-3]*Gamma^2*Theta[-1]+0.9369642857e-3*Theta[-3]*Gamma^3*Theta[-1]+0.3587857143e-3*Theta[-3]*Theta[1-m]*Gamma^2-0.4568838000e-2*Theta[-3]*Theta[1-m]*Gamma+0.9013571429e-2*Theta[-3]*Theta[1-m]*Gamma^3+0.4991428571e-3*Theta[-3]*Theta[1-m]^2*Gamma^2-0.1662000000e-2*Theta[-3]*Theta[1-m]^2*Gamma+0.4464285714e-4*Theta[-3]*Gamma^4*Theta[-1]^2+0.8928571429e-3*Theta[-3]*Gamma^5*Theta[-1]+0.1339285714e-2*Theta[-3]*Gamma^4*Theta[-1]+0.3571428571e-2*Theta[-3]*Gamma^5*Theta[1-m]+0.1071428571e-1*Theta[-3]*Gamma^4*Theta[1-m]+0.7142857143e-3*Theta[-3]*Theta[1-m]^2*Gamma^4+0.2142857143e-2*Theta[-3]*Theta[1-m]^2*Gamma^3-0.6655238095e-2*Theta[1-m]*Theta[-2]*Gamma^2+0.2216000000e-1*Theta[1-m]*Theta[-2]*Gamma-0.9523809523e-2*Theta[1-m]*Theta[-2]*Gamma^4-0.2857142857e-1*Theta[1-m]*Theta[-2]*Gamma^3-.1809523809*Theta[1-m]*Theta[2-m]*Gamma^2-.2714285715*Theta[1-m]*Theta[2-m]*Gamma-0.2677666666e-1*Theta[1-m]*Gamma*Theta[-1]+0.2857142857e-1*Theta[1-m]^2*Gamma^2*Theta[-1]-0.2142857143e-1*Theta[2-m]*Gamma^2*Theta[-1]+0.6925000000e-3*Theta[-2]*Gamma^2*Theta[-1]-0.8928571429e-3*Theta[-2]*Gamma^4*Theta[-1]-0.1339285714e-2*Theta[-2]*Gamma^3*Theta[-1]+1.712301587*Gamma^4-.2880800000*Theta[1-m]^2-0.8863999997e-1*Theta[1-m]^3+.1142857143*Theta[1-m]^3*Gamma^2+.1714285714*Theta[1-m]^3*Gamma+0.7142857143e-1*Theta[3-m]*Gamma^2+.1071428571*Theta[3-m]*Gamma+0.2678571429e-2*Gamma^3*Theta[-1]^2+0.6170634920e-1*Gamma^4*Theta[-1]+1.008730159*Gamma^4*Theta[1-m]+.5428571428*Theta[1-m]^2*Gamma^3-0.2906838000e-2*Theta[-3]*Gamma+0.7612516071e-3*Theta[-3]*Gamma^2+0.8593648000e-3*Theta[-3]*Theta[1-m]+0.4296824000e-3*Theta[-3]*Theta[1-m]^2+0.1128446429e-1*Theta[-3]*Gamma^3+0.4464285714e-2*Theta[-3]*Gamma^6+0.1339285714e-1*Theta[-3]*Gamma^5+0.1941428571e-1*Theta[-3]*Gamma^4-0.9920634920e-2*Theta[-2]*Gamma^5-.3015873016*Theta[2-m]*Gamma^3-0.5729098667e-2*Theta[1-m]*Theta[-2]+.1403466667*Theta[1-m]*Theta[2-m]-0.7960518329e-1

 

 

(2)

 


 

Download ReadMeCarefully__1Dmode.mw


Didn't you click on the stop button while the computation of HFS_data_2 and SFS_data_2 were being processed?

I fasten these computations by removing the absolute values (because kappa > 0)
It is likely that further improvements might be made by choosing carefully the integration options.
For instance I used method=_d01akc to compute SFS_data_2 and method=_d01ajc to compute SFS_data_3.
I think it's worth spending some time to try and find the correct method and options.

Here it is: Negativity_(v12_beta_gamma_mu)_mmcdara.mw

(BTW these results have been obtained with Maple 2015.2)

... some corrected, but you must fix yourself a few points:

  • Gamma is a symbolic quantity without no given value (not a big issue but the expressions of Theta[nu] remains symbolic and then quite lengthy).
  • You  define Theta[nu] (nu =0..8) as a function of Theta[nu-m] without defining m. Same observation than above, but Theta cannot be fully given in explicit form (recurence equation).

The least you must do is to fix m or to define m as a function of nu.

At last, as Theta seems to obey a differential equation, why don't you just solve it?

restart

_local(gamma, delta, Zeta); with(PDEtools); with(PolynomialIdeals); with(DifferentialGeometry); with(plots)

Theta[0] := 1; Theta[1] := Gamma; delta := Array(-1 .. 30, 0); delta[0] := 1; beta := 2; N[cc] := 1; N[rc] := .5; Q[int] := .2; gamma := .3; M := .5

Theta__a := 0.2:  # I believe it's a safer definition

``

for v from 0 to 2 do expr := -N[rc]*add(add(add(add(delta[l-1]*Theta[w-l]*Theta[Zeta-w]*Theta[w-Zeta]*Theta[v-w], l = 0 .. w), w = 0 .. Zeta), Zeta = 0 .. w), w = 0 .. v)+Q[int]*delta[v]-Q[int]*gamma*Theta__a*delta[v]-Q[int]*gamma*delta[v-1]*Theta__a+M*Theta__a*delta[v]/(1-Theta__a)+M*Theta__a*delta[v-1]/(1-Theta__a)+Q[int]*delta[v-1]+add(delta[w-1]*(v-w+1)*(v-w+2)*Theta[v-w+2], w = 0 .. v)+(v+1)*(v+2)*Theta[v+2]+N[rc]*Theta__a^4*delta[v-1]-M*Theta[v]/(1-Theta__a)+N[cc]*Theta__a*delta[v]-N[rc]*add(add(add(Theta[w]*Theta[Zeta-w]*Theta[w-Zeta]*Theta[v-w], w = 0 .. Zeta), Zeta = 0 .. w), w = 0 .. v)+beta*add(add(delta[Zeta-1]*(w-Zeta+1)*Theta[w-Zeta+1]*(v-w+1)*Theta[v-w+1], Zeta = 0 .. w), w = 0 .. v)-N[cc]*Theta[v]-N[cc]*add(delta[w-1]*Theta[v-w], w = 0 .. v)+beta*add(Theta[v-w]*(w+1)*Theta[w+1], w = 0 .. v)+(v+1)*Theta[v+1]+beta*add((v-w+1)*Theta[v-w+1]*(w+1)*Theta[w+1], w = 0 .. v)+beta*add(Theta[v-w]*(w+1)(w+2)*Theta[w+2], w = 0 .. v)+beta*add(add(delta[Zeta-1]*Theta[w-m]*(v-w+1)*(v-w+2)*Theta[v-w+2], Zeta = 0 .. w), w = 0 .. v)+N[cc]*Theta__a*delta[v-1]+N[rc]*Theta__a^4*delta[v]+Q[int]*gamma*delta[v]+Q[int]*gamma*add(delta[w-1]*Theta[v-w], w = 0 .. v)-M*add(delta[w-1]*Theta[v-w], w = 0 .. v)/(1-Theta__a); Theta[v+2] := solve(expr, Theta[v+2]) end do

eval(Theta)

table( [( 0 ) = 1, ( 1 ) = Gamma, ( 2 ) = .3878000000-.5000000000*Gamma^2-.7500000000*Gamma, ( 3 ) = -.1551200000+0.5000000000e-1*Gamma^2*Theta[-1]+.5247000000*Gamma-.1551200000*Theta[1-m]+.2000000000*Theta[1-m]*Gamma^2+.3000000000*Theta[1-m]*Gamma+.5000000000*Gamma^3+.7500000000*Gamma^2, ( 4 ) = -.6502611111*Gamma^2-.2585850000*Gamma+.1238159222-.5833333333*Gamma^4-1.111111111*Gamma^3+0.4852777778e-2*Theta[-2]*Gamma^2-0.1615833333e-1*Theta[-2]*Gamma+0.6944444444e-2*Theta[-2]*Gamma^4+0.2083333333e-1*Theta[-2]*Gamma^3-.5111111111*Theta[1-m]*Gamma^3+.1034133333*Theta[1-m]^2-.1333333333*Theta[1-m]^2*Gamma^2-.2000000000*Theta[1-m]^2*Gamma+.1111111111*Theta[2-m]*Gamma^2+.1666666667*Theta[2-m]*Gamma+0.4177467778e-2*Theta[-2]+.2326800000*Theta[1-m]-0.8617777778e-1*Theta[2-m]-0.4444444444e-1*Gamma^3*Theta[-1]-0.5555555556e-1*Gamma^2*Theta[-1]-.9333333333*Theta[1-m]*Gamma^2-.4619155556*Theta[1-m]*Gamma+0.2154444444e-1*Gamma*Theta[-1]-0.3333333333e-1*Theta[1-m]*Gamma^2*Theta[-1] ] )

(1)

restart

local gamma:

beta := 2;
N__cc := 1;
N__rc := .5;
Q__int := .2;
gamma := .3;
M := .5

2

 

1

 

.5

 

.2

 

.3

 

.5

(2)

ode :=
diff(Theta(x), x, x)
+
beta*(Theta(x)-Theta__a)*diff(Theta(x), x, x)
+
beta*(Theta(x)-Theta__a)*diff(Theta(x), x)/(1+eta)
+
diff(Theta(x), x)/(1+eta)
+
beta*diff(Theta(x), x)^2
-
N__cc*(Theta(x)-Theta__a)^(n+1)/(1-Theta__a)^n
-
N__rc*(Theta(x)^4-Theta__a^4)
+
Q__int*(1+gamma*(Theta(x)-Theta__a))
-
M*(Theta(x)-Theta__a)/(1-Theta__a)
=
0

diff(diff(Theta(x), x), x)+2*(Theta(x)-Theta__a)*(diff(diff(Theta(x), x), x))+2*(Theta(x)-Theta__a)*(diff(Theta(x), x))/(1+eta)+(diff(Theta(x), x))/(1+eta)+2*(diff(Theta(x), x))^2-(Theta(x)-Theta__a)^(n+1)/(1-Theta__a)^n-.5*Theta(x)^4+.5*Theta__a^4+.2+0.6e-1*Theta(x)-0.6e-1*Theta__a-.5*(Theta(x)-Theta__a)/(1-Theta__a) = 0

(3)

sys := {ode, Theta(0)=T__0, D(Theta)(0)=DT__0}:

U := convert(indets(sys, name) minus {x}, list)

[DT__0, T__0, eta, n, Theta__a]

(4)

sol := dsolve(sys, numeric, parameters=U);

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

(5)

sol(parameters=[0, 1, 0, 1, 0]);

[DT__0 = 0., T__0 = 1., eta = 0., n = 1., Theta__a = 0.]

(6)

# example

sol(1);

[x = 1., Theta(x) = HFloat(1.2238662096731456), diff(Theta(x), x) = HFloat(0.41014469271271276)]

(7)

# example

plots:-odeplot(sol, [x, Theta(x)], x=0..5)

Warning, cannot evaluate the solution further right of 4.0622032, probably a singularity

 

 

 

Download Thermal_Stress_Distribution_mmcdara.mw

To solve the ode I ARBITRARILY considered this was a problem with initial conditions (IC).
If I'm wrong correct this.
Likewise I considered very simple IC, even if your thermal problem suggests that you have convection and radiative conditions.
Here again correct this yourself if you are interesting in dsolving the ode.



I do not believe that Maple can handle the level of abstraction required to derive the results you present.

Nevertheless you could try using the definitions of JacobiP(n, alpha, alpha+1, x) and JacobiP(n, alpha, alpha+2, x)  and, starting from the binomial coefficients these expressions contain, proceed to simplifications in order to express the coefficients of JacobiP(n, alpha, alpha+2, x)  in terms of those of JacobiP(n, alpha, alpha+1, x) :

# Let

C(n, s, alpha, alpha+1) = convert(binomial(n+alpha, n-s)*binomial(n+beta, s), factorial);

C(n, s, alpha, alpha+1) = factorial(n+alpha)*factorial(n+beta)/(factorial(n-s)*factorial(alpha+s)*factorial(s)*factorial(n+beta-s))

(1)

# By definition the Jacobi(n, alpha, alpha+1)(x) polynomial writes

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("1")))`(x)
=
Sum(C(n, s, alpha, alpha+1)*((x-1)/2)^s*((x+1)/2)^(n-s), k=0..n)

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("1")))`(x) = Sum(C(n, s, alpha, alpha+1)*((1/2)*x-1/2)^s*((1/2)*x+1/2)^(n-s), k = 0 .. n)

(2)

# Changing alpha+1 into alpha+2 gives

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("2")))`(x)
=
Sum(C(n, s, alpha, alpha+2)*((x-1)/2)^s*((x+1)/2)^(n-s), k=0..n)

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("2")))`(x) = Sum(C(n, s, alpha, alpha+2)*((1/2)*x-1/2)^s*((1/2)*x+1/2)^(n-s), k = 0 .. n)

(3)

# Which, after simplification writes

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("2")))`(x)
=
Sum((n+alpha+2)/(n+alpha+2-s).C(n, s, alpha, alpha+1)*((x-1)/2)^s*((x+1)/2)^(n-s), k=0..n)

`#msup(msub(mo("P"),mo("n")),mrow(mo("&alpha;"),mo("&#x2c;"),mo("&alpha;"),mo("&#x2b;"),mo("2")))`(x) = Sum(((n+alpha+2)/(n+alpha+2-s).C(n, s, alpha, alpha+1))*((1/2)*x-1/2)^s*((1/2)*x+1/2)^(n-s), k = 0 .. n)

(4)

 

Download JacobiP.mw

First 29 30 31 32 33 34 35 Last Page 31 of 65