MaplePrimes Questions

Hi, 
How can I load a .m file with the big green arrow ?

TIA

If I execute a program like:

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives6.txt";
stream := cat(pathname, "\\", filename);
Y := seq(rand(1..10)(), j = 1..10);
writeto(stream);
for i from 1 to 10 do
 printf("X[ %d ]:= %d;\n", i, Y[i]);
end do;
writeto(terminal);
printf("DONE\n");

 

Maple will print exactly what I told it to print.  But when I enter

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives44.txt";
stream := cat(pathname, "\\", filename);
writeto(stream);
for i from 1 to 10 do
 Y := rand(1..10)();
 printf("X[ %d ]:= %d;\n", i, Y);
end do;
writeto(terminal);
printf("DONE\n");

 

Maple prints:

             YAssign7, [Typesetting:-mprintslash([Y := 7], [7])]

X[ 1 ]:= 7;
           YAssign10, [Typesetting:-mprintslash([Y := 10], [10])]

X[ 2 ]:= 10;
             YAssign6, [Typesetting:-mprintslash([Y := 6], [6])]

X[ 3 ]:= 6;
             YAssign2, [Typesetting:-mprintslash([Y := 2], [2])]

X[ 4 ]:= 2;
             YAssign4, [Typesetting:-mprintslash([Y := 4], [4])]

X[ 5 ]:= 4;
             YAssign6, [Typesetting:-mprintslash([Y := 6], [6])]

X[ 6 ]:= 6;
             YAssign5, [Typesetting:-mprintslash([Y := 5], [5])]

X[ 7 ]:= 5;
             YAssign1, [Typesetting:-mprintslash([Y := 1], [1])]

X[ 8 ]:= 1;
             YAssign8, [Typesetting:-mprintslash([Y := 8], [8])]

X[ 9 ]:= 8;
             YAssign5, [Typesetting:-mprintslash([Y := 5], [5])]

X[ 10 ]:= 5;
 

This must be more than a matter of calling rand when I am writing to terminal, for if I enter:

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives8.txt";
stream := cat(pathname, "\\", filename);
writeto(stream);
X := rand(0..1)():
printf("Mary had a little lamb\n");
writeto(terminal);
printf("DONE\n");

 

then all Maple prints is "Mary is a little lamb".  I have tried this on Maple 2018 and Maple 2019, with the same results.

 

Any ideas or suggestions?

Hi,

I'm having trouble converting a static plot to animated plot:

Also I've been considering using functional operators instead of expressions so that there's no reuse of variable s when drawing different curves, though I'm not sure if this will be harder to differentiate since diff(expr, s) does not work on a functional operator meaning I'd have to do unapply(diff(f(s),s),s) which seems a long route and I'm not sure if it's what I'm looking for (in terms of simplification).

 

Thanks guys

agentpath.mw

 Hello everyone!

 I want to find all solutions of  following equations :

I used Maple 2019: 

solutions:=solve([abs(1+1/3*lambda+1/18*lambda^2-1/324*lambda^3+1/1944*lambda^4)-1=0],[lambda]);
evalf(solutions)

The output is:

So we have two solutions. But when I use Matlab 2018, 
four solutions are returned.

syms lambda
eqn =abs(1+1/3*lambda+1/18*lambda^2-1/324*lambda^3+1/1944*lambda^4)-1==0;
solx1=solve(eqn, lambda) 
%%
solx1 =
 root (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 1)
 root (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 2)
 roots (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 3)
 roots (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 4)


 

solx3=solve(eqn, lambda,   'MaxDegree', 4)
double(solx3)
%%The solution is:
 -4.2681 + 0.0000i
 0.0000 + 0.0000i
 5.1340 -11.2012i
5.1340
+ 11.2012i

It is easy to check that  first two in Maple and Matlab are  same.

Who is right? Does Maple miss complex solutions?

 

 

 

 

 

 

 

 

Dear,

I need to attach CPU time to my iterations/Computations, please how do I obtain that in Maple. I tried 

a:=time () 

Iterations code

cputime:=time() -a; 

 

But the issue is that once I rerun the code, It produces different cpu time, kindly help me out here. 

 

Thank you.

First make sure that  and  are unassigned variables and then enter the Maple command

 

 

This tells Maple that  is a postive real number.  (You will see more on using "assume" later.)

 

Next, calculate the improper definite integral of

 

(8sin(x)+11cos(x))e^(−52cx)

 

for  from 0 to ∞ and assign this to the variable .  (Notice that Maple displays  as  to indicate it that an assumption has been made about .)

 

Finally calculate the limit of  times  as  tends to infinity and enter the limit in the box below.  (Enter your answer exactly using Maple syntax, not as a decimal.)

 

Can someone please help me in this? I cant really understand this.

 

1 discuss and show graphically the effects of decrease in wage on labor supply. if A, leisure is normal good. B, if leisure is inferior good.

How do I animate the cylinder width, or some variation of it as we trace it's path in the z-axes

with(plots);
with(plottools);
display([seq(cylinder([2, 2, 2], 3, i/10, capped = false), i = 1 .. 60)], insequence);

 

Hi,

I'm trying to create an agent vehicle which drives along a path of a uniform width, and finds the distance to the edge of the path directly ahead of it. Like this:

The aim is to somewhat simulate how far the agent can see down the road.

Since the thickness of a plot curve is unrelated to the units of the axis, and has no means of interacting with objects this would be no use.

I also considered shadebetween function, however this only can shade between the y values of 2 functions, so for a vertical curve it cannot produce any width to the path.

I then realised using parametric equations of form (x(t), y(t)) would likely make most sense and wrote some code which roughly gets the boundarys at a fixed distance from the centre path equation, by adding the x-y components of the reciprocal of the gradient:

For certain simple path equations such as this one, it roughly works other than the areas between which the boundary curves overlap themselves (I would need to find these points of intersection and break the curves up to remove these squigly inner bits). Any advice on this would be much appreciated cause this seems like it will be tricky, if not computationally heavy.

 

More annoyingly, due to the nature of the trig functions involved, for more complex graphs which include a vertical turning point, the left and right boundaries seem to swap over:

and

Clearly this is not the behaviour I had in mind.. and I'm not sure what I can do to fix it, I think maybe using piecewise trig may be a potential solution to avoid the jumping from + to -, though I'm not sure where I would put these breakpoints (I've tried just using abs(arctan(...)) with no luck).

 

If anyone could help wih this that would be really appreciated, or even suggest a better approach to this problem!

Thanks

 

[code] agentpath.mw

I just updated to Maple 2020

interface(version)

Standard Worksheet Interface, Maple 2020.0, Windows 10, March 4
   2020 Build ID 1455132

Physics:-Version()
         The "Physics Updates" package is not installed

My question is: For new Maple 2020 installation, should one go and install latest Physics package from the cloud, which I see is at version 619 now, or is it allready included in the new Maple 2020?

 

 

 

 

 

 

Help me to export data of 3d plot

Download export.mw

Dear,

 

Could you please help me with the following problem? 

I have a list, say, L:= [2,3,4,5]; 

and I need to find the position of several of its elements. However, when a apply the BinarySearch command I get a wrong return. For example, element >= 5:  BinarySearch(L, 5, `>=`);  

Maple returns 0

Element = 4: BinarySearch(L, 4, `=`); 

Maple returns 0

Element < 3: BinarySearch(L, 3, `<`); 

Maple returns 2. 

Obviusly, I'm doing something wrong. Could you please tell me what it is?

Many thanks for your help.

 

I am trying to get the output of the system of ODE in the mesh form. Can I set the step length for range? when I use range=0..10 it takes many values whereas I only need the values for integers between 0 and 10 inclusive.

Does anyone have any ideas on why this integral (third equation) is taking so long to solve/plot? Are there any hints on how to speed up the process?

I'm running Maple 2019.1, and it was chugging away for about 5 minutes before I pulled the plug.

If I have 2.14 & 10 or 2.14 & 20 as my plot arguments, it takes about 3 s. After 20, it just doesn't want to work.

P1:=(r,R)->(2/Pi)*(arccos(r/(2*R))-(r/(2*R))*sqrt(1-(r/(2*R))^2))

J0:=(r,shk)-> BesselJ(0, 2*Pi*r*shk);

Jhk:=(s,shk,R)-> evalf((1/s)*Int(P1(r,R)*J0(r,shk)*sin(2*Pi*r*s), r=0..2*R));

plot(Jhk(s,2.14,38), s=0..5)

I'm attempting to use Maple to study Maxwell's Equations, but as a newbie to Maple, I quickly became stuck :-)

For some context, this link shows how it is possible to accomplish this using Mathematica:

https://www.wolfram.com/mathematica/new-in-10/inactive-objects/study-maxwells-equations.html

This is how I have attempted the same in Maple:

Maxwell's Equations

NULL

Initialise

 

restart

with(Physics[Vectors])

[`&x`, `+`, `.`, ChangeBasis, ChangeCoordinates, Component, Curl, DirectionalDiff, Divergence, Gradient, Identify, Laplacian, Nabla, Norm, Setup, diff]

(1.1)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(1.2)

``

````

Maxwell's Equations

 

Maxwell_1 := Curl(E__field_(x, y, z, t)) = -(diff(B__flux_(x, y, z, t), t))

Physics:-Vectors:-Curl(E__field_(x, y, z, t)) = -(diff(B__flux_(x, y, z, t), t))

(2.1)

Maxwell_2 := Curl(H__field_(x, y, z, t)) = diff(D__flux_(x, y, z, t), t)

Physics:-Vectors:-Curl(H__field_(x, y, z, t)) = diff(D__flux_(x, y, z, t), t)

(2.2)

Maxwell_3 := Divergence(D__flux_(x, y, z, t)) = 0

Physics:-Vectors:-Divergence(D__flux_(x, y, z, t)) = 0

(2.3)

Maxwell_4 := Divergence(B__flux_(x, y, z, t)) = 0

Physics:-Vectors:-Divergence(B__flux_(x, y, z, t)) = 0

(2.4)

``

``

Constitutive Relations

 

Eq_1 := D__flux_(x, y, z, t) = epsilon*E__field_(x, y, z, t)

D__flux_(x, y, z, t) = varepsilon*E__field_(x, y, z, t)

(3.1)

Eq_2 := B__flux_(x, y, z, t) = mu*H__field_(x, y, z, t)

B__flux_(x, y, z, t) = mu*H__field_(x, y, z, t)

(3.2)

``

``

Solution

 

We need to get the Curl of H, to take the Curl of both side of Maxwell_1:

Curl(Maxwell_1)

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -Physics:-Vectors:-Curl(diff(B__flux_(x, y, z, t), t))

(4.1)

Now substitute B for H:

subs(Eq_2, %)

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -Physics:-Vectors:-Curl(diff(mu*H__field_(x, y, z, t), t))

(4.2)

OK, we manage to get Curl of H, so now we need to substitute the Curl of H with an expression in D.

subs(Maxwell_2, %)

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t))

(4.3)

Well that didn't work, so try to seperate the Curl of H so that we can substitute for D.``

collect(%, Curl(H__field_(x, y, z, t)))

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t))

(4.4)

simplify(%)

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t))

(4.5)

collect(%, Curl(H__field_(x, y, z, t)))

Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t))

(4.6)

``

``

``

SortProducts(%, [H__field_(x, y, z, t)], totheleft)

SortProducts(Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t)), [H__field_(x, y, z, t)], totheleft)

(4.7)

``

``

``

``

``

isolate(%, H__field_(x, y, z, t))

SortProducts(Physics:-Vectors:-Curl(Physics:-Vectors:-Curl(E__field_(x, y, z, t))) = -mu*Physics:-Vectors:-Curl(diff(H__field_(x, y, z, t), t)), [H__field_(x, y, z, t)], totheleft) = 0

(4.8)

``

``

``

``

``

``

NULL

NULL

``

 

I need to be able to rearrange equation 4.3 so that I can substitute for Curl of H using Maxwell_2.  Any suggestions would be gratefully received!
 

Download Maxwells_Equations.mw

First 413 414 415 416 417 418 419 Last Page 415 of 2261