Kitonum

21565 Reputation

26 Badges

17 years, 138 days

MaplePrimes Activity


These are answers submitted by Kitonum

Of course this is inferior in its capabilities to acer's method, but it is simpler:


 

restart;
plots:-display(plot(1/(x^2+1), x=-3..3, 0..1.3, color=red),plots[textplot]([2, 1, typeset("The plot of  ", y=1/(x^2+1)), font = [TIMES, BOLD, 16]], color=blue), scaling=constrained, size=[900,300]);

 


 

Download textplot.mw

solve~(5*x=~[5, 20, 50] );

                               [1, 4, 10]

restart;
m1 := Matrix([[1, 2], [3, 4]]);
m2 := Matrix([[5, 6], [7, 8]]);
'm1'.'m2' = m1.m2;
#  or
'm1'*'m2' = m1.m2;
# or
InertForm:-Parse("m1*m2"):
InertForm:-Typeset(%)=m1.m2;

Edit.

See:

l := t -> 0.5*tanh(0.5*t):
deq := diff(f(t), t)*l(t)*(diff(f(t), t, t)*l(t)+9.8*sin(f(t)))+diff(l(t), t)*(diff(f(t), t)^2*l(t)-9.8*cos(f(t))+4*(l(t)-0.5)) = 0:
eval(deq, t=0);
eval(%, f(0)=0);

                             -0.500 - 2.450 cos(f(0)) = 0
                                         -2.950 = 0

 


 

This is a well-known method. I made a cut for better visibility and chose the same scale on the axes:

f:=r->exp(-(r-3)^2*cos(4*(r-3)));
plot3d([r*cos(phi), r*sin(phi), f(r)], r=1..5, phi=Pi/3..2*Pi, scaling=constrained, axes=normal);

 

Above is the rotation around y-axis (y-xis pointing upwards).

 

Addition. Rotation around x-axis (with a cut):

restart;
f:=r->exp(-(r-3)^2*cos(4*(r-3)));
plot3d([r,f(r)*cos(phi),f(r)*sin(phi)], r=1..5, phi=Pi/2..2*Pi, style=surface, scaling=constrained, axes=normal);

 

Animation the rotation around x-axis:

restart;
f:=r->exp(-(r-3)^2*cos(4*(r-3)));
plots:-animate(plot3d,[[r,f(r)*cos(phi),f(r)*sin(phi)], r=1..5,phi=0..a, scaling=constrained, axes=normal], a=0..2*Pi, frames=90);

rotations.mw

You use the same name  B  to create different objects. List B is not used at all in the code.

Corrected code:

restart;
interface(rtablesize=50);
E:=[E1,E2,E3]:
P:=[0,1,2]:
N:=3:
for b from 1 to 12 by 5 do
F:=(i,j)->
if i=b+P[a] and j=b+P[a] then E[a]
elif i=b+P[a] and j=b+N+2+P[a] then -E[a]
elif i=b+P[a]+N+2 and j=b+P[a] then -E[a]
elif i=b+P[a]+N+2 and j=b+P[a]+N+2 then E[a]
else 0:
end if:
B[b]:=add(i,i=[seq(Matrix(20,F), a=1..3)]);
end do;
H:=[seq(B[b],b=1..12,5)];

Use  seq  command for this:

v := Vector[row]([seq(4*n, n = 1 .. 6)]);

The code will be quite simple if you do not draw a vertical line. It is also easy to depict the curve and the region in different colors:

plots:-display(
   plot(1/ra, x= 0..0.5, 0..10, color=yellow, filled),
   plot(1/ra, x= 0..1, 0..10, color=blue, thickness=2));

 

I think it will be easier to immediately specify  F  as a function:

F:=(x,y)->f(x)+g(y);
F(x,x);

View -> Show/Hide Contents 

Remove the tick from the "input"

Unfortunately Maple unlike Mathematica weakly solves the problems of an optimization symbolically (exactly). Here are two simple examples:

maximize(x^2+y^2, x=0..1, y=1);  # OK for rectangle region
maximize(x^2+y^2, x=0..1, y=1-x);  # Maple fails for triangular region

 

This example  z=(1-y^2)/(x^2), x^2 + y^2 <= 1, x>=1/2  is easily solved without Maple by hand. Consider cross-sections of the surface by planes  x=C, where  C  is constants. We have z=(1-y^2)/(C^2)=1/C^2 - 1/C^2*y^2 .  These curves are parabolas (branches down) with vertices at points  (C, 0, 1/C^2) . As   is increased, the vertices goes down, so the  maximum is 4  and it reached at the point  x=1/2, y=0 .

Visualization:

plots:-display(seq(plots:-spacecurve([x,y,(1-y^2)/(x^2)],y=-sqrt(1-x^2)..sqrt(1-x^2), color=red, labels=["x","y","z"]),x=0.5..1,0.05));

              

 

 


 

You have an equation with 3 parameters. If you specify the values of these parameters, it is easy to find all the roots.

Example:


 

restart

-(27/64)*a*sqrt(8)*V^(13/2)+Pi*((phi^2-1)*V^2+24*q^2) = 0;

-(27/32)*a*2^(1/2)*V^(13/2)+Pi*((phi^2-1)*V^2+24*q^2) = 0

(1)

a := 1; -1; phi := 2; -1; q := 3; -1; solve({-(27/32)*a*2^(1/2)*V^(13/2)+Pi*((phi^2-1)*V^2+24*q^2) = 0}, V)

{V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 1)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 2)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 3)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 4)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 11)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 12)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 13)^2}

(2)

evalf([{V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 1)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 2)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 3)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 4)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 11)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 12)^2}, {V = RootOf(9*_Z^13-16*2^(1/2)*Pi*_Z^4-1152*2^(1/2)*Pi, index = 13)^2}])

[{V = HFloat(2.6930173177051127)}, {V = HFloat(1.4685642061918163)+HFloat(2.193826936288807)*I}, {V = -HFloat(0.9051750324732223)+HFloat(2.462660047666126)*I}, {V = -HFloat(2.606164493107215)+HFloat(0.6610848483260491)*I}, {V = -HFloat(2.606164493107215)-HFloat(0.6610848483260491)*I}, {V = -HFloat(0.9051750324732223)-HFloat(2.462660047666126)*I}, {V = HFloat(1.4685642061918163)-HFloat(2.193826936288807)*I}]

(3)

NULL

NULL


 

Download mm_new.mw

All the real solutions of this equation are clearly visible on the plot (in particular, we see for u>0 and v>0 not one but an infinite number of solutions - two branches of solutions from points  (1,0)  and  (0,1)  and going to infinity) . It is possible to obtain explicit equations for these branches if we solve the equation with respect to one variable:

plots:-implicitplot(1/(u+v)^2+4*u*v-1=0, u=-3..3, v=-3..3, size=[500,500], gridrefine=5);

             

 

Sol:=solve(1/(u+v)^2+4*u*v-1=0, v);
plot(Sol[1], u=1..5);

 

Example:

A:=plot(sin(x), x=-1..4*Pi+3, color=red, thickness=2, labels=["",""]):
B:=plots:-arrow([0,-1],[0,2.2], shape=arrow,head_width=0.7,head_length=0.12):
C:=plots:-arrow([-1,0],[4*Pi+4,0], shape=arrow,head_width=0.1,head_length=0.9):
T:=plots:-textplot([[4*Pi+3,-0.1,x],[-0.9,1.1,y]], font=[times,roman,18]):
plots:-display(A,B,C,T);

                               

First 158 159 160 161 162 163 164 Last Page 160 of 290