MaplePrimes Questions

I have thought that   D(y)(0)=C1  and  eval(diff(y(t),t),t=0)=C1  mean exactly the same thing which is derivative of y wr.t. "t" evaluated at specific point t=0 is C1.

If you agree they are exactly the same thing, then why dsolve works with both forms used for initial conditions if the option 'series' is not used.

When using the 'series' option, dsolve stops working when using  eval(diff(y(t),t),t=0) form? All else is the same.

ode:=diff(y(t),t$2)+3*diff(y(t),t)+2*y(t)=0;
bc_form_1:=y(0)=C1,eval(diff(y(t),t),t=0)=C2;
bc_form_2:=y(0)=C1,D(y)(0)=C2;
sol1:=dsolve([ode,bc_form_1],y(t));
sol2:=dsolve([ode,bc_form_2],y(t))

Both the above work

But now when I use the 'series' option, the first form stops working!

ode:=diff(y(t),t$2)+3*diff(y(t),t)+2*y(t)=0;
bc_form_1:=y(0)=C1,eval(diff(y(t),t),t=0)=C2;
bc_form_2:=y(0)=C1,D(y)(0)=C2;
sol1:=dsolve([ode,bc_form_1],y(t),'series');
sol2:=dsolve([ode,bc_form_2],y(t),'series')

 

 

Is this a bug? 

Just updated to Maple 2019.1  on windows 10.

The code is from the book(SDE). I think P.n := evalm( P.(n-1)&*P0) causes the problem. I have never seen this kind of the structure before ( I did some coding with C and Java). Could you explain that? P0, P1, P2,,,, using for n from 1 to 10. Is "." between P and n the dot (period)? Thank you in advance.

restart

N := 2; A := -N; B := N

q := .3; p := .5; sa := .9; sb := .1; r := 1-p-q

with(linalg)

dimP := 2*N+1

P := matrix(dimP, dimP, [`$`(0, dimP*dimP)])

P[1, 1] := sa; P[1, 2] := 1-sa; P[dimP, dimP] := sb; P[dimP, dimP-1] := 1-sb

for i from 2 to dimP-1 do P[i, i-1] := q; P[i, i] := r; P[i, i+1] := p end do

P0 := P

for n to 10 do P.n := evalm(`&*`(P.(n-1), P0)) end do

print(P10)

P10

(1)

``


 

Download TransitionMatix.mw

I have this very ugly ODE system which I solve with "dsolve, numeric, complex=true". It works ok but I'd really like to be able to use events. The problem is that the solution of the system has very small (~10^(-Digits)) imaginary part and as we know "events" works only for real ODEs.

My question is does anyone know a way to force dsolve to solve the ODE as a real system? In Mathematica, there is the function "chop" which does the trick. In Maple, I tried with fnormal and also by forcing some terms to be real but that makes it hit a singularity at 0.01 which doesn't exist when it integrates it as a complex system. In Mathematica, it integrates ok with "chop" without any random singularities. 

I'm currently trying separating the system into real and imaginary parts, but considering how ugly the system is, it may not be so simple (and so far, it doesn't work). So something to trick dsolve would come handy.

Thanks in advance.

How can plot two  and bipolar figures as attached and extract their data.

Thank You.

I have reinstalled Maple 2019 several times, including its latest update. But when trying to graph the following:

plot(sin(x), x = -2*Pi .. 2*Pi)

But I get this:

Error, (in plot) expected a range but received x = -2*Pi .. 2*Pi

And if I enter:

sin(x)

The result is:

2.73949338633639*10-116 + 2.73949338633639*10-116*I

When trying this:

plot3d(x*exp(-x^2 - y^2), x = -2 .. 2, y = -2 .. 2, color = x)

I get this:

And if I try it with Graph Theory:

with(GraphTheory);
G := Graph({{a, b}, {a, c}, {b, c}});
G := Graph 1: an undirected unweighted graph with 3 vertices and 3 edge(s)

DrawGraph(G)

Error, (in GraphTheory:-DrawGraph) invalid input: modp received I, which is not valid for its 2nd argument, m
 

I do not know what is the reason for this anomalous behavior of Maple 2019, it will be some software bug or it will be an error caused by my computer...
I would like to know if this problem happens to other people or just to me. Any help or guidance on this problem will be greatly appreciated.


Best regards

 

Hello everyone! 

I have a naive question... 
I'm traying to construct an array such entries are derivatives of a particular function. In my original problem, the elements of the array are numerous, so build it manual is not an option... A simplification of my task is :

                      


So, as you can see, for some reason Maple doen't chanche the index "i" in my derivative while the cycle is runnin. So all i want to do  is construct an array of the form 

using a cycle. 

Thanks for yout help! 

Hello everybody

can anybody help me solve this differential equation please?

 

d^2y(t)/dt^2-dy(t)/dt*1/y(t)=a*y(t)^2

I am really not good at writing the code. The code was from the book (Stochastic process with maple).

It does not seem to generate the different plots when I run the code.

Also the last added code was from the book but it shows error.

Thank you for the help in advance. (My English also is not good.)
 

restart

with(stats)

with(plots)

RandWalk := proc (N, p, q, sa, sb, M) local A, B, r, PA, PC, PB, state, step, path; A := -N; B := N; r := 1-p-q; PA := empirical[0., sa, 1-sa]; PC := empirical[q, r, p]; PB := empirical[1-sb, sb, 0.]; state := 0; path := state; to M do if A < state and state < B then step := trunc(stats[random, PC](1))-2 elif state = A then step := trunc(stats[random, PA](1))-2 elif state = B then step := trunc(stats[random, PB](1))-2 end if; state := state+step; path := path, state end do; plots[pointplot]([seq([i, path[i]], i = 1 .. nops([path]))], axes = BOXED) end proc

RandWalk(3, .5, .5, .8, .8, 20)

 

plots[display]([seq(RandomWalk(10, .45, .5, .8, 300), k = 1 .. 4)], insequence = true); plots[display](%)

Error, (in plots:-display) cannot make plot structure from object with name RandomWalk

 

 

``


 

Download randomWalk.mw
 

restart

with(stats)

with(plots)

RandWalk := proc (N, p, q, sa, sb, M) local A, B, r, PA, PC, PB, state, step, path; A := -N; B := N; r := 1-p-q; PA := empirical[0., sa, 1-sa]; PC := empirical[q, r, p]; PB := empirical[1-sb, sb, 0.]; state := 0; path := state; to M do if A < state and state < B then step := trunc(stats[random, PC](1))-2 elif state = A then step := trunc(stats[random, PA](1))-2 elif state = B then step := trunc(stats[random, PB](1))-2 end if; state := state+step; path := path, state end do; plots[pointplot]([seq([i, path[i]], i = 1 .. nops([path]))], axes = BOXED) end proc

RandWalk(3, .5, .5, .8, .8, 20)

 

plots[display]([seq(RandomWalk(10, .45, .5, .8, 300), k = 1 .. 4)], insequence = true); plots[display](%)

Error, (in plots:-display) cannot make plot structure from object with name RandomWalk

 

 

``


 

Download randomWalk.mw

 


Could you help me?

restart

with(stats)

with(plots)

"RandWalk :=proc(N,p,q,sa,sb,M)  local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

Error, unterminated procedure

"RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

 

``


 

Download randomWalk.mw
 

restart

with(stats)

with(plots)

"RandWalk :=proc(N,p,q,sa,sb,M)  local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

Error, unterminated procedure

"RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

 

``


 

Download randomWalk.mw

 

restart; with(stats); with(plots); RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path: A:=-N: B:=N: r:=1-p-q: PA:=empirical[0.,sa,1-sa]: PC:= empirical[q,r,p]: PB := empirical[1-sb,sb,0.]: state:=0: path:=state: from 1 to M do if (A< state and state

with(LinearAlgebra):
assign(seq(U || i = `<,>`(x[i], y[i]), i = 1 .. 3));
U || 4 := U || 1; r := (1/6)*sqrt(3);
assign(seq(V || i = (U || i+U || (i+1))*(1/2)+(`<,>`(`<|>`(0, 1), `<|>`(-1, 0)) . (U || (i+1)-U || i))*r, i = 1 .. 3)); Norm(V || 3-V || 1, 2); is(Norm(V || 3-V || 1, 2) = Norm(V || 3-V || 2, 2)); is(Norm(V || 2-V || 1, 2) = Norm(V || 3-V || 2, 2));

Starting from 3 points of a base, then got 3 lines equations.

If having 3 lines equations of a cone surface, how to find the surface equation of a cone?

 

I find many tools about differential 

i had some differential ideal

how to use these tools to research what application can be applied with differential ideals I discovered?

Given a list of numeric value lists, calculate the average of each sub-data list

### I am writing a code for an Optimal control using pontryagins maximum principle. I have supplied all neccessary boundary conditions yet it fails to detect one of the conditions. It gives an error message whenever I run it.

I need guidance. Thank you

 

restart;
with(plots);
r := 3; r[1] := 3; k := 10; a := 0.2e-1; b := 0.1e-1; c := 0.1e-1; beta := 0.3e-1; alpha := 0.3e-1; m := 0.5e-1;
z := 40; q := 5; p := 100; T := 3;
sigma := 0.1e-1; k[1] := 10; rho := 0.5e-1;

u[1] := min(max(0, z), 1); z := (a*m*k*lambda[2](t)*x(t)*y(t)-lambda[1](t)*r*(1+b*x(t)+c*y(t))*x(t)*x(t))/(z*k*(1+b*x(t)+c*y(t))); u[2] := min(max(0, q), 1); q := -lambda[1](t)*beta*x(t)*s(t)/q; u[3] := min(max(0, p), 1); p := -(r[1]*lambda[3](t)*s(t)*s(t))/(p*k[1]);
NULL;
sys := diff(x(t), t) = r*x(t)*(1-(1-u[1])*x(t)/k)-a*m*x(t)*y(t)/(1+b*x(t)+c*y(t))-beta*(1-u[2])*x(t)*s(t), diff(y(t), t) = -alpha*y(t)+a*m*x(t)*y(t)/(1+b*x(t)+c*y(t)), diff(s(t), t) = sigma*s(t)+r[1]*s(t)*(1-(1-u[3])*s(t)/k[1])-rho*s(t)*y(t), diff(lambda[1](t), t) = -lambda[1](t)*(r-2*r*(1-u[1])*x(t)/k-a*y(t)*(1+c*y(t))/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t)))-beta*(1-u[2])*s(t))-lambda[2](t)*a*m*(1-u[1])*(1+c*y(t))*y(t)/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t))), diff(lambda[2](t), t) = -lambda[1](t)*a*x(t)*(1+b*x(t))/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t)))+lambda[2](t) . (-alpha+(a*m*(1-u[1]) . (1+b*x(t)))*x(t)/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t))))+lambda[3](t)*rho*s(t), diff(lambda[3](t), t) = lambda[1](t)*beta*(1-u[2])*x(t)-lambda[1](t)*(r[1]-2*r[1]*(1-u[3])*s(t)/k[1]-sigma-rho*y(t)), x(0) = 10, y(0) = 20, s(0) = 10, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0;
p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = .1);
Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6
p2o := odeplot(p1, [t, y(t)], 0 .. 2, numpoints = 100, labels = ["Time (months)", " "*`badbiomass""spatina"""`], labeldirections = [horizontal, vertical], style = line, color = red, axes = boxed);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution
r := 3; r[1] := 3; k := 10; a := 0.2e-1; b := 0.1e-1; c := 0.1e-1; beta := 0.3e-1; alpha := 0.3e-1; m := 0.5e-1; sigma := 0.1e-1; k[1] := 10; rho := 0.5e-1;
z := 40; q := 5; p := 100; T := 3;

 


fun := diff(x(t), t) = r*x(t)*(1-x(t)/k)-a*m*x(t)*y(t)/(1+b*x(t)+c*y(t))-beta*x(t)*s(t), diff(y(t), t) = -alpha*y(t)+a*m*x(t)*y(t)/(1+b*x(t)+c*y(t)), diff(s(t), t) = sigma*s(t)+r[1]*s(t)*(1-s(t)/k[1])-rho*s(t)*y(t), x(0) = 10, y(0) = 20, s(0) = 10;
p2 := dsolve({fun}, type = numeric);
Error, (in f) unable to store 'HFloat(10.0)*r*(1-HFloat(10.0)/k)-HFloat(3.1538461538461537)' when datatype=float[8]
p2i := odeplot(p2, [t, y(t)], 0 .. 2, numpoints = 100, labels = ["Time(months)", " bad biomass"], labeldirections = [horizontal, vertical], style = line, axes = boxed, color = blue);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution
plots[display](p2i, p2o);
Error, (in plots:-display) expecting plot structure but received: p2i

 

 

 

 

do math regex solver exist in this world?

expect to output a set of regex for pattern

and then use regex to generate condition or rules equations and then use sorting algorithm to find whether match all data

First 680 681 682 683 684 685 686 Last Page 682 of 2425