MaplePrimes Questions

Hi,

I'm trying to change with a Maple Worksheet the parameters of a MapleSim Model in Real-matrices format.

is there any way to do that?

actually i get the failure note:

<<Error, (in SetParameters) non-vectorized values in vector parameters: [list= ""]>>



 

Thank You

Regards
Johann
 

I have the Ubuntu of Linux app installed in Windows 10. Could anyone help me with exactly how to install Maple2020.0LinuxX64Installer.run in the Ubuntu terminal? Many thanks.

Dear maple users,

Greetings

How to eval a function as a sequence of x(x=0..1)

f := unapply(3*x^2-2*x^3-1.080674649*x^2*(x-1)^2-.8118769171*x^2*(x-1)^3+.4147046974*x^2*(x-1)^4+.4585681954*x^2*(x-1)^5, x);
ma := seq(eval(f(x), x = 0 .. 1))

May be a question is simple, but I'm beginner in Maple and I didn't find answer in Internet. I defined two functions: f(x,y)=sin(x)*cos(y) and g(x,y)=sin(y)*cos(x). How can I calculate third function v(x,y)=f(x,y)-g(x,y)? Answer of this operation should be: v(x,y)=sin(x-y).

I am tried to solve the following problem. here is the code and boundary conditions as well as parameters used in the problem. Please help me to get the numerical solution and getting plots between Cu and eta as well as D(f)(eta) vs eta.

restart;
Digits := trunc(evalhf(Digits));
                               15
ODEs := [diff(f(eta), `$`(eta, 3))+A^2+f(eta)*(diff(f(eta), `$`(eta, 2)))-(diff(f(eta), eta))^2+beta*((diff(g(eta), eta))^2-g(eta)*(diff(g(eta), `$`(eta, 2)))-1), lambda*(diff(g(eta), `$`(eta, 3)))+(diff(g(eta), `$`(eta, 2)))*f(eta)-g(eta)*(diff(f(eta), `$`(eta, 2)))];
`<,>`(ODEs[]);
           Vector[column](%id = 18446744073898822582)
LB, UB := 0, 1;
BCs := [`~`[`=`](([D(f), f, g, (D@@2)(g)])(LB), [1+B1*((D@@2)(f))(0), 0, 0, 0])[], `~`[`=`](([D(f), D(g)])(UB), [A, 0])[]];
     [D(f)(0) = 1 + B1 @@(D, 2)(f)(0), f(0) = 0, g(0) = 0, 

       @@(D, 2)(g)(0) = 0, D(f)(1) = A, D(g)(1) = 0]
Params := Record(A = .9, B1 = .5, beta = .5, lambda = .5);
NBVs := [-((D@@2)(f))(1) = `C*__f`];
Cf := `C*__f`;
Solve := module () local nbvs_rhs, Sol, ModuleApply, AccumData, ModuleLoad; export SavedData, Pos, Init;  nbvs_rhs := `~`[rhs](:-NBVs); ModuleApply := subs(_Sys = {:-BCs[], :-NBVs[], :-ODEs[]}, proc ({ A::realcons := Params:-A, B1::realcons := Params:-B1, beta::realcons := Params:-beta, lambda::realcons := Params:-lambda }) Sol := dsolve(_Sys, _rest, numeric); AccumData(Sol, {_options}); Sol end proc); AccumData := proc (Sol::{Matrix, procedure, list({name, function} = procedure)}, params::(set(name = realcons))) local n, nbvs; if Sol::Matrix then nbvs := seq(n = Sol[2, 1][1, Pos(n)], n = nbvs_rhs) else nbvs := `~`[`=`](nbvs_rhs, eval(nbvs_rhs, Sol(:-LB)))[] end if; SavedData[params] := Record[packed](params[], nbvs) end proc; ModuleLoad := eval(Init); Init := proc () Pos := proc (n::name) local p; option remember; member(n, Sol[1, 1], 'p'); p end proc; SavedData := table(); return  end proc; ModuleLoad() end module;
colseq := [red, green, blue, brown];
Pc := B1 = .5, A = .1, beta = .5;
Ps := [B1 = .5, A = .1, beta = .5];
Pv := [lambda = [.5, 1, 1.5, 2]];
for i to nops(Ps) do plots:-display([seq(plots:-odeplot(Solve(lhs(Pv[i]) = rhs(Pv[i])[j], Ps[i][], Pc), [eta, theta(eta)], 'color' = colseq[j], 'legend' = [lhs(Pv[i]) = rhs(Pv[i])[j]]), j = 1 .. nops(rhs(Pv[i])))], 'axes' = 'boxed', 'gridlines' = false, 'labelfont' = ['TIMES', 'BOLDOBLIQUE', 16], 'caption' = nprintf(cat(`$`("\n%a = %4.2f, ", nops(Ps[i])-1), "%a = %4.2f\n\n"), `~`[lhs, rhs](Ps[i])[]), 'captionfont' = ['TIMES', 16]) end do;
Error, (in dsolve/numeric/process_input) invalid argument: (B1 = .5)[]

 

 

Please help me to get the graph of CU v/s eta also D(f)(eta) vs eta
 


 

restart

sigma[1] := 0.1e-5;

0.1e-5

 

3.0

 

1.1

 

0.1e-1

 

0.1e-5

 

4.0

 

0.1e-1

 

.12

 

.2

 

0.2e-1

(1)

"(&PartialD;)/(&PartialD; t) C(t, x)=`sigma__1`*((&DifferentialD;)^2)/((&DifferentialD;)^( )x^2) C(t, x)+alpha[1]*C(t, x)^(`k__1`)+alpha[1]*C(t, x)^(`k__2`)*B(t, x)^(`k__3`)-`beta__1`*C(t, x),  (&PartialD;)/(&PartialD; t) B(t, x)=`sigma__2`*((&DifferentialD;)^2)/((&DifferentialD;)^( )x^2) B(t, x)+alpha[2]*B(t, x)^(`k__3`)+alpha[2]*C(t, x)^(`k__2`)*B(t, x)^(`k__4`)-`beta__2`*B(t, x),    #`with boundary conditions`  (&PartialD;)/(&PartialD; x) C(t, 0)=0,(&PartialD;)/(&PartialD; x) C(t, 1)=0,  (&PartialD;)/(&PartialD; x) B(t, 0)=0,(&PartialD;)/(&PartialD; x) B(t, 1)=0,    #`and initial conditions`   C(0, x) = `C__o`(x) ,  B(0, x)=B[o](x), #`In this model C(0) = 13.0 and B(0) = 300 `    #`I need the numerical solutions of C and B`  #`variations of parameters like sigma`[1], sigma[2, ]beta[1], beta[2]  #thanks    "


 

Download pde_solve.mw

alpha:=1:dT:=Th-Tc:n:=1:

plot(subs(Tc=400,n*alpha*dT/2),Th=300..700);

All the units are in Kelvin but now I want to have Th on x-axis to be in Celsius.

Is this possible?

Thanks  
 

How I can determine the trace of the matrix.

My answer has a lot of differences comparing the result provided in the pdf file (end of the file).

Also, I think we should use from  EQ(4).

what is the problem?

Please help me..

Best

Doc2.pdf

1111.mw


 

restart; x__2 := beta*gamma+2*beta+delta*gamma+delta-alpha-sqrt(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)/(2*(beta+delta))

y__2 := 1-x__2

J := Matrix([[1-2*x__2-y__2, -x__2], [beta*y__2^2/x__2^2, delta-2*beta*y__2/x__2-alpha*gamma/(gamma+y__2)^2]])

 

 

                            

and y__2*(delta-beta*y__2/x__2)-alpha*y__2/(gamma+y__2) = 0``

Error, reserved word `and` unexpected

 
  NULL

 

 

NULL

TTR := Trace(J)

TTR := 1-2*x__2-y__2+delta-2*beta*y__2/x__2-alpha*gamma/(gamma+y__2)^2

-beta*gamma-2*beta-delta*gamma+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta)-2*beta*(1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))-alpha*gamma/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2

(1)

s := diff(TTR, alpha)

1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta))-2*beta*(1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))+2*beta*(1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))*(-1-(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2-gamma/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2+2*alpha*gamma*(1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^3

(2)

NULL

NULL


 

Download 1111.mw

Can Maple open a Mathematica .cdf file (computable document format)?

If so, how?

I am slightly new to maple and have the following problem... I need to draw phase portrait of nonlinear dynamical system (differential equasion: ), where function is a hysteresis loop with parameters b=2, c=1.

Solving:

Split phase plane it two areas:

A:

B:

Finally I have two differencial equasions.

1. For A area:

2. For B area:

In a textbook this phase portrait looks like:

I know how to draw phase portrait of the first differencial equasion:

restart; with(plots); with(plottools); with(DEtools):
initialset := {seq(seq([x1(0) = a, y1(0) = b], a = -2 .. 2), b = -2 .. 2)};
DE := [diff(x1(t), t) = y1(t), diff(y1(t), t) = 1-x1(t)];
phaseportrait([DE[]], [x1, y1], t = -5 .. 5, initialset, x1 = -3 .. 3, y1 = -3 .. 3, stepsize = .1, color = green, numpoints = 600, thickness = 2, linecolor = black, title = "first de");

I know how to draw phase portrait of the second differencial equasion:

restart; with(plots); with(plottools); with(DEtools):
initialset := {seq(seq([x1(0) = a, y1(0) = b], a = -2 .. 2), b = -2 .. 2)};
DE := [diff(x1(t), t) = -y1(t), diff(y1(t), t) = 1+x1(t)]
phaseportrait([DE[]], [x1, y1], t = -5 .. 5, initialset, x1 = -3 .. 3, y1 = -3 .. 3, stepsize = .1, color = green, numpoints = 600, thickness = 2, linecolor = black, title = "second de");

Unfortunately, I don`t know how to combine it in Maple...

The help for option threadsafe (on page ?option) includes this sentence: 

  • Portions of the kernel may recognize this option and allow the procedure to be called in multiple threads simultaneously.

Huh? What exactly does that mean? Isn't it already capable of being called in multiple threads simultaneously?

I understand the significance of this option for procedures to be compiled, mentioned later in the same paragraph. But is there any benefit for a non-compiled procedure that will be used in multithreaded code? If my code has numerous one-liner arrow procedures, is there any point to cluttering up my code by turning them all into procs with option threadsafe? (Y'all know how I hate cluttered code.)

 

Friends, as above in the picture,I want T to differentiate diff(x,t),taken diff(x,t) as a variable.

The answer is m*diff(x,t)+m__1/2 

Is there any way to do that? Substitute diff(x,t) with another variable and then substitute back isn't convenient.

differential_question.mw

Hello,friends.I want to know is there any maple command that can change the order of integral?I searched the Student package and the DEtools,can not find it.

for instance,there is an integral 

int(f(x,y),y=sqrt(4*x-x^2)..2*sqrt(x),x=0..4), 

it first integral y then integral x.I want the integral order be x then y. I appreciate your help!

 

How to futher simplify so that we could exact value

Dear maple users,
Greetings.
Now I'm working on a project "solving ODE with an analytical solution".

So, I need how to find a residual error. 

Here I used the Homotopy Analysis Method(HAM) to solve the ode problem.

A similar HAM problem has solved using the Mathematica BVP2.H package.

Here I have encoded a maple code for my working problem. HAM.mw

CODE:Note(N is order of ittrration)

restart; with(plots)

pr := .5; ec := .5; N := 7; re := 2; ta := .5; H := 1:

dsolve(diff(f(x), `$`(x, 4)))

Rf := x^3*(diff(f[m-1](x), x, x, x, x))-2*x^2*(diff(f[m-1](x), x, x, x))+3*x*(diff(f[m-1](x), x, x))-3*(diff(f[m-1](x), x))-re*x^2*R*(sum((diff(f[m-1-n](x), x, x, x))*(diff(f[n](x), x)), n = 0 .. m-1))-re*x*R*(sum((diff(f[m-1-n](x), x))*(diff(f[n](x), x)), n = 0 .. m-1))+re*x^2*R*(sum((diff(f[m-1-n](x), x, x, x))*f[n](x), n = 0 .. m-1))-3*re*x*R*(sum((diff(f[m-1-n](x), x, x))*f[n](x), n = 0 .. m-1))+3*re*R*(sum((diff(f[m-1-n](x), x))*f[n](x), n = 0 .. m-1))+ta*x^3*(diff(f[m-1](x), x, x))-ta*x^2*(diff(f[m-1](x), x)):

dsolve(diff(f[m](x), x, x, x, x)-CHI[m]*(diff(f[m-1](x), x, x, x, x)) = h*H*Rf, f[m](x)):

f[0](x):=3 *x^(2)-2* x^(3);

for m from 1 by 1 to N do  CHI[m]:=`if`(m>1,1,0);  f[m](x):=int(int(int(int(CHI[m]*(x^(3)* diff(f[m-1](x),x,x,x,x))+h*H*(x^(3)* diff(f[m-1](x),x,x,x,x))-2*h*H*x^(2)*diff(f[m-1](x),x,x,x)+3*h*H*x*diff(f[m-1](x),x,x)-3*h*H*diff(f[m-1](x),x)-re*h*H*x^(2)*sum(diff(f[m-1-n](x),x,x,x)*diff(f[n](x),x),n=0..m-1)-re*h*H*x*sum(diff(f[m-1-n](x),x)*diff(f[n](x),x),n=0..m-1)+re*h*H*x^(2)*sum(diff(f[m-1-n](x),x,x,x)*(f[n](x)),n=0..m-1)-3*re*x*h*H*sum(diff(f[m-1-n](x),x,x)*(f[n](x)),n=0..m-1)+3* re*h*H*sum(diff(f[m-1-n](x),x)*(f[n](x)),n=0..m-1)+ta*x^(3)*h*H*diff(f[m-1](x),x,x)-ta*x^(2)*h*H*diff(f[m-1](x),x),x),x)+_C1*x,x)+_C2*x,x)+_C3*x+_C4;  s1:=evalf(subs(x=0,f[m](x)))=0;  s2:=evalf(subs(x=0,diff(f[m](x),x)))=0;  s3:=evalf(subs(x=1,f[m](x)))=0;  s4:=evalf(subs(x=1,diff(f[m](x),x)))=0;   s:={s1,s2,s3,s4}:  f[m](x):=simplify(subs(solve(s,{_C1,_C2,_C3,_C4}),f[m](x)));  end do:

f(x):=sum(f[l](x),l=0..N):  hh:=evalf(subs(x=1,diff(f(x),x)));

plot(hh, h = -5 .. 5);

 

For Mathematica, code already exist to find a residual error for another problem(Not this) 

which is,

eq:

Bc:

Mathematica code:

waiting for users' responses.

Have a good day

First 556 557 558 559 560 561 562 Last Page 558 of 2428