Kitonum

21450 Reputation

26 Badges

17 years, 47 days

MaplePrimes Activity


These are answers submitted by Kitonum

restart;
Expr:=-a2/3 + a3 - (2*a4)/3 - (2*a5)/3:
Expr1:=-``(-Expr*3)/3; # The desired form
expand(Expr1); # The original form

 

Use functional notation:

restart

with(LinearAlgebra)

with(PDEtools)

with(Physics)

with(plots)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(1)

``

U := proc (i, t) options operator, arrow; Matrix([[1+I*(q(i+1, t)-q(i, t))/lambda, I*(r(i+1, t)-r(i, t))/lambda], [I*(r(i+1, t)-r(i, t))/lambda, 1-I*(q(i+1, t)-q(i, t))/lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[1+I*(q(i+1, t)-q(i, t))/lambda, I*(r(i+1, t)-r(i, t))/lambda], [I*(r(i+1, t)-r(i, t))/lambda, 1-I*(q(i+1, t)-q(i, t))/lambda]]) end proc

(2)

``

V := proc (i, t) options operator, arrow; Matrix([[-((1/2)*I)*lambda, -r(i, t)], [r(i, t), ((1/2)*I)*lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[-((1/2)*I)*lambda, -r(i, t)], [r(i, t), ((1/2)*I)*lambda]]) end proc

(3)

NULL

z := diff(U(i, t), t)+U(i, t).V(i, t)-V(i+1, t).U(i, t)

Matrix(%id = 18446746137203957622)

(4)

NULL

Download CD_new.mw

2 errors in your code. In the EqBIS procedure, P, U, V must be Vectors, not lists. Also remove the space after the procedure name in your example (which Maple interprets as a multiplication sign). I also removed the unnecessary command RETURN:

EqBIS := proc(P, U, V)
local a, eq1, M1, t, PU, PV, bissec1;
a := (P - U)/LinearAlgebra:-Norm(P - U, 2) + (P - V)/LinearAlgebra:-Norm(P - V, 2);
M1 := P + a*t;
eq1 := op(eliminate({x = M1[1], y = M1[2]}, t));
op(eq1[2]); end proc;

EqBIS(<4, 5>, <11, 7/3>, <11, 5>);

 

restart;
F:=2*y*sin(beta*x)+6*z*cos(beta*x)+24*sin(beta*x)*cos(beta*x):
coeff(select(t->has(t,sin) and not has(t,cos),F), sin(beta*x));                              

                                              

In Maple gamma is Euler's constant, not a symbol. When you write  gamma(t) , this is a constant function, which equals  gamma  for any t .

restart;
simplify([3(t), gamma, gamma(t)]);
evalf(%);

                                            [3, gamma, gamma]
                               [3., 0.5772156649, 0.5772156649]
 

In the second example  gamma  is a symbol  (`&gamma;`)

The procedure checks for a match in the rows of matrices  A  and  B  and returns a list of lists  L , in which the 1st element is the matching row, and the 2nd element is a list of two numbers (how many times this row occurs in each of the matrices).
 

restart;
CheckRowsUniquie:=proc(A::Matrix,B::Matrix)
local m1, m2, A1, B1, A11, B11, k, a, b, L;
uses LinearAlgebra, ListTools;
m1,m2:=ColumnDimension(A),ColumnDimension(B);
if m1<>m2 then error "Should be ColumnDimension(A)=ColumnDimension(B)" fi;
A1:=convert(A,listlist); B1:=convert(B,listlist);
A11:=Collect(A1); B11:=Collect(B1);
k:=0;
for a in A11 do
for b in B11 do
if a[1]=b[1] then k:=k+1; L[k]:=[a[1],[a[2],b[2]]] fi;
od; od;
convert(L,list);
end proc:

A:=<1,2; 3,4; 1,2; 5,6>; B:=<0,1; 1,2; 1,2; 3,4; 7,8>;
CheckRowsUniquie(A,B);

Matrix(4, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4, (3, 1) = 1, (3, 2) = 2, (4, 1) = 5, (4, 2) = 6})

 

Matrix(%id = 18446746714869442310)

 

[[[1, 2], [2, 2]], [[3, 4], [1, 1]]]

(1)

 


 

Download CheckRowsUniquie.mw

Just use the  RelabelVertices  command as in the example below:

restart; 
with(GraphTheory): 
G := Graph({{1, 2}, {1, 3}, {1, 4}}); 
V := Vertices(G); 
V1 := subs([1, 2]=~[a, b], V); 
H := RelabelVertices(G, V1); 
DrawGraph(H);

 

Just specify the ranges for the variables  x  and  y  and the error will disappear:

restart;
plots:-implicitplot(x-y-Pi, x=-1..5, y=-4..1);

 

Or use the  eval  command:

restart;
dgdx := (x,T)->diff(g(x, T), x);
g := (x,T)->T*x + x^2;
eval(dgdx(x,T), [x=1,T=2]);

                              

The reason for the error in OP's approach is that Maple first substitutes  x  and  y  with the numbers 1 and 2 and the result is differentiation not with respect to the variable  x , but with respect to the constant  1 .

restart;
A := <<true, false, true> | <true, false, true> | <false, false, false>>;
B := <<1, 2, 6> | <3, 4, 7> | <22, 33, 44>>;
zip((u,v)->`if`(u=true,v,`( )`), A,B);

                             

 

 

I don't know why Student:-Calculus1:-VolumeOfRevolution command distorts the colors. You may get better results if you use the  plot3d  command to draw surfaces. I also selected the edges of the cylinder (2 circles) using the  plots:-spacecurve  command:

restart;
A:=plot3d([x,4*cos(t),4*sin(t)], t=0..2*Pi, x=1..2, style=surface, color="Blue"):
B:=plot3d([[1,r*cos(t),r*sin(t)],[2,r*cos(t),r*sin(t)]], t=0..2*Pi, r=0..4, style=surface, color="Blue"):
C:=plots:-spacecurve([[1,4*cos(t),4*sin(t)],[2,4*cos(t),4*sin(t)]], t=0..2*Pi, color=black, thickness=2):
plots:-display(A,B,C, transparency=0.6, scaling=constrained, view = [0 .. 3, -5 .. 5, -5 .. 5], axes=normal, orientation = [-94,-18,11], labels = [x, y, z]); 

                     

See the following toy example:

A:=<1,2; ``,3>;
map(t->`if`(t=``,``,f(t)), A);

 

Look at these 2 graphs. We see that on a part of the range  0..2*Pi , the function takes negative values. Therefore, the square root on these intervals will take on complex values.

plot(c^2-a^2*cos(theta)^2, theta = 0 .. 2*Pi); 
plot(b^2-(a*sin(theta)+sqrt(c^2-a^2*cos(theta)^2))^2, theta = 0 .. 2*Pi);

 

You must use the  solve  command for this:

restart;
eq:=5*a^2 + 2*b - 7 = 0;
a:=1;
b=solve(eq, b);

 

This can be done more simply and more automatically as in the example:

restart;
with(plots):
with(plottools):
p1:= cuboid( [0,0,0], [1,1,1], color="LightBlue", transparency=0.5): # The cube
p2:=plot3d(3/2-x-y, x=-1..2, y=-1..2, style=surface, color=red): # The plane
display([p1, p2], view=[(0..1)$3]);

                     

I considered a more interesting example in which the intersection will be a regular hexagon. For your example in the code replace 3/2 - x - y  with  1 - x .

 

First 18 19 20 21 22 23 24 Last Page 20 of 289