Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello, i'm a newbie in maple. I need to simulate the movement of the conical pendulum.

The equations of motion  https://www.cyberforum.ru/cgi-bin/latex.cgi?\ddot{\theta }=cos\theta sin\theta {\dot{\varphi }}^2-\frac{gsin\theta}{l} and https://www.cyberforum.ru/cgi-bin/latex.cgi?\ddot{\varphi }=-\frac{2cos\theta \dot{\varphi }\dot{\theta }}{sin\theta }

I include a link to a description of the conical pendulum.http://olewitthansen.dk/Physics/Conical_pendulum.pdf

Thanks in advance! 

Hi. My name is Eugenio and I’m a Professor at the Departamento de Didáctica de las Ciencias Experimentales, Sociales y Matemáticas at the Facultad de Educación of the Universidad Complutense de Madrid (UCM) and a member of the Instituto de Matemática Interdisciplinar (IMI) of the UCM.

I have a 14-year-old son. In the beginning of the pandemic, a confinement was ordered in Spain. It is not easy to make a kid understand that we shouldn't meet our friends and relatives for some time and that we should all stay at home in the first stage. So, I developed a simplified explanation of virus propagation for kids, firstly in Scratch and later in Maple, the latter using an implementation of turtle geometry that we developed long ago and has a much better graphic resolution (E. Roanes-Lozano and E. Roanes-Macías. An Implementation of “Turtle Graphics” in Maple V. MapleTech. Special Issue, 1994, 82-85). A video (in Spanish) of the Scratch version is available from the Instituto de Matemática Interdisciplinar (IMI) web page: https://www.ucm.es/imi/other-activities

Introduction

Surely you are uncomfortable being locked up at home, so I will try to justify that, although we are all looking forward going out, it is good not to meet your friends and family with whom you do not live.

I firstly need to mention a fractal is. A fractal is a geometric object whose structure is repeated at any scale. An example in nature is Romanesco broccoli, that you perhaps have eaten (you can search for images on the Internet). You can find a simple fractal in the following image (drawn with Maple):

Notice that each branch is divided into two branches, always forming the same angle and decreasing in size in the same proportion.

We can say that the tree in the previous image is of “depth 7” because there are 7 levels of branches.

It is quite easy to create this kind of drawing with the so called “turtle geometry” (with a recursive procedure, that is, a procedure that calls itself). Perhaps you have used Scratch programming language at school (or Logo, if you are older), which graphics are based in turtle geometry.

All drawings along these pages have been created with Maple. We can easily reform the code that generated the previous tree so that it has three, four, five,… branches at each level, instead of two.

But let’s begin with a tale that explains in a much simplified way how the spread of a disease works.

- o O o -

Let's suppose that a cat returns sick to Catland suffering from a very contagious disease and he meets his friends and family, since he has missed them so much.

We do not know very well how many cats each sick cat infects in average (before the order to STAY AT HOME arrives, as cats in Catland are very obedient and obey right away). Therefore, we’ll analyze different scenarios:

  1. Each sick cat infects two other cats.
  2. Each sick cat infects three other cats.
  3. Each sick cat infects five other cats

 

1. Each Sick Cat Infects Two Cats

In all the figures that follow, the cat initially sick is in the center of the image. The infected cats are represented by a red square.

· Before everyone gets confined at home, it only takes time for that first sick cat to see his friends, but then confinement is ordered (depth 1)

As you can see, with the cat meeting his friends and family, we already have 3 sick cats.

· Before all cats confine themselves at home, the first cat meets his friends, and these in turn have time to meet their friends (depth 2)

In this case, the number of sick cats is 7.

· Before every cat is confined at home, there is time for the initially sick cat to meet his friends, for these to meet their friends, and for the latter (friends of the friends of the first sick cat) to meet their friends (depth 3).

There are already 15 sick cats...

· Depth 4: 31 sick cats.

· Depth 5: 63 sick cats.

Next we’ll see what would happen if each sick cat infected three cats, instead of two.

 

2. Every Sick Cat Infects Three Cats

· Now we speed up, as you’ve got the idea.

The first sick cat has infected three friends or family before confining himself at home. So there are 4 infected cats.

· If each of the recently infected cats in the previous figure have in turn contact with their friends and family, we move on to the following situation, with 13 sick cats:

· And if each of these 13 infected cats lives a normal life, the disease spreads even more, and we already have 40!

· At the next step we have 121 sick cats:

· And, if they keep seeing friends and family, there will be 364 sick cats (the image reminds of what is called a Sierpinski triangle):

 

4. Every Sick Cat Infects Five Cats

· In this case already at depth 2 we already have 31 sick cats.

 

5. Conclusion

This is an example of exponential growth. And the higher the number of cats infected by each sick cat, the worse the situation is.

Therefore, avoiding meeting friends and relatives that do not live with you is hard, but good for stopping the infection. So, it is hard, but I stay at home at the first stage too!

Hi,

How can I find the RMS of a function like x(t) in maple? the help is not clear

x(t) := -3.703703704*10^(-7)*(0.000111668023*cos(1000/33*sqrt(1122)*t) - 0.0001214712007*sin(1000/33*sqrt(1122)*t) - 0.0002325581396*sqrt(561)*sqrt(2)*(-0.0004467462845*sqrt(1122)*sin(1000/33*sqrt(1122)*t) + 0.0004467462845*sqrt(1122)*cos(1000/33*sqrt(1122)*t)))/((2.074226433*10^14*cos(1000/33*sqrt(1122)*t) + 2.074226433*10^14*sin(1000/33*sqrt(1122)*t))*(4.895037587*10^(-11) + 0.01685634229*(0.00001474262739*cos(1000/33*sqrt(1122)*t) + 0.00001474262739*sin(1000/33*sqrt(1122)*t))^2)^2);

Thanks,

Baharm31

 

Sorry, I have not used Maple for a long time...

I would like to know the derivative of Jy w.r.t. py1 in the following. I expect the answer to be 2 Wy6 py1-2 Wy6 py10 but I get 0. Am I not using the subscripts properly that Maple is not understanding me?


 

J__y := (1/2)[W__y1(a[c]^y-(diff(S[1](t), t, t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(`φ__S`)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2]

(1/2)[W__y1(a[c]^y-(diff(diff(S[1](t), t), t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(phi__S)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2]

(1)

diff(p[y*i](t), t) := K[yp*i](p[y*i]-p[y0*i])-K[py*i]*(diff(Jy, p[y*i]))

K[yp*i](p[y*i]-p[y0*i])-K[py*i]*(diff(Jy, p[y*i]))

(2)

Diff(J__y, p__y1)

Diff((1/2)[W__y1(a[c]^y-(diff(diff(S[1](t), t), t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(phi__S)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2], p__y1)

(3)

NULL

``


 

Download cost_function_partial_derivative.mw

f1 := 0.001;
f2 := 0.002;
c1 := 0.002;
c2 := 0.005;
w1 := 0.1;
W := 0.14;
p1 := 0.65;
p2 := 0.28;
p := 1.167;
r := 0.004;
alpha := 0.2;
ze := 0.14;
mu := 0.05;
ga := 0.01;
cp := 9.3;
Rp := 100;
sigma2 := 0;
l[1] := 3*W^2*(-1+W^2)/(4*(-1+4*W^2));
l[2] := Rp^2*w1^2*mu*ga*cp/(2*(Rp^2*w1^2*cp^2+1));
l[3] := (Rp.w1.mu.ga)/(2*(Rp^2*w1^2*cp^2+1));
l[4] := W*(-1-7*W^2+8*W^4)/(8*(-2+8*W^2));
eq1 := (-x*t+l[2]*x+l[1]*x*y^2+(3/2)*alpha*ze^2*x)^2+((1/2)*c1*x+l[3]*x)^2-(1/4)*f1^2;
eq2 := (-l[4]*y^3+l[1]*x^2*y)^2+(1/4)*y^2*c2^2-f2^2/(4*W^2);

I need to solve these two equation for the variable x and y in terms of  t because I want to plot x with a range for t 

and the same plot y with a range for t and if it is possible to plot x vs y for the previuos same range for t

ode.mw

I found an assignment question concerning an ODE from 20 years ago. This was before I had discovered Maple.

So I put it through Maple and got a complex solution, But the lecturer's solution was non-imaginary.

For a) gamma <> Beta and b) gamma = beta.

Actually for b) I couldn't follow his solution

 

Consider

restart;
L := [1,2,3,4];
x[j];
seq(%, x[j] in L);
x[j];

What would you expect the output of the last line to be?

Answer:   Maple says 4.   Why?

 

We have just released an update to Maple, Maple 2020.1.

Maple 2020.1 includes corrections and improvement to the mathematics engine, export to PDF, MATLAB connectivity, support for Ubuntu 20.04, and more.  We recommend that all Maple 2020 users install these updates.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2020.1 download page, where you can also find more details.

In particular, please note that this update includes a fix to the SMTLIB problem reported on MaplePrimes. Thanks for the feedback!

Hi, 

In Maple it's possible to say that some quantity x has a value of 1 and that its unit is the meter (for instance).
But is it possible to say that x is a quantity whose fundamental unit is the 'length' (or any other fundamental unit, I insist on this point: I don't want to use derived units such as 'force', 'speed', ...)?

I think that the Units package doesn't allow to do this (or maybe I didn't figure out how).

Do you have any suggestions about that?

TIA


This is my notebook

 

restart

with(DifferentialGeometry)

DGsetup([t, rho, theta, phi, `#mover(mi("&theta;",fontstyle = "normal"),mo("&uminus0;"))`, `#mover(mi("&phi;",fontstyle = "normal"),mo("&uminus0;"))`, `#mover(mi("&theta;",fontstyle = "normal"),mo("&tilde;"))`, `#mover(mi("&phi;",fontstyle = "normal"),mo("&tilde;"))`], M)

M > 

``

M > 

evalDG(`&w`(dt, `d&rho;`))

_DG([["form", M, 1], [[[1], `d&rho;`]]])

(1)
M > 

evalDG(`&s`(dt, `d&rho;`))

_DG([["tensor", M, [["cov_bas"], []]], [[[1], `d&rho;`]]])

(2)
M > 

 

 

 

``

I don't understand why computing the wedge product of two differential forms gives me an output which prints the product of both. Why  don't it just return d rho ^ dt?

Hi Everyone, So i have a pretty ugly function which i am interesting in plotting. When i plot it seems that all values are real however when i do evalf with specific values of variable i am plotting over it shows that it is complex. Any thoughts on how to get it to stop plotting once it becomes complex? See attached maple file.

ComplexPlotQuestion.mw

Thanks. 

Monte Carlo integration uses random sampling unlike classical techniques like the trapezoidal or Simpson's rule in evaluating the integration numerically.

restart; ff := proc (rho, phi) return exp(rho*cos(phi))*rho end proc; aa := 0; bb := 1; cc := 0; dd := 2*Pi; alfa := 5; nrun := 15000; sum1 := 0; sum2 := 0; X := Statistics:-RandomVariable(Uniform(0, 1)); SX := Statistics:-Sample(X); for ii to nrun do u1 := SX(1)[1]; u2 := SX(1)[1]; xx1 := aa+(bb-aa)*u1; xx2 := cc+(dd-cc)*u2; xx3 := (bb-aa)*(1-u1); xx4 := (dd-cc)*(1-u2); sum1 := sum1+evalf(ff(xx1, xx2)); sum2 := sum2+evalf(ff(xx1, xx2))+evalf(ff(xx1, xx4))+evalf(ff(xx3, xx2))+evalf(ff(xx3, xx4)) end do; area1 := (bb-aa)*(dd-cc)*sum1/nrun; area2 := (bb-aa)*(dd-cc)*sum2/(4*nrun); area2

HFloat(3.5442090450428574)

(1)

evalf(Int(exp(rho*cos(phi))*rho, rho = 0 .. 1, phi = 0 .. 2*Pi))

3.550999378

(2)

NULL


 

Download MONTE_CARLO_INTEGRATION1.mw

 

 

1. Plot the solid that lies between the cone z=(x^2+y^2)^(1/2) and the plane z = 4.

2. Plot the solid that lies above the cone z=(x^2+y^2)^(1/2)  and below the sphere z=x^2+y^2+z^2.

3. Plot the solid that is inside the hemisphere z=sqrt(25-x^2-y^2) , outside the cylinder x^2+y^2 = 4 and above the plane xy − plane.

4. Plot the solid bounded by the hemisphere z=sqrt(16-x^2-y^2)and the paraboloid z=x^2+y^2.

5. Plot the solid that lies within the sphere x^2+y^2_z^2=4 , above the xy − plane and below the cone z=sqrt(x^2+y^2).

 

This proc is valid, yet Maple mint thinks there is syntax error

foo:= proc(x)
local z := "";
    if not x in ["A","B"] then
        return;
    fi;

    z:=cat("A
            B");    
end proc;

mint t.mpl gives

on line     7:     z:=cat("A
                          ^ Syntax error
A "then" was found without a previous matching "if".
An "end" may be needed to close the "in" construct from line 3.

But these two below procs below it gives no syntax error

foo:= proc(x)
local z := "";
    if not x in ["A","B"] then
        return;
    fi;  
end proc;

And

foo:= proc(x)
local z := "";
    z:=cat("A
            B");    
end proc;

No syntax error on either one. the syntax error only shows up when combining them. 

What does if not x in ["A","B"] then  have to do with the cat  below it? And why when they are combined, the syntax error shows?

I know of workaround, such as changing the cat to  z:=cat("A\nB");     or keep the strings on two lines, but do it like this

    z:=cat("A\n
           B");

Or write it like this

   z:=cat("A "
           "B"); 

But none of these changes were needed before adding the not x in ["A","B"]  before.

Is this a bug in mint? Is there a work around so the first example above still works using 

    z:=cat("A
            B");   

?

Hi,

I didn't use Maple before, I want to use it in this problem 

How to get the displacement equation of the longitudinal vibration of rod (bar) when the boundary and initial conditions are 

First 414 415 416 417 418 419 420 Last Page 416 of 2097