Kitonum

18989 Reputation

26 Badges

14 years, 76 days

MaplePrimes Activity


These are answers submitted by Kitonum

Use the  factor  command for this:

factor(f);

                    A*sin(x)*theta(x)*(-m*omega^2+k)

By default, Maple calculates with 10 significant digits. Therefore, for a sufficiently large   of float type, we get ln(x+1) - ln(x) = 0. . If we increase the accuracy of the calculations, then the error disappears:

restart;
f := x->4*x*(ln(x+1)-ln(x)):
Digits := 50: 
evalf[10]~([seq(f(10.^n), n = 1 .. 10)]);

  [3.812407192, 3.980132341, 3.998001332, 3.999800013, 3.999980000, 3.999998000, 3.999999800, 3.999999980, 3.999999998, 4.000000000]

We can simply calculate this determinant and, equating it to  , we get a 4th degree equation for  w  with 2 parameters  d  and  k . Giving some values to these parameters, we find all values of  w . In the example below we find the real  d=2, k=1, w=sqrt(3)/3  for which  the determinant  is  0 :


 

restart;

with(LinearAlgebra):

A := Matrix([[k*w-1/sqrt(3), 0, 4*sqrt(2/3)+3*sqrt(2)*w*d, 4*sqrt(2/3)-3*sqrt(2)*w*d], [0, k*w-1/sqrt(3), 4*sqrt(2/3)+3*sqrt(2)*w*d, 4*sqrt(2/3)-3*sqrt(2)*w*d], [(1/2)*w*d+sqrt(2/3), 0, k*w+k*d/sqrt(3)-w*d-I*w*d-1/sqrt(3), I*w*d-1/sqrt(3)], [0, -(1/2)*w*d+sqrt(2/3), -I*w*d-1/sqrt(3), k*w-k*d/sqrt(3)+w*d+I*w*d-1/sqrt(3)]]);

Matrix(4, 4, {(1, 1) = k*w-(1/3)*sqrt(3), (1, 2) = 0, (1, 3) = (4/3)*sqrt(6)+3*sqrt(2)*w*d, (1, 4) = (4/3)*sqrt(6)-3*sqrt(2)*w*d, (2, 1) = 0, (2, 2) = k*w-(1/3)*sqrt(3), (2, 3) = (4/3)*sqrt(6)+3*sqrt(2)*w*d, (2, 4) = (4/3)*sqrt(6)-3*sqrt(2)*w*d, (3, 1) = (1/2)*w*d+(1/3)*sqrt(6), (3, 2) = 0, (3, 3) = k*w+(1/3)*k*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w^2*6^(1/2)-(8*I)*w^4+(8*I)*w^3*3^(1/2)-((32/3)*I)*w^3*6^(1/2)+((32/9)*I)*3^(1/2)*w^2*6^(1/2)-8*w^3*6^(1/2)*2^(1/2)-12*w^4*2^(1/2)+4*w^3*3^(1/2)+(10/3)*w*3^(1/2)-(16/3)*w^3*6^(1/2)-(16/9)*w*6^(1/2)+12*w^3*2^(1/2)*3^(1/2)-(8/3)*6^(1/2)*2^(1/2)*w-(8*I)*w^2+((8/9)*I)*3^(1/2)*w-8*2^(1/2)*w^2-3*w^4+(16/3)*3^(1/2)*6^(1/2)*2^(1/2)*w^2-(35/3)*w^2

 

(1/15533733556225593)*(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)-15533733556225593*((-180775148479/388495499643+(111022067624/388495499643)*I)+(50106305920/388495499643)*2^(1/2)-((71540531744/388495499643)*I)*2^(1/2))/(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+((40928/1079577)*I)*3^(1/2)*2^(1/2)+(174083/1079577)*3^(1/2)-(267316/1079577)*3^(1/2)*2^(1/2)-((50632/359859)*I)*3^(1/2), -(1/31067467112451186)*(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+(15533733556225593/2)*((-180775148479/388495499643+(111022067624/388495499643)*I)+(50106305920/388495499643)*2^(1/2)-((71540531744/388495499643)*I)*2^(1/2))/(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+((40928/1079577)*I)*3^(1/2)*2^(1/2)+(174083/1079577)*3^(1/2)-(267316/1079577)*3^(1/2)*2^(1/2)-((50632/359859)*I)*3^(1/2)+((1/2)*I)*3^(1/2)*((1/15533733556225593)*(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+15533733556225593*((-180775148479/388495499643+(111022067624/388495499643)*I)+(50106305920/388495499643)*2^(1/2)-((71540531744/388495499643)*I)*2^(1/2))/(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)), -(1/31067467112451186)*(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+(15533733556225593/2)*((-180775148479/388495499643+(111022067624/388495499643)*I)+(50106305920/388495499643)*2^(1/2)-((71540531744/388495499643)*I)*2^(1/2))/(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+((40928/1079577)*I)*3^(1/2)*2^(1/2)+(174083/1079577)*3^(1/2)-(267316/1079577)*3^(1/2)*2^(1/2)-((50632/359859)*I)*3^(1/2)-((1/2)*I)*3^(1/2)*((1/15533733556225593)*(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)+15533733556225593*((-180775148479/388495499643+(111022067624/388495499643)*I)+(50106305920/388495499643)*2^(1/2)-((71540531744/388495499643)*I)*2^(1/2))/(265611425454935876316467597144620549893660289104*3^(1/2)-(782587540494658069900310508971611944375274105332*I)*3^(1/2)-373958946518800334108935688358258767448051176244*3^(1/2)*2^(1/2)+(498726741960108955283603614246046968199121550272*I)*3^(1/2)*2^(1/2)+9648094810073959321974105771237467499*(-(262494030946006112448*I)*2^(1/2)+(-2910182786878860486173+2598854356561503484904*I)+1142251446558238597120*2^(1/2))^(1/2))^(1/3)), (1/3)*3^(1/2)

 

0

(2)

``

``


 

Download det_new.mw

restart;
with(Student[Calculus1]):
soln := Roots(y-0.4646295e-3*tanh(y)+0.1839145082e-2*tanh(y)/(0.6000000000e-3*y^2-0.1840000000e-2), y);
map(t->t*I, soln);
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);

 

1 2 3 4 5 6 7 Last Page 1 of 271