Kitonum

21445 Reputation

26 Badges

17 years, 46 days

MaplePrimes Activity


These are answers submitted by Kitonum

An example for lists:

M:=[seq(i^2, i=1..20)]:  # list 1

N:=[seq(i^3, i=1..20)]:  # list 2

plot(M,N);  # or

plot(M,N, style=point);

 

The same example for vectors:

M:=Vector(20, x->x^2):

N:=Vector(20, x->x^3):

plot(M,N);  # or

plot(M,N, style=point);

All the types of arrows you can see in the help on  DEtools[DEplot].

For example:

DETools[phaseportrait]([D(x)(t)=-0.4*x(t)+(0.5+4*x(t))*y(t),D(y)(t)=0.4*x(t)-(4.5+4*x(t))*y(t)],[x(t),y(t)], t=0..100, [[x(0)=1,y(0)=0.0]], x=0..1,y=0..0.1, stepsize=0.01, scaling=UNCONSTRAINED, linecolour=BLACK, dirgrid=[17,17], linestyle=1, arrows=mediumfill, axes=BOXED);

                               

 

 

 

If we assume that the parameters  r  and  theta  are real numbers,  evalc  command calculates the initial expression to the complex number written in algebraic form:

sqrt(1-r^2/exp(2*I/theta));

simplify(evalc(%));

      

 

 

 Edited  (correction):

simplify(evalc(sqrt(1-r^2*exp(2*I*theta))));

                                               

 

 

This is not the error but a warning:

restart:

with(plots):

Digits:=35:

ini1:=D(x)(0)=0, x(0)=1:

dsys:=diff(x(t),t,t)+(x(t)-2)*diff(x(t),t)+5*x(t)=0;

dsol1 :=dsolve({dsys,ini1}, numeric, abserr=1e-9, relerr=1e-8, maxfun=0);

plots:-odeplot(dsol1, [x(t), diff(x(t),t)], t=0..2, axes=boxed, color=black, linestyle=1, tickmarks=[6, 6], axes=boxed, titlefont=[SYMBOL,12]);   # The plot  x'(t) against  x(t)

 

 

 

 

The issue is the appearance of multiple roots. See

solve((x+y+z)^2=0, z);

                                   -x-y,  -x-y

 

A workaround:

plot3d(solve((x+y+z)^2=0, z, dropmultiplicity = true), x=-100..100, y=-100..100);

                              

 

 

 

A:=(cos(sqrt(2)*t)-cos(omega*t))/(omega^2-2);

``(1/denom(A))*numer(A);

                               

 

 

 

For better visibility animation done in 2D. It is easy to rewrite in 3D by using circular symmetry about Ox-axis.

A := plot([-1, 1], x = -10 .. 10, filled, color = "Yellow"):

B := plots[animate](plot, [[2*r*cos(phi)/Pi, 2*arcsin(sin(r*sin(phi)))/Pi, phi = 0 .. 2*Pi], thickness = 3, color = blue, scaling = constrained], r = 0 .. 5*Pi, frames = 100):

plots[display](A, B);

 Addition - animation in 3D:

A := plot3d([x,cos(t),sin(t)], x = -10 .. 10, t=0..2*Pi, style=surface, color = "Yellow", transparency=0.75):

B := plots[animate](plot3d, [[2*r*cos(phi)/Pi, 2*arcsin(sin(r*sin(phi)))/Pi*cos(t), 2*arcsin(sin(r*sin(phi)))/Pi*sin(t)],phi = 0 .. 2*Pi, t=0..2*Pi, style=surface,color = "Niagara Azure", scaling=constrained, numpoints=10000], r = 0 .. 5*Pi, frames = 100):

plots[display](A, B, axes=none);

 

 

 

 

Better quality of plotting without additional option  grid  enables the use of spherical coordinates.

Compare:

restart;

A:=plots[implicitplot3d](x^2+y^2+z^2-2^2, x = -2 .. 2, y = -2 .. 2, z = -2 .. 2, style = surface, axes = normal, view = [(-2.7 .. 2.7)$3],  grid = [30, 30, 30]):

B:=plot3d([2*cos(s)*sin(t), 2*sin(s)*sin(t), 2*cos(t)], s=0..2*Pi, t=0..Pi, style=surface):

plots[display](<A | B>, axes = normal, view = [(-2.7 .. 2.7)$3]);

    

 

 

 

Use multiple assignments as in the example below:

a, b := solve(x^2-1=0);

a;

b;

                                     

 

 

 

Another way:

plots:-display( plot3d(exp(x*y), x= 0..1, y= 0..1),   plots:-intersectplot(y=exp(x), z=0, x= 0..1,

y=0..exp(1), z=0..exp(1), color= red, thickness= 2, axes=normal));

restart;

p := proc()

local A, B, D, m, n, k, r;

A := Matrix([[0, 1, 0, 0, 0], [1, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0]]);

  r := LinearAlgebra:-RowDimension(A);

  D := Matrix(r); 

   for k from 1 to r-1 do

     B := A^k; 

       for m from 1 to r do

           for n from 1 to r do

               if m <> n and B[m,n] <> 0 and D[m,n] = 0 then D[m, n] := k;

               end if;

           end do;

        end do;

   end do;

   D;

end proc:

 

p();

                                       

 

 

 

Tools->Options->Interface->Default zoom


E := [[3, 5], [6, 7, 9, 12]]:

[[[3, 8], [5, 10], [6, 1], [7, 2], [9, 4], [12, 11]], [[3, 8], [5, 10], [6, 1], [7, 2], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 1], [7, 4], [9, 2], [12, 11]], [[3, 8], [5, 10], [6, 1], [7, 4], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 1], [7, 11], [9, 2], [12, 4]], [[3, 8], [5, 10], [6, 1], [7, 11], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 2], [7, 1], [9, 4], [12, 11]], [[3, 8], [5, 10], [6, 2], [7, 1], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 2], [7, 4], [9, 1], [12, 11]], [[3, 8], [5, 10], [6, 2], [7, 4], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 2], [7, 11], [9, 1], [12, 4]], [[3, 8], [5, 10], [6, 2], [7, 11], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 1], [9, 2], [12, 11]], [[3, 8], [5, 10], [6, 4], [7, 1], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 4], [7, 2], [9, 1], [12, 11]], [[3, 8], [5, 10], [6, 4], [7, 2], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 11], [9, 1], [12, 2]], [[3, 8], [5, 10], [6, 4], [7, 11], [9, 2], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 1], [9, 2], [12, 4]], [[3, 8], [5, 10], [6, 11], [7, 1], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 11], [7, 2], [9, 1], [12, 4]], [[3, 8], [5, 10], [6, 11], [7, 2], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 4], [9, 1], [12, 2]], [[3, 8], [5, 10], [6, 11], [7, 4], [9, 2], [12, 1]], [[3, 10], [5, 8], [6, 1], [7, 2], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 2], [9, 11], [12, 4]], [[3, 10], [5, 8], [6, 1], [7, 4], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 4], [9, 11], [12, 2]], [[3, 10], [5, 8], [6, 1], [7, 11], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 1], [7, 11], [9, 4], [12, 2]], [[3, 10], [5, 8], [6, 2], [7, 1], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 1], [9, 11], [12, 4]], [[3, 10], [5, 8], [6, 2], [7, 4], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 4], [9, 11], [12, 1]], [[3, 10], [5, 8], [6, 2], [7, 11], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 2], [7, 11], [9, 4], [12, 1]], [[3, 10], [5, 8], [6, 4], [7, 1], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 1], [9, 11], [12, 2]], [[3, 10], [5, 8], [6, 4], [7, 2], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 2], [9, 11], [12, 1]], [[3, 10], [5, 8], [6, 4], [7, 11], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 4], [7, 11], [9, 2], [12, 1]], [[3, 10], [5, 8], [6, 11], [7, 1], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 1], [9, 4], [12, 2]], [[3, 10], [5, 8], [6, 11], [7, 2], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 2], [9, 4], [12, 1]], [[3, 10], [5, 8], [6, 11], [7, 4], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 11], [7, 4], [9, 2], [12, 1]]]

(1)

``


Download P.mw






 

 

 

In Maple you can use  seq  command.

Example:

<seq(1..10)>;  # This is a column vector

                                      

 

 or

<($ 1..10)>;

May be  GraphTheory[GetVertexPositions]  and   GraphTheory[Edges]  commands help you. The first command returns the coordinates of all vertices of a graph, and the second one returns the set of edges.

First 185 186 187 188 189 190 191 Last Page 187 of 289