tomleslie

13876 Reputation

20 Badges

15 years, 163 days

MaplePrimes Activity


These are answers submitted by tomleslie

In the final 'for' loop, with i=0, Maple can find a symbolic solution for your ODE system. When i=1, Maple cannot find a symbolic solution so the dsolve() command returns an empty set. When you try to assign quantities such as

f1[i](x):=rhs(P[1]):

since P is the empty set, P[1] does not exist, and you get the error message

Error, invalid subscript selector

At this point I owuld normally suggest attempting a numerical solutionn for your ODE system, but since you have boundary conditions defined at four different values of the independent variable, this will not be possible.
##########################################

When attempting to run the code you supplied in more recent versions of Maple, many typesetting errors of the form

Error, (in Typeset:-Tdisplay[true]) improper op or subscript selector

Error, unexpected result from Typesetting

are produced. Changing the Typesetting level from 'extended' (default for versions later than Maple 18)  to 'standard' (the default for Maple 18) removes these typesetting errors, but introduces some odd problem with boundary conditions which I can't track down.

############################################

In the attached code I ahve "cleaned up" a lot of the notation without changing the 'logic' of the problem. This code will run the same way in Maple 18 with typesetting=standard and Maple 2022 with typesetting=extended, and produce the same "invalid subscript selector" in both.

  restart:
  with(plots):
  PDEtools[declare](f1(x),f2(x),f3(x), t1(x),t2(x),t3(x)):

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

 

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

 

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

 

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

 

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

 

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

(1)

  N :=1:
  F1:= add(p^jj*f1[jj](x), jj=0..N):
  F2:= add(p^jj*f2[jj](x), jj=0..N):
  F3:= add(p^jj*f3[jj](x), jj=0..N):
  T1:= add(p^jj*t1[jj](x), jj=0..N):
  T2:= add(p^jj*t2[jj](x), jj=0..N):
  T3:= add(p^jj*t3[jj](x), jj=0..N):

  gr:=5: pa:=5: sa:=4: br:=0.1: A1:=1: A2:=2: A3:=1:
  Eq11:= (1-p)*((diff(F1, x$2)+gr*T1)+pa)+p*((diff(F1, x$2)+gr*T1)+pa):
  Eq12:= (1-p)*(diff(T1, x$2))+p*((diff(T1, x$2)+br*(diff(F1, x))*(diff(F1, x)))):
  Eq21:= (1-p)*((diff(F2, x$2)+gr*A1*A2*T2)-sa*sa*F2+pa*A1)+p*((diff(F2, x$2)+gr*A1*A2*T2)-sa*sa*F2+pa*A1):
  Eq22:= (1-p)*(diff(T2, x$2))+p*((diff(T2, x$2)+A1*A3*br*((diff(F1, x))*(diff(F1, x))+sa*sa*F2*F2))):
  Eq31:= (1-p)*br*((diff(F3, x$2)+gr*T3)+pa)+p*((diff(F3, x$2)+gr*T3)+pa):
  Eq32:= (1-p)*br*(diff(T3, x$2))+p*((diff(T3, x$2)+br*(diff(F3, x))*(diff(F3, x)))):

  for i from 0 to N+1 do
      equ1[i] := coeff(Eq11, p, i) = 0:
      equ2[i] := coeff(Eq12, p, i) = 0:
      equ3[i] := coeff(Eq21, p, i) = 0:
      equ4[i] := coeff(Eq22, p, i) = 0:
      equ5[i] := coeff(Eq31, p, i) = 0:
      equ6[i] := coeff(Eq32, p, i) = 0:
  end do:

  con1[0]:= f1[0](-1) = 0, f1[0](0) = f2[0](0), D(f1[0])(0) = D(f2[0])(0),
            f2[0](1) = f3[0](1), D(f2[0])(1) = D(f3[0])(1),f3[0](2)=0:
  con2[0]:= t1[0](-1) = 0, t1[0](0) = t2[0](0), D(t1[0])(0) = D(t2[0])(0),
            t2[0](1) = t3[0](1), D(t2[0])(1) = D(t3[0])(1), t3[0](2)=1:
  for h to N do
      con1[h]:= f1[h](-1) = 0,  f1[h](0) = f2[h](0), D(f1[h])(0) = D(f2[h])(0),
                f2[h](1) = f3[h](1), D(f2[h])(1) = D(f3[h])(1), f3[h](2)=0:
      con2[h]:= t1[h](-1) = 0, t1[h](0) = t2[h](0), D(t1[h])(0) = D(t2[h])(0),
                t2[h](1) = t3[h](1), D(t2[h])(1) = D(t3[h])(1), t3[h](2)=0:
  end do:

  for i from 0 to N do
      P:= dsolve( {con1[i], con2[i], equ1[i], equ2[i], equ3[i], equ4[i], equ5[i], equ6[i]},
                  {f1[i](x), t1[i](x), f2[i](x), t2[i](x), f3[i](x), t3[i](x)}
                ):
      f1[i](x):=rhs(P[1]):
      f2[i](x):=rhs(P[2]):
      f3[i](x):=rhs(P[3]):
      t1[i](x):=rhs(P[4]):
      t2[i](x):=rhs(P[5]):
      t3[i](x):=rhs(P[6]):
  end do;

{f1[0](x) = -(5/18)*x^3-(10/3)*x^2-(5/72)*(447*exp(-4)-715*exp(4)+404)*x/(9*exp(-4)-25*exp(4))-(5/72)*(51*exp(-4)+404+385*exp(4))/(9*exp(-4)-25*exp(4)), f2[0](x) = -(5/144)*exp(4*x)*(237*exp(-4)+505)/(9*exp(-4)-25*exp(4))-(5/144)*exp(-4*x)*(303+395*exp(4))/(9*exp(-4)-25*exp(4))+(5/24)*x+25/48, f3[0](x) = -(5/18)*x^3-(10/3)*x^2+(5/72)*(316*exp(-4)*exp(4)+1605*exp(-4)-3785*exp(4))*x/(9*exp(-4)-25*exp(4))-(5/36)*(316*exp(-4)*exp(4)+597*exp(-4)-985*exp(4))/(9*exp(-4)-25*exp(4)), t1[0](x) = (1/3)*x+1/3, t2[0](x) = (1/3)*x+1/3, t3[0](x) = (1/3)*x+1/3}

 

-(5/18)*x^3-(10/3)*x^2-(5/72)*(447*exp(-4)-715*exp(4)+404)*x/(9*exp(-4)-25*exp(4))-(5/72)*(51*exp(-4)+404+385*exp(4))/(9*exp(-4)-25*exp(4))

 

-(5/144)*exp(4*x)*(237*exp(-4)+505)/(9*exp(-4)-25*exp(4))-(5/144)*exp(-4*x)*(303+395*exp(4))/(9*exp(-4)-25*exp(4))+(5/24)*x+25/48

 

-(5/18)*x^3-(10/3)*x^2+(5/72)*(316*exp(-4)*exp(4)+1605*exp(-4)-3785*exp(4))*x/(9*exp(-4)-25*exp(4))-(5/36)*(316*exp(-4)*exp(4)+597*exp(-4)-985*exp(4))/(9*exp(-4)-25*exp(4))

 

(1/3)*x+1/3

 

(1/3)*x+1/3

 

(1/3)*x+1/3

 

"P := "

 

Error, invalid subscript selector

 

 

Download badODEsys.mw

 

In your first execution group, for k=0 in the for loop, you are asking to solve the ode system

sys := {diff(c[0](x), x, x)/Pr, c[0](0) - 1, D(b[0])(5) - 1, diff(b[0](x), x, x, x), b[0](0), c[0](5), D(b[0])(0)}

In other words, two differential equations with dependent variables c[0](x) and b[0](x): system is second-order in c[0](x) and third-order in b[0](x). Sice you have two boudary conditions on c[0](x) and three boundary conditions on b[0](x), then there is sufficient, consistent, information for a solution, and Maple finds one.

################################################################################

In your second execution group, for k=0 in the for loop, you are asking to solve the ode system

sys:={1, diff(c[0](x), x, x)}

Now Maple does not like the fact that you have included the simple number '1' as part of an ODE system. What is it supposed to represent? Maple has no idea (and neither do I).

Maybe you intended a boundary condition such as c[0](0)=1 (in which case, you are still short of one boundary condition), or something else?

the source of your problem is in the plot commands where you have

eval(EQ2, params1 union {C = k/20})

If you check the indeterminates in the above expression with

indets(eval(EQ2, params1 union {C = k/20}));

this will return

{k, u, xi, z}

Now, k, u, z are determined within the plotting command either as range variables or the index of the seq() command - however 'xi' is completely undetermined, which is why you get the error message

Error, (in plots/implicitplot) invalid input: the following extra unknowns were found in the input expression: {xi}

Overall this seems like a complicated way to do phase portraits - if that is your ultimate objective. Have you considered eithe the phaseportrait()  or DEplot() commands? The attached shows how to produce some phase portrtaits and solution curves using the former - but I'm not sure if these satisfy your objective


 

  restart:
  with(DEtools):
  with(plots):

#
# Define system
#
  f := (u, z) -> z:
  g := (u, z) -> -u^3 + 3*z*u + c2*u^2/c1 + c2*z/c1 - c*u/c1:
  sys := diff(u(xi), xi) = f(u(xi), z(xi)),
         diff(z(xi), xi) = g(u(xi), z(xi)):
#
# Generate the phase portrait for a specified list of c, c1, c2
# with a couple of solution curves for different initial
# conditions
#
  phaseportrait
  ( eval
    ( {sys},
      [c=0.1, c1=-0.2, c2=-1]
    ),
    [u(xi), z(xi)],
    -1..1,
    [ [u(0) = 0, z(0) =  0.01],
      [u(0) = 0, z(0) = -0.01]
    ],
    color=blue,
    linecolor=[red, green]
  );
#
# Or solution curves for u(xi) only
#
  phaseportrait
  ( eval
    ( {sys},
      [c=0.1, c1=-0.2, c2=-1]
    ),
    [u(xi), z(xi)],
    -1..1,
    [ [u(0) = 0, z(0) =  0.01],
      [u(0) = 0, z(0) = -0.01]
    ],
    scene=[xi, u(xi)],
    color=blue,
    linecolor=[red, green]
  );
#
# Or solution curves for z(xi) only
#
  phaseportrait
  ( eval
    ( {sys},
      [c=0.1, c1=-0.2, c2=-1]
    ),
    [u(xi), z(xi)],
    -1..1,
    [ [u(0) = 0, z(0) =  0.01],
      [u(0) = 0, z(0) = -0.01]
    ],
    scene=[xi, z(xi)],
    color=blue,
    linecolor=[red, green]
  );

 

 

 

#
# The two solution curves in the above figures could also
# be produced with
#
  res1:= dsolve
         ( eval
           ( [sys, u(0)=u0,z(0)=z0 ],
             [u0=0, z0=0.01, c=0.1, c1=-0.2, c2=-1.0]
           ),
           numeric
         ):
  res2:= dsolve
         ( eval
           ( [sys, u(0)=u0,z(0)=z0],
             [u0=0, z0=-0.01, c=0.1, c1=-0.2, c2=-1.0]
           ),
           numeric
         ):
#
# z(xi) against u(xi)
#
  display
  ( [ odeplot
      ( res1,
        [u(xi), z(xi)],
        xi=-1..1,
        color=red
      ),
      odeplot
      ( res2,
        [u(xi), z(xi)],
        xi=-1..1,
        color=green
      )
    ]
  );
#
# u(xi) against xi
#
  display
  ( [ odeplot
      ( res1,
        [xi, u(xi)],
        xi=-1..1,
        color=red
      ),
      odeplot
      ( res2,
        [xi, u(xi)],
        xi=-1..1,
        color=green
      )
    ]
  );  
#
# z(xi) against xi
#
  display
  ( [ odeplot
      ( res1,
        [xi, z(xi)],
        xi=-1..1,
        color=red
      ),
      odeplot
      ( res2,
        [xi, z(xi)],
        xi=-1..1,
        color=green
      )
    ]
  );             

 

 

 

 

Download phPor.mw

 

 

the definition of ODE contains at least one (and very probably two) typos. The attached shows what the ODE should(?) be, although I guessed the "fix" for the second typo

It doesn't make a huge amount of difference because these is no way you are going to solve a single ODE which contains two unknown functions (along with their derivatives).

ODE := cos(g(t))^2*(diff(T(t), t, t))-3*rho*(diff(g(t), t))*cos(g(t))*sin(g(t))*(diff(T(t), t))+(Omega^2*cos(g(t))^z-8*rho^2*(diff(g(t), t))^2*sin(g(t))^2+2*sin(g(t))*cos(g(t))*(diff(g(t), t, t))*rho+2*(cos(g(t))^2)(diff(g(t), t))^2*rho+2*rho*(diff(g(t), t))^2*sin(g(t))^2)*T(t) = 0

cos(g(t))^2*(diff(diff(T(t), t), t))-3*rho*(diff(g(t), t))*cos(g(t))*sin(g(t))*(diff(T(t), t))+(Omega^2*cos(g(t))^z-8*rho^2*(diff(g(t), t))^2*sin(g(t))^2+2*sin(g(t))*cos(g(t))*(diff(diff(g(t), t), t))*rho+2*(cos(g(t)))(diff(g(t), t))^4*rho+2*rho*(diff(g(t), t))^2*sin(g(t))^2)*T(t) = 0

(1)

dsolve(ODE, T(t))

T(t) = DESol({-(-Omega^2*cos(g(t))^z+8*rho^2*(diff(g(t), t))^2*sin(g(t))^2-2*sin(g(t))*cos(g(t))*(diff(diff(g(t), t), t))*rho-2*(cos(g(t)))(diff(g(t), t))^4*rho-2*rho*(diff(g(t), t))^2*sin(g(t))^2)*_Y(t)/cos(g(t))^2-3*rho*(diff(g(t), t))*sin(g(t))*(diff(_Y(t), t))/cos(g(t))+diff(diff(_Y(t), t), t)}, {_Y(t)})

(2)

"#  #` Check unknowns in ODE - hmm contains a "product term" must be a typo:`  #` also contains a term in `(cos(g(t)))^(z) - is this for real"? or is 'z' another typo?"  #  indets(ODE);"

{Omega, rho, t, z, cos(g(t))^z, T(t), cos(g(t)), diff(T(t), t), diff(diff(T(t), t), t), diff(diff(g(t), t), t), diff(g(t), t), g(t), sin(g(t)), (cos(g(t)))(diff(g(t), t))}

(3)

ODE := cos(g(t))^2*(diff(T(t), t, t))-3*rho*(diff(g(t), t))*cos(g(t))*sin(g(t))*(diff(T(t), t))+(Omega^2*cos(g(t))^2-8*rho^2*(diff(g(t), t))^2*sin(g(t))^2+2*sin(g(t))*cos(g(t))*(diff(g(t), t, t))*rho+2*cos(g(t))^2*(diff(g(t), t))^2*rho+2*rho*(diff(g(t), t))^2*sin(g(t))^2)*T(t) = 0; indets(ODE)

cos(g(t))^2*(diff(diff(T(t), t), t))-3*rho*(diff(g(t), t))*cos(g(t))*sin(g(t))*(diff(T(t), t))+(Omega^2*cos(g(t))^2-8*rho^2*(diff(g(t), t))^2*sin(g(t))^2+2*sin(g(t))*cos(g(t))*(diff(diff(g(t), t), t))*rho+2*cos(g(t))^2*(diff(g(t), t))^2*rho+2*rho*(diff(g(t), t))^2*sin(g(t))^2)*T(t) = 0

 

{Omega, rho, t, T(t), cos(g(t)), diff(T(t), t), diff(diff(T(t), t), t), diff(diff(g(t), t), t), diff(g(t), t), g(t), sin(g(t))}

(4)

dsolve(ODE, T(t))

T(t) = DESol({diff(diff(_Y(t), t), t)-3*rho*(diff(g(t), t))*sin(g(t))*(diff(_Y(t), t))/cos(g(t))+(8*cos(g(t))^2*(diff(g(t), t))^2*rho^2+2*sin(g(t))*cos(g(t))*(diff(diff(g(t), t), t))*rho-8*rho^2*(diff(g(t), t))^2+Omega^2*cos(g(t))^2+2*rho*(diff(g(t), t))^2)*_Y(t)/cos(g(t))^2}, {_Y(t)})

(5)

 

Download badODE.mw

you have provided formulae for all the data you wish to compute, I'm having difficulty figuring out what your problem actually is??

Is it covered by the attached?

  restart;
  a := 1: b := 5:
  doDiff:= proc( ipData )
                 local j, opData:
                 if   numelems(ipData) > 1
                 then opData:=< seq
                                ( ipData[j]-ipData[j-1],
                                  j=2..numelems(ipData)
                                )
                              >:
                      return opData, thisproc(opData);
                 fi;
           end proc:
  xVals:= < $ a..b >:
  yVals:= < 1/~xVals >:
  yVals, doDiff(yVals);

Matrix(5, 1, {(1, 1) = 1, (2, 1) = 1/2, (3, 1) = 1/3, (4, 1) = 1/4, (5, 1) = 1/5}), Matrix(4, 1, {(1, 1) = -1/2, (2, 1) = -1/6, (3, 1) = -1/12, (4, 1) = -1/20}), Matrix(3, 1, {(1, 1) = 1/3, (2, 1) = 1/12, (3, 1) = 1/30}), Matrix(2, 1, {(1, 1) = -1/4, (2, 1) = -1/20}), Matrix(1, 1, {(1, 1) = 1/5})

(1)

 

Download doDiffs.mw

 

because I missed a term when typing in your equation.

When I include this term I see the same behaviour as you do, see the attached.

In the attached I also evaluated (the square root of) the discriminant, since this determines the nature of the possible solutions. This expression is actually

4*sqrt(-(a__02*b__11 - a__11*b__02)^2)

In other words, it is of the form

sqrt(-y^2)

Now if one applies the "simplification" simplify(expr, sqrt, symbolic), to this last expression, Maple will return I*y. Note that the help for simplify(expr, sqrt, symbolic) states that

The purpose of this feature is to allow simplification of expressions in contexts where the sign has no meaning, such as when x is an algebraic indeterminate.

So I think that Maple is correct - but I am somewhat surprised that it performs the last "simplification"


 

  restart;
  eqn:=4*a__02^2+4*k*a__02*a__11+k^2*a__11^2+4*k*b__02*b__11+k^2*b__11^2=0;
  solve(eqn, [k])[];

a__11^2*k^2+b__11^2*k^2+4*a__02*a__11*k+4*b__02*b__11*k+4*a__02^2 = 0

 

[k = 2*(-a__02*a__11-b__02*b__11+(-a__02^2*b__11^2+2*a__02*a__11*b__02*b__11+b__02^2*b__11^2)^(1/2))/(a__11^2+b__11^2)], [k = -2*(a__02*a__11+b__02*b__11+(-a__02^2*b__11^2+2*a__02*a__11*b__02*b__11+b__02^2*b__11^2)^(1/2))/(a__11^2+b__11^2)]

(1)

#
# Actually when typing 'eqn' above, I missed the term 4*b__02^2!
# When I include this term - the weird solve() behaviour
# appears
#
  eqn:=lhs(eqn)+4*b__02^2=0;
  solve(eqn, [k])[];

a__11^2*k^2+b__11^2*k^2+4*a__02*a__11*k+4*b__02*b__11*k+4*a__02^2+4*b__02^2 = 0

 

[k = 2*(I*a__02*b__11-I*a__11*b__02-a__02*a__11-b__02*b__11)/(a__11^2+b__11^2)], [k = -2*(I*a__02*b__11-I*a__11*b__02+a__02*a__11+b__02*b__11)/(a__11^2+b__11^2)]

(2)

#
# Idle curiosity - collect on 'k', just to show that eqn is
# a "simple" quadratic - makes no difference to the solution
#
  collect(eqn, k);
  solve(%, [k])[];

(a__11^2+b__11^2)*k^2+(4*a__02*a__11+4*b__02*b__11)*k+4*a__02^2+4*b__02^2 = 0

 

[k = 2*(I*a__02*b__11-I*a__11*b__02-a__02*a__11-b__02*b__11)/(a__11^2+b__11^2)], [k = -2*(I*a__02*b__11-I*a__11*b__02+a__02*a__11+b__02*b__11)/(a__11^2+b__11^2)]

(3)

#
# Take a look at (the square root of) the discriminant
#
  sqrt(discrim(lhs(eqn), k));
  simplify(%, sqrt, symbolic);

4*(-(a__02*b__11-a__11*b__02)^2)^(1/2)

 

(4*I)*b__11*a__02-(4*I)*a__11*b__02

(4)

 simplify(sqrt(-y^2), sqrt, symbolic);

I*y

(5)

 

Download solk2.mw

 

is quadratic in 'k' and therefore is trivial to solve (see attached). Whether the solutions are real or imaginary depends of all the parameters in the system.

As a general rule you should use the big green up-arrow in the Mapleprimes toolbar to upload your worksheet - it saves anyone here having to retype your stuff, which is time-consuming and error-prone


 

  restart;
  eqn:=4*a__02^2+4*k*a__02*a__11+k^2*a__11^2+4*k*b__02*b__11+k^2*b__11^2=0;
  solve(eqn, [k])[];

a__11^2*k^2+b__11^2*k^2+4*a__02*a__11*k+4*b__02*b__11*k+4*a__02^2 = 0

 

[k = 2*(-a__02*a__11-b__02*b__11+(-a__02^2*b__11^2+2*a__02*a__11*b__02*b__11+b__02^2*b__11^2)^(1/2))/(a__11^2+b__11^2)], [k = -2*(a__02*a__11+b__02*b__11+(-a__02^2*b__11^2+2*a__02*a__11*b__02*b__11+b__02^2*b__11^2)^(1/2))/(a__11^2+b__11^2)]

(1)

 

 

Download solk.mw

produces five (different) plots on my desktop.

It is probably(?) "safer" to use the plottools:-exportplot() command, rather than the more "generic" "Export()" command

  for i from 1 to 5 do
    plottools:-exportplot
               ( cat
                 ( "C:/Users/TomLeslie/Desktop/Fig",
                   i,
                   ".jpg"
                 ),
                 plot(x*i,x=0..10),
                 "JPEG"
               );
  od:

 

Download expPlot.mw

that syrup is clever enough to handle piecewise or conditional expressions within the circuit description itself.

However Syrup returns equations or ODEs which can be manipulated in the same way as any other Maple equation or ODE, so coming up with best case/worst case scenarios *ought* not to be too difficult - the optimisation package may be useful here.

I suggest you post a worksheet (use the big green up-arrow in the Mapleprimes toolbar) showing a "typical" example of what you are doing now, so that responders here can examine and make suggestions for improvements.

see the attached, I'm going to make a guess. WIth both derivatives, the missing term should arise from the factor -3*x*y in the function definition, as -3*x or -3*y. I'm guessing that you are missing a multiplication sign ('*') beween 'x' and 'y' in this term.

If that is not the case, and the pr oblem persists please upload a worksheet using the big green up-arrow in the Mapleprimes toolbar

  restart;
  f:=(x,y)->2*x^2-3*x*y-(y+2)^3+5;
  diff(f(x,y),x);
  diff(f(x,y),y);

proc (x, y) options operator, arrow; 2*x^2-3*x*y-(y+2)^3+5 end proc

(1)

 

4*x-3*y

 

-3*x-3*(y+2)^2

(2)

 

Download badDiff.mw

 

 

 

hoo often Friday 13th occurs in any given year, I'd use Maple's calendar package - as in the attached

  restart;
  with(Calendar):
  fri:= yr-> local j: add( `if`(DayOfWeek(yr, j, 13)=6,1,0), j=1..12):
#
# How many Friday 13th in (say) 2022
#
  fri(2022);
#
# How many Friday 13th each year between, say 2000 and 2022
#
  seq( [k, fri(k)], k=2000..2022 );

1

 

[2000, 1], [2001, 2], [2002, 2], [2003, 1], [2004, 2], [2005, 1], [2006, 2], [2007, 2], [2008, 1], [2009, 3], [2010, 1], [2011, 1], [2012, 3], [2013, 2], [2014, 1], [2015, 3], [2016, 1], [2017, 2], [2018, 2], [2019, 2], [2020, 2], [2021, 1], [2022, 1]

(1)

 

Download fri13.mw

 

but since it appears to be nothing more than a "glitzy" interface to Maple, I think that any "standard" Maple command ought to work!

So you might want to try the attached - if it doesn't work then that is problem with Maple Flow, which I can't help you with!

NB  The output display will (may?) appear differently when you execute the worksheet - the double square brackets around the output "unit" won't appear

  restart;
  convert( 360*Unit(degrees), units, radians);

2*Pi*Units:-Unit(rad)

(1)

 

Download cU.mw

 

 

You make the statement,

The general solution for this ode is as

 

x[0](tau) = y[0](tau) = exp( - tau ), 

No it isn't!

For example, why not 'exp(tau)', or 'cos(tau)' or even ' exp(tau)*(1-sin(tau)) ' ???

Your ODE is satisfied by any function F(tau) for which

x[0](tau)=y[0](tau)=F(tau), and
F(0)=1.

In the attached, I have tested several such candidate functions, see the list in the snip below

functs:=[ exp(-tau),
          exp(tau),
          cos(tau),
          tau!,
          1+sum(c[i]*tau^i, i=1..N),
          (1-sin(tau))/tau!,
          tau!*exp(tau)*cos(tau)*(1+sum(c[i]*tau^i, i=1..N))
          ];

- and they all satisfy the ODE and the initial conditions.

  restart;
  eq:=diff(x[0](tau), tau) + x[0](tau) - diff(y[0](tau), tau) - y[0](tau)=0:
  cons:= x[0](0)=1 , y[0](0)=1:
#
# All entries in the list 'functs' are solutions
#
  functs:=[ exp(-tau),
            exp(tau),
            cos(tau),
            tau!,
            1+sum(c[i]*tau^i, i=1..N),
            (1-sin(tau))/tau!,
            tau!*exp(tau)*cos(tau)*(1+sum(c[i]*tau^i, i=1..N))
          ];
#
# Verify that each of the entries in 'functs' satisfies
# the ODE and the initial conditions
#
  seq
  ( odetest
    ( [ x[0](tau)=functs[j],
        y[0](tau)=functs[j]
      ],
      [eq,cons]
    ),
    j=1..numelems(functs)
  );
 

[exp(-tau), exp(tau), cos(tau), factorial(tau), 1+sum(c[i]*tau^i, i = 1 .. N), (1-sin(tau))/factorial(tau), factorial(tau)*exp(tau)*cos(tau)*(1+sum(c[i]*tau^i, i = 1 .. N))]

 

[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]

(1)

 

Download badSol.mw

assuming I can type accurately (which I do not guarantee), the answer would be as shown in the attached?

  restart;                      
  sys:= [ diff(v__0(t),t$2)+v__0(t)=0,
          v__0(0)=1,
          D(v__0)(0)=0,
          diff(v__1(t),t$2)+v__1(t)=-v__0(t)^3,
          v__1(0)=0,
          D(v__1)(0)=0,
          diff(v__2(t),t$2)+v__2(t)=-v__0(t)^2*v__1(t),
          v__2(0)=0,
          D(v__2)(0)=0,
          diff(v__3(t),t$2)+v__3(t)=-3*v__0(t)^2*v__1(t)^2-3*v__0(t)^2*v__2(t),
          v__3(0)=0,
          D(v__3)(0)=0,
          diff(v__4(t),t$2)+v__4(t)=-6*v__0(t)*v__1(t)*v__2(t)-3*v__0(t)^2*v__4(t)-v__1(t)^3,
          v__4(0)=0,
          D(v__4)(0)=0,
          diff(v__5(t),t$2)+v__5(t)=-6*v__0(t)*v__1(t)*v__3(t)-3*v__1(t)^2*v__2(t)-3*v__0(t)^2*v__4(t)-3*v__0(t)*v__2(t)^2,
          v__5(0)=0,
          D(v__5)(0)=0
        ]:
  sol:= dsolve(sys, numeric):
  plots:-odeplot( sol,
                  [ [ t, v__0(t)],
                    [ t, v__1(t)],
                    [ t, v__2(t)],
                    [ t, v__3(t)],
                    [ t, v__4(t)],
                    [ t, v__5(t)]
                  ],
                  t= 0..10,
                  color= [red, green, blue, yellow, cyan, black],
                  axes=boxed,
                  gridlines=false
                );
                 

 

 

Download odeSys.mw

singe the plotting range represents a continuous variable, you can "integerize" it by adding a couple of floor() commands in the function definition, as in the attached.

  restart;
  f:=n->ceil(sqrt(4*floor(n)))-floor(sqrt(2*floor(n)))-1:
  plot(f, 10..100, gridlines=false);

 

 

Download sqPlot.mw

 

First 25 26 27 28 29 30 31 Last Page 27 of 207