Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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

Hello everyone,

I'm studying an equation with three variables similar to the following:

x*y+z=0

Now, I would like to obtain the numeric values of x associated to (y, z) that are free to assume any integer value within the intervals [-1...5] and [0...5] respectively. Thus, I should get 42 values of x overall. The question is very similar to the one asked here: https://www.mapleprimes.com/questions/146636-How-To-Solve-An-Equation-In-Three-Variables but in my case I would like to obtain all the 42 values of x (included undefined solutions) associated to the sets (y,z), possibly arranged in a 42x3 matrix where the columns are the variables (x,y,z) and the rows the values (x,y,z) that satisfy the equation.

I started to tackle the problem using a for loop:

for y from -1 by 1 to 5 do

    for z from 0 by 1 to 5 do

        eq:= fsolve(x*y + z, x);

    end do;

end do;

eq;

 

But it returns only one value: -1.000. Any help is appreciated.

Thank you for your time.

Hello

I use Maple 20018.2.

When I use "Data Set Search" and press Search I get following Error Message. I check that the network access to the internet is on enable. Does anybody has an Idea?

thank you

Murad

Hi,

I was hoping someone can tell me if there's a better way for doing this math.

I think i was doing this wrong so i posted the full results. The answers r correct but i might be doing this the long way.

Thanks in Advance.
 

Section 1.6: Combinations of Functions

 

Example 1: - Sum Rule

"ex1f(x):= 2 x+1"

proc (x) options operator, arrow, function_assign; 2*x+1 end proc

(1)

"ex1g(x):=x^(2)+2 x-1"

proc (x) options operator, arrow, function_assign; x^2+2*x-1 end proc

(2)

ex1f(x)+ex1g(x)

x^2+4*x

(3)

eval(x^2+4*x, [x = 2])

12

(4)

 

Example 2: - Difference Rule

"ex2f(x):=2 x+1"

proc (x) options operator, arrow, function_assign; 2*x+1 end proc

(5)

"ex2g(x):=x^(2)+2 x-1"

proc (x) options operator, arrow, function_assign; x^2+2*x-1 end proc

(6)

ex2f(x)-ex2g(x)

-x^2+2

(7)

eval(-x^2+2, [x = 2])

-2

(8)

Example 3: - Product Rule

"ex3f(x):=x^(2)"

proc (x) options operator, arrow, function_assign; x^2 end proc

(9)

"ex3g(x):= x-3"

proc (x) options operator, arrow, function_assign; x-3 end proc

(10)

ex3f(x)*ex3g(x)

x^2*(x-3)

(11)

collect(x^2*(x-3), x)

x^3-3*x^2

(12)

eval(x^3-3*x^2, [x = 4])

16

(13)

Example 4: - Quotient Rule

"ex4f(x):=sqrt(x)"

proc (x) options operator, arrow, function_assign; sqrt(x) end proc

(14)

"ex4g(x):=sqrt(4-x^(2))"

proc (x) options operator, arrow, function_assign; sqrt(4-x^2) end proc

(15)

ex4f(x)/ex4g(x)

x^(1/2)/(-x^2+4)^(1/2)

(16)

 

Example 5: - Composition - Chain Rule

 

This is an example of the chain rule.

"ex5t1(x):=sqrt(x):"

"ex5t2(x):=x-1:"

Function in another function:

 

ex5t1(ex5t2(x))

(x-1)^(1/2)

(1.1)

eval((x-1)^(1/2), [x = 2])

1

(1.2)

plot((x-1)^(1/2))

 

Example 6: - Composition - Chain Rule

 

Insert*two*functions

 

"ex6f(x):=x+2:"

"ex6g(x):=4-x^(2):"

 

ex6f(ex6g(x))

-x^2+6

(2.1)

eval(-x^2+6, [x = 0])

6

(2.2)

eval(-x^2+6, [x = 1])

5

(2.3)

``

ex6g(ex6f(x))

4-(x+2)^2

(2.4)

eval(4-(x+2)^2, [x = 0])

0

(2.5)

eval(4-(x+2)^2, [x = 1])

-5

(2.6)

``

Example 7: Find Domain with Chain Rule

 

Insert two Functions:

"ex7f(x):=x^(2)-9:"

"ex7g(x):=sqrt(9-x^(2)):"

``

ex7f(ex7g(x))

-x^2

(3.1)

plot(-x^2)

 

[-3, 3]

[-3, 3]

(3.2)

``


 

Download Ch1_6_Combo_Functions.mw

z1 := a1+I*b1; z2 := a2+I*b2; abs(z1) = 1; abs(z2) = 1; argument(z1) = alpha; argument(z2) = beta; On considère dans ℂ les complexes z1 et z2 de module 1 et d'argument α et β Show that (z1+z2)^2/(z1+z2) est un réel positf ou nul. Dans quel cas est-il nul ? is((z1^2+2*z1*z2+z2^2)/(z1+z2) = z1/z2+z2/z1+2);#wrong answer z1/z2 = exp(I*(alpha-beta)); z2/z1 = exp(I*(beta-alpha)); is(z1/z2+z2/z1+2 = 2*(1+cos(alpha-beta)));#wong answer Miscalculations. Thank you for your help.

I have noticed that fieldplot3d can fail when calling a procedure that contains if statements.  It appears that fieldplot3d is attempting to evaluate the statements within the procedure, instead of simply calling the procedure with numerical values.

We are still on lockdown in the UK, and this has kept me amused for a while now.  But I have run out of ideas and could really use some help!

fieldplot3d_and_if_statements.mw

restart;

kernelopts(version);

`Maple 2020.0, X86 64 LINUX, Mar 4 2020, Build ID 1455132`

convert([1,2,3], Vector[row]);

Vector[row](3, {(1) = 1, (2) = 2, (3) = 3})

convert([1,2,3], Vector[col]);

This worksheet shows an unexpected behavior of pdsolve().  It solves the heat equation on the interval (−1,1) but fails on the interval (0,1).  I see no technical reason for this happening — it's probably due to a little bug lurking somewhere.

restart;

kernelopts(version);

`Maple 2020.0, X86 64 LINUX, Mar 4 2020, Build ID 1455132`

Physics:-Version();

`The "Physics Updates" package is not installed`

Solve the heat equation on the interval -1 < x and x < 1 and

boundary conditions u(-1, t) = 0, u(1, t) = 0.

pde := diff(u(x,t),t) = diff(u(x,t),x,x);

diff(u(x, t), t) = diff(diff(u(x, t), x), x)

bc := u(-1,t)=0, u(1,t)=0;

u(-1, t) = 0, u(1, t) = 0

ic := u(x,0) = cos(Pi/2*x);

u(x, 0) = cos((1/2)*Pi*x)

pdsol := expand(pdsolve({pde,bc,ic}));

u(x, t) = cos((1/2)*Pi*x)*exp(-(1/4)*t*Pi^2)

That's good.  Apply pdetest to verify it:

pdetest(pdsol, [pde,bc,ic]);

[0, 0, 0, 0]

Now, solve the same problem on the interval 0 < x and x < 1 and

boundary condition u__x(0, t) = 0 and u(1, t) = 0.  It should be

evident that the solution remains the same as the one calculated

above, due to symmetry, and here is the verification:

bc_new := D[1](u)(0,t)=0, u(1,t)=0;

(D[1](u))(0, t) = 0, u(1, t) = 0

pdetest(pdsol, [pde,bc_new,ic]);

[0, 0, 0, 0]

But for some reason Maple's pdsolve fails to solve the PDE.  Actually

its response is somewhat erratic -- sometimes it returns nothing at all,

and sometimes it exits with an error message.

pdsolve({pde,bc_new,ic});

 

Download pdsolve-fails.mw

 

I need to solve general linear programming problem with multi-precision support. What are my options with Maple 2020?

 

First 6 7 8 9 10 11 12 Last Page 8 of 1676