7766 Reputation

17 years, 335 days

Here is how...

See if you can make sense of this.

 > restart;
 > with(plots):
 > eq := x*y^2 - x^2 - y^2;

 > p1 := plots:-contourplot(eq, x=-2..4, y=-4..4, contours=20);

 > de1 := diff(x(t),t) = subs(x=x(t), y=y(t), diff(eq, x)); de2 := diff(y(t),t) = subs(x=x(t), y=y(t), diff(eq, y));

 > ic := x(0)=2, y(0)=2;

 > dsol := dsolve({de1,de2, ic}, numeric):
 > p2 := odeplot(dsol, [x(t), y(t)], t=-0.5..0.28, color="Green", thickness=4);

 > subs(ic, [x(0),y(0)]): p3 := pointplot(%, symbol=solidcircle, symbolsize=20, color="Black"):
 > display(p1,p2,p3);

Note added later: If you look very closely, you may notice that the green curve in the diagram above is not really orthogonal to the contour lines.  That's true, and that's because the drawing is scaled/stretched differently in the x and y directions.  To get the correct picture, add scaling=constrained to the display command, as in:
display(p1,p2,p3, scaling=constrained);

BesselJ...

```num := int(x*(1-x^2)*BesselJ(0,alpha[n]*x)^2, x=0..1);
den := int(x*BesselJ(0,alpha[n]*x)^2, x=0..1);
A[n] := num/den;```

A double-pendulum...

This worksheet shows how to animate the motion of a double-pendulum.  You should be able to extend it to the case of a triple-pendulum in the obvious way.

The animation of a double-pendulum

 > restart;
 > with(plots):

Angles relative to the vertical: phi and psi

Masses: m[1] and m[2]

Gravitational acceleration: g

Differential equations of motion: de1 and de2

 > de1 := -g*m[2]*b*sin(psi(t)) - m[2]*(a*diff(phi(t), t, t)*cos(phi(t)) - a*diff(phi(t), t)^2*sin(phi(t)) + b*diff(psi(t), t, t)*cos(psi(t)) - b*diff(psi(t), t)^2*sin(psi(t)))*b*cos(psi(t)) + m[2]*(-a*diff(phi(t), t, t)*sin(phi(t)) - a*diff(phi(t), t)^2*cos(phi(t)) - b*diff(psi(t), t, t)*sin(psi(t)) - b*diff(psi(t), t)^2*cos(psi(t)))*b*sin(psi(t));

 > de2 := -g*m[1]*a*sin(phi(t)) - g*m[2]*a*sin(phi(t)) - m[1]*a^2*diff(phi(t), t, t)*cos(phi(t))^2 - m[1]*a^2*diff(phi(t), t, t)*sin(phi(t))^2 - m[2]*(a*diff(phi(t), t, t)*cos(phi(t)) - a*diff(phi(t), t)^2*sin(phi(t)) + b*diff(psi(t), t, t)*cos(psi(t)) - b*diff(psi(t), t)^2*sin(psi(t)))*a*cos(phi(t)) + m[2]*(-a*diff(phi(t), t, t)*sin(phi(t)) - a*diff(phi(t), t)^2*cos(phi(t)) - b*diff(psi(t), t, t)*sin(psi(t)) - b*diff(psi(t), t)^2*cos(psi(t)))*a*sin(phi(t));

 > params := m[1] = 1, m[2] = 1, a = 1, b = 1, g = 1;

 > ic := phi(0)=Pi/2, psi(0)=Pi/2, D(phi)(0)=0, D(psi)(0)=0;

 > subs(params, {de1,de2,ic}): dsol := dsolve(%, numeric, output=operator);

 > my_phi := subs(dsol, phi);

 > my_psi := subs(dsol, psi);

 > frame := proc(t)         local P1, P2;         a * < sin(my_phi(t)), - cos(my_phi(t)) >;         P1 := subs(params, %);         P1 + b * < sin(my_psi(t)), - cos(my_psi(t)) >;         P2 := subs(params, %);         display(                 pointplot([ <0,0>, P1, P2 ], connect),                 pointplot(<0,0>, symbol=soliddiamond, symbolsize=30, color=black),                 pointplot(P1, symbol=solidcircle, symbolsize=30, color=red),                 pointplot(P2, symbol=solidcircle, symbolsize=30, color=blue)         ); end proc:
 > animate(frame, [t], t=0..60, scaling=constrained, frames=200, tickmarks=[0,0]);

 >

Maybe this?...

I can't tell which graphics format you wish to export to.  Let's say it's the PNG format.  Will this do?

```restart;
p := plot(x^2, x=-1..1);
plotsetup(png, plotoutput = `/tmp/plot.png`, plotoptions = `portrait, noborder, width=1000, height=500`);
p;
plotsetup(default);```

Linear transformation...

Here is one way of doing it.  This may need adjustments in various ways depending on your specific application.

 > restart;
 > z := alpha__1*x^2*y + alpha__2*x^4*t + alpha__3*t*y;

 > T := proc(e)         local c, C, i;         if type(e, monomial) then return 'procname'(e) end if;         C := coeffs(e,x,c);         add( C[i]*'procname'(c[i]), i=1..nops([c])); end proc:
 > T(z);

Remark: It's possible to replace the add(...) line in the proc with the shorter but more cryptic

Here is how...

I see that you enter angles in degree units.  Maple expects angles to be entered in the
radian units which is the natural unit for measuring angles.  To convert from degrees

Here are the numerator and denominator of the fraction in your screenshot:

 > num := polar(230,0); den := polar(92,53.13*Pi/180);

Then the fraction evaluates to

 > F := num/den;

That simplifies to

 > ans := simplify(F);

The two parts of the answer may be extracted through

 > abs(ans);

 > argument(ans);

To get the resulting angle in degrees, mutiply by 180/Pi:

 > 180/Pi*argument(ans);

 >

Use functions!...

You have

`fun := piecewise(x+y > 1, (x+y)^2, x-y);`

It seems to me that you call that object fun because you are thinking of it as a function.  Maple, however, does not recognize that as a function.  It sees it just as an expression in x and y.  To define fun as a function, do:

`fun := (x,y) -> piecewise(x+y > 1, (x+y)^2, x-y);`

After doing that, you may replace the very ugly eval(5*fun, {:-x=x, :-y=y} with the very obvious 5*fun(x,y).

As to your problem with "cannot determine if this expression is true or false: 2 < z", in your proc change if x > y to if is(x > y).

Here is the modified code.

 > restart;
 > fun := (x,y) -> piecewise(x+y > 1, (x+y)^2, x-y); temp_proc := proc(x, y)         local out, ind:         ind := 9:         if is(x > y) then ind := 1 else ind := 0 end if;         if ind = 1 then out := 5*fun(x,y) else out := -5*fun(x,y) end if:         return(out); end proc:

 > xt := z; yt := 2;

 > out1_fin := temp_proc(xt, yt);

 > plot(out1_fin, z=-2..3);

Make f into a function...

Things will work as you expect if you define fun as a function:

`fun := (x,y) -> x^2+y^2;`

Then within the proc, replace all fun with fun(x,y).  No other changes are necessary.

Why do you expect a^(3/2) to be the only...

Why do you expect a^(2/3) to be the only solution?  Suppose a = -1.  Then we have

 > restart;
 > eq := x^(3/2) = -1;

 > sol := solve(eq);

 > simplify(subs(x=sol[1], eq));

 > simplify(subs(x=sol[2], eq));

If you are specifying the x-range as x=a..b,  then you want to include the point with coordinates (a,0) in your graph.  So something like this should work:

```with(plots):
display(
plot(10 + sin(x), x=3*Pi..4*Pi),
pointplot([3*Pi,0], symbol=point)
);
```

PDF graphics...

Maple's native export to PDF is useless since it embeds the exported drawing within a letter-size (i.e., 8.5in by 11in) document.

Maple's export as EPS (Encapsulated PostScript) works fine with line drawings such as that you have shown.  Save your graphics as EPS and then apply a conversion utility, outside of Maple, to the saved file to produce the PDF equivalent.

There are many such conversions utilities available for free.  The choice depends on your operating system.  I use epstopdf on Linux.

PS: I might have misunderstood your question.  If by "3D PDF" you mean a PDF document meant to be viewed with the help of 3D glasses, then my answer is totally irrelevant.  Ignore it.

Perhaps a typo?...

Your function F is negative near phi=0 as we see in the graph below.  Then 1/sqrt(F) is complex and therefore your x is complex.  Is that what you expect?  If not, be sure that you have entered F correctly.

 > restart;
 > F:= phi -> 3.924999 - 0.024999/sqrt(1 - 2*phi) - 3.900/(1 - phi/6)^(3/2) - 1.648094618*10^(-14)*sqrt(3)*sqrt(1836)*(((1.3972 + sqrt(3)*sqrt(1836))^2 + 3672*phi)^(3/2) - (1.3972 + sqrt(3)*sqrt(1836))^3 - ((1.3972 - sqrt(3)*sqrt(1836))^2 + 3672*phi)^(3/2) + ((1.3972 - sqrt(3)*sqrt(1836))^2)^(3/2))-(1/18)*(sqrt(3)*sqrt(300)*(((1.4472 + sqrt(3)*sqrt(300)/300)^2 - 2*phi)^(3/2) - (1.4472 + sqrt(3)*sqrt(300)/300)^3 - ((1.4472 - sqrt(3)*sqrt(300)/300)^2 - 2*phi)^(3/2) + (1.4472 - sqrt(3)*sqrt(300)/300)^3));

 > plot(F(phi), phi=-1..1);

Integration...

 > restart;

We wish to evaluate

 > Int(abs(sin(x^4))/(sqrt(x) + x^2), x=0..infinity);

The change of variable  converts the integral to

 > Int(abs(sin(u))/((u^(1/8) + u^(1/2))*(4*u^(3/4))), u=0..infinity);

The integrand is  as therefore the integral converges, albeit slowly.

This is what the integrand looks like:

 > plot(abs(sin(u))/(4*(u^(1/8) + sqrt(u))*u^(3/4)), u=0..10*Pi);

The  factor is -periodic. Accordingly, we split the integration into a sum of

integrations over intervals of length :

 > J := n -> int(abs(sin(u))/((u^(1/8) + u^(1/2))*(4*u^(3/4))),         u = n*Pi .. (n+1)*Pi, numeric );

 > J(0), J(1), J(2), J(3), J(1000);

Here is the result:

Take more terms for greater accuracy.

 >

Aside: I attempted to do the change of variables through Maple's IntegrationTools:-Change

but the result was wrong.  Perhaps a bug?

 > Int(abs(sin(x^4))/(sqrt(x) + x^2), x=0..infinity); IntegrationTools:-Change(%, x=u^(1/4));

 >

Try this...

Try this (and also read the help page on plot,options).

```plots:-display(
plot(x^2, x=-1..1,   linestyle=dot),
plot(x^2+1, x=-1..1, linestyle=spacedash),
plot(x^2+2, x=-1..1, linestyle=dashdot),
thickness=3);
```

Remove the quotes...

The construction `A=70` (with the back-quotes) builds a name consisting of those four characters, just like AB70 is a name consisting of four characters.  The equal sign has no special meaning in that name.  If instead you do

`lst := [A=70, B=17, C=27];`

(without the quotes,) then

`tt := convert(lst, table);`

will do what you want.

 1 2 3 4 5 6 7 Last Page 1 of 54
﻿