Kitonum

21670 Reputation

26 Badges

17 years, 184 days

MaplePrimes Activity


These are answers submitted by Kitonum

p := 8*T(x, 7)*T(x, 2)+4*T(x, 5)*T(x, 1)+6*T(x, 3)*T(x, 3)+7*T(x, 1)*T(x, 4):
map(t->content(t)*`if`(type(primpart(t),`*`),convert(primpart(t),`+`),op(1,primpart(t))*op(2,primpart(t))), p);

                              8*T(x, 7)+8*T(x, 2)+4*T(x, 5)+11*T(x, 1)+12*T(x, 3)+7*T(x, 4)

Here is an another simple way (without select):

{seq(`if`(a>=5 and a<=15,a,NULL),a=A)};

 

move all terms to the left and take the numerator of the resulting fraction. In this case, the  expand  command is not required:

van_der_Waals := (p + a / V[m]^2) * (V[m] - b) = R * T:
numer((lhs-rhs)(van_der_Waals));
sort(%, V[m]);

 

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);

 

First 19 20 21 22 23 24 25 Last Page 21 of 291