Kitonum

21550 Reputation

26 Badges

17 years, 125 days

MaplePrimes Activity


These are answers submitted by Kitonum

There is no  evaluate  command in Maple (there is  eval  command). Removal (or expansion) of parentheses in different meanings expand command carries out.

 

Examples:

restart;

L:=[x*(x+y), (x+y)^5, sin(3*x), cos(x+y), (x+y)/z, 2^(x-y), Int(f(x)+g(x),x)]:

for l in L do

expand(l);

od;

 

 

restart;

solve({x+y-3, x^2+y^2-5}, {x, y}):

a,b:= eval([x, y], %[1])[]:

a, b;

                    2, 1

Array( [seq(plot(p, x = -Pi .. Pi, -1.4 .. 1.4, scaling = constrained), p = [sin(x), cos(x)])]);
plots[display](%);

You can just copy and paste the sign (below I put this sign in this way)

         ▪

of the Word. In the Word menu  Insert->Symbols->Other Symbols . The number of the sign in Unicode is  25AA .

 

Addition:  long to not look for this sign, you can just type in the Word  25AA , select it and then  alt+x

 

 

  

 

This  is equivalent to the union of two plots  r=-sqrt(5-4*cos(theta))  and  r=sqrt(5-4*cos(theta)) :

 

plots[polarplot]([-sqrt(5-4*cos(theta)), sqrt(5-4*cos(theta))], theta = 0 .. 2*Pi, color = red, thickness = 2);

 

 

In this example, it is more convenient to use  surd  command.  surd(a,3)  means  the cubic root in the real domain. The results are displayed in a more compact form.

Compare:

restart;

de := diff(y(x), x) = 3*abs(y(x))^(2/3);

dsolve(de);

                         

 

and

 

restart;

de := diff(y(x), x) = 3*surd(y(x)^2, 3);

dsolve(de);

                                     

 

The latter result can be more simplified to  x - y(x)^(1/3) +_C1 = 0 ,  but Maple does not want to do this.

P:=Matrix([[ 0 , .5 , .5 , 0 , 0 , 0 ], [ 1/3 , 0 , 0 , 1/3 , 1/3 , 0 ], [ 1/3 , 0 , 0 , 0 , 1/3 , 1/3 ], [ 0 , 1 , 0 , 0 , 0 , 0 ], [ 0 , .5 , .5 , 0 , 0 , 0 ], [ 0 , 0 , 1 , 0 , 0 , 0 ]]):

pii:=Vector[row]([ a , b , c , d , e , f ]):

solve({seq(pii.P[i]=pii[i], i=1..6)});

                               {a = f, b = f, c = f, d = f, e = f, f = f}

If I understand the problem, the rotation around the vertical axis.

The plotting of the curve:

plot(1-cos(theta), theta = 0 .. 2*Pi, coords = polar);

 

 

The plotting of the body (for clarity, cutted a piece of the outer surface):

r := 1-cos(theta):

plot3d([r*cos(theta)*cos(phi), r*cos(theta)*sin(phi), r*sin(theta)], theta =0  .. 2*Pi, phi = Pi/2 .. 2*Pi, scaling = constrained,  axes=normal, view=[-2.7..2.7,-2.7..2.7,-1.4..1.4], orientation=[-160,-75,180]);

 

 

The calculations  the volumes of the bodies bounded by the outer and inner surfaces:

int(Pi*(r*cos(theta))^2, theta = (1/2)*Pi .. 3*Pi*(1/2));

int(Pi*(r*cos(theta))^2, theta = -(1/2)*Pi .. (1/2)*Pi);

                              

 

This problem was solved only with the help of  plots[textplot]  command in standard worksheet. The numerator and denominator of the fraction  r  should not be too large (less than 10^9):

 

MixedNumber := proc (r::{integer, fraction})

local a, b, d1, d2;

if r::integer or abs(numer(r)) < denom(r) then

return plots:-textplot([0, .9, r], view = [-1 .. 1, -1 .. 1], font = [TIMES, ROMAN, 18], color = blue, axes = none) else

a := trunc(r); b := `if`(0 < r, r-trunc(r), trunc(r)-r); d1 := `if`(0 < a, length(a), length(a)+1); d2 := max(length(numer(b)), length(denom(b)));

plots:-textplot([[-0.034*(d1-1), 0.9, a], [0.1+0.034*(d2-1), 0.9, b]], view = [-1 .. 1, -1 .. 1], font = [TIMES, ROMAN, 18], color = blue, axes = none) end if;

end proc:

 

Two examples of the work of the procedure:

MixedNumber(17/6);

                                              

MixedNumber(-100001/9971);

                                        

 

 

Vector  v  depends on 6 parameters  A, B, k, t, x, y . The simple procedure  VecPic  plots the vector  v  for specified values of these parameters.

VecPic := proc (A, B, k, t, x, y)

local a, b, c, d;

uses plots;

a := -A*y*exp(-k*t)/(x^2+y^2);

b := A*x*exp(-k*t)/(x^2+y^2);

c := B*t;

d := max(abs(a), abs(b), abs(c));

arrow(<a, b, c>, view = [-d .. d, -d .. d, -d .. d], color = red, scaling = constrained, axes = normal)

end proc:

 

Your example for  t=0, A=1 (I took the the remaining parameters arbitrarily):

VecPic(1, 1, 1, 0, 4, -3);

 

 

If I understand correctly, only zero elements are on the diagonal, and the remaining elements are equal to  0  or   in any combination.

Here is the procedure that builds all such symmetric  n  by  n  matrices:

LM:=proc(n)

local L;

uses combinat; 

L:=permute([1$(n*(n-1)/2), 0$(n*(n-1)/2)], n*(n-1)/2);

[seq(Matrix(n,{seq(seq((i+1,j)=L[k][(i-1)*i/2+j], j=1..i), i=1..n-1)}, shape=symmetric), k=1..nops(L))];

end proc:

 

Example (the first 12 matrices of  2^10  the all ones for  n=5 ):

LM(5)[1..12][];

 

 

 

Example:

with(LinearAlgebra):

A := Matrix(3,4, [[1,2,3,4],[5,6,7,8],[9,0,1,2]]);

SubMatrix(A, [1,2], [2,4]);

 

 

Max:=proc()

local S;

S:=select(t->not type(t, numeric), {args});

if nops(S)=0 then return max(args) else

'procname'(op(S),max({args} minus S)) fi;

end proc:

 

Example:

Max(3, 1, x, 4);

                       Max(x, 4)

 

Carl, your way from a mathematical point of view is incorrect. If a finite set of points on the curve lies in a plane, it does not mean that the entire curve lies in this plane.

Moreover  geom3d[AreCoplanar]  command can cause errors in evident examples. Look 

with(geom3d):
AreCoplanar(point(A1,[1,0,0]), point(A2,[2,0,0]), point(A3,[3,0,0]), point(A4,[1,1,0]));

    Error, (in geom3d:-plane) the points may not be AreCollinear

 

For a curve given by the parametric equations with smooth functions, we can use  Student[VectorCalculus][Torsion]  command.  The quote from Wiki "A plane curve with non-vanishing curvature has zero torsion at all points. Conversely, if the torsion of a regular curve with non-vanishing curvature is identically zero, then this curve belongs to a fixed plane."


Example:

A:=<cos(phi),0,-sin(phi); 0,1,0; sin(phi),0,cos(phi)>:

V:=<cos(t),sin(t),0>:

V1:=A.V;  # Circle  V  rotated through the angle phi around the axis Oy

Student[VectorCalculus][Torsion](V1, t);

 

 

 

After  assign(a, c);  the following two assignments  

assign(a, d);  and   a:=d;  are different things. Compare:

  

assign(a, c);

a := d;  b := 2;

a, b, c;

    a := d

    b := 2

    d, 2, c

First 223 224 225 226 227 228 229 Last Page 225 of 290