Kitonum

19049 Reputation

26 Badges

14 years, 140 days

MaplePrimes Activity


These are answers submitted by Kitonum

You missed two multiplication signs in the line  eq14_2 .

The direct way to get these undefined constants is to use the  dsolve  command instead of the  int  one, since the operation of indefinite integration is inverse to differentiation.

Examples:

restart;
dsolve(diff(F(x),x)=x);
dsolve(diff(F(x),x)=x*sin(x));

Here you can draw an analogy with the exponentiation operation, which in the general case does not return all exponent values, but only the principal value, for example  (-8)^(1/3). To get all values we can use the  solve  command instead:

solve(z^3=-8);

Another possible approach is to use the simplest custom procedure, for example

restart;
my_int:=proc(expr, var)
int(expr, var)+C;
end proc:

# Examples
my_int(x, x);
my_int(t*sin(t), t);

Example:

A:=Array(1..2,1..2,1..2,(i,j,k)->i*k+j):
B:=Array(1..2,1..2,1..2,(i,j,k)->A[j,i,k]):

 

restart;  
plot3d([x*exp(-x^2-y^2),piecewise(x>=-1 and x<=1 and y>=-1 and y<=2,exp(-x^2-y^2),
undefined)],x=-3..3, y=-2..2, color=[red,blue], style=[surface,wireframe]);

               

 

The system  Sys  has infinitely many integer solutions, since instead of  x , you can take any integer:

Sys:={x*y*z + y*z + y = -1, x*y*z + x*z + z = 0, x*y*z + x*y + x = 0}:
solve(Sys);

                                              {x = x, y = -1, z = 0}

Try changing the initial conditions slightly by taking  y(0)=0.001  instead  y(0)=0. If  y(0)=0, then the vector of derivatives will be equal to  0  and the solution cannot be continued:

restart;

deS:=diff(x(t),t)=-0.5*x(t)*y(t);

diff(x(t), t) = -.5*x(t)*y(t)

(1)

deI:=diff(y(t),t)=0.5*x(t)*y(t)-0.15*y(t);

diff(y(t), t) = .5*x(t)*y(t)-.15*y(t)

(2)

with(DEtools):

DEplot([deS,deI],[x(t),y(t)],t=0..40,x=0..1,y=0..0.6,[[x(0)=0.99,y(0)=0.001]]);

 

 

Download DEtools_example_new.mw

Here is the Maple solution to this problem. For the solution, 3 my procedures Perimeter, Area and Picture were used (for details see  https://www.mapleprimes.com/posts/145922-Perimeter-Area-And-Visualization-Of-A-Plane-Figure- ). For convenience, procedure codes are inserted into the document below. The idea behind the solution is to replace this shape with a polygon with a large number of vertices (2177 ones):

restart;

Perimeter := proc (L) #  L is the list of all segments of the border
local i, var, var1, var2, e, e1, e2, P;
global Q;
for i to nops(L) do if type(L[i], listlist(algebraic)) then P[i] := seq(simplify(sqrt((L[i, j, 1]-L[i, j+1, 1])^2+(L[i, j, 2]-L[i, j+1, 2])^2)), j = 1 .. nops(L[i])-1) else
var := lhs(L[i, 2]); var1 := min(lhs(rhs(L[i, 2])), rhs(rhs(L[i, 2]))); var2 := max(lhs(rhs(L[i, 2])), rhs(rhs(L[i, 2])));
if type(L[i, 1], algebraic) then e := L[i, 1]; if nops(L[i]) = 3 then P[i] := simplify(int(sqrt(e^2+(diff(e, var))^2), var = var1 .. var2)) else
P[i] := simplify(int(sqrt(1+(diff(e, var))^2), var = var1 .. var2)) end if else
e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := abs(simplify(int(sqrt((diff(e1, var))^2+(diff(e2, var))^2), var = var1 .. var2))) end if end if end do;
Q := [seq(P[i], i = 1 .. nops(L))];
add(Q[i], i = 1 .. nops(Q));
end proc:

Area := proc (L)
local i, var, e, e1, e2, P;
for i to nops(L) do
if type(L[i], listlist(algebraic)) then P[i] := (1/2)*add(L[i, j, 1]*L[i, j+1, 2]-L[i, j, 2]*L[i, j+1, 1], j = 1 .. nops(L[i])-1) else
var := lhs(L[i, 2]);
if type(L[i, 1], algebraic) then e := L[i, 1];
if nops(L[i]) = 3 then P[i] := (1/2)*(int(e^2, L[i, 2])) else
P[i] := (1/2)*simplify(int(var*(diff(e, var))-e, L[i, 2])) end if else
e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := (1/2)*simplify(int(e1*(diff(e2, var))-e2*(diff(e1, var)), L[i, 2])) end if end if
end do;
abs(add(P[i], i = 1 .. nops(L)));
end proc:


Picture := proc (L, C, N::posint := 100, Boundary::list := [linestyle = 1])
local i, var, var1, var2, e, e1, e2, P, Q, h;
global Border;
for i to nops(L) do
if type(L[i], listlist(algebraic)) then P[i] := op(L[i]) else
var := lhs(L[i, 2]); var1 := lhs(rhs(L[i, 2])); var2 := rhs(rhs(L[i, 2])); h := (var2-var1)/N;
if type(L[i, 1], algebraic) then e := L[i, 1];
if nops(L[i]) = 3 then P[i] := seq(subs(var = var1+h*i, [e*cos(var), e*sin(var)]), i = 0 .. N) else
P[i] := seq([var1+h*i, subs(var = var1+h*i, e)], i = 0 .. N) end if else
e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := seq(subs(var = var1+h*i, [e1, e2]), i = 0 .. N) end if end if
end do;
Q := [seq(P[i], i = 1 .. nops(L))];
Border := plottools[curve]([op(Q), Q[1]], op(Boundary));
[plottools[polygon](Q, C), Border];
end proc:

# Solution of the problem
P1 := plots:-implicitplot(x^(1/(x + 1/x)) + y^(1/(y + 1/y)) = exp(1), x=0..7, y=0..7, gridrefine=4):
P2 := plottools:-getdata(P1):
L := [convert(P2[3], listlist)]:
nops(L[]); # Number of points on the boundary
`Perimeter`=evalf[7](Perimeter(L));
`Area`=evalf[7](Area(L));
plots:-display(Picture(L, color = green, [color = black, thickness = 2]), view=[0..7,0..7], gridlines);

2177

 

Perimeter = 13.94290

 

Area = 13.75902

 

 

 

Download 3_proc.mw

@The function The example  b)  was solved incorrectly. You are trying, following Carl's instructions, to express the modulus and argument of a complex number  z  through its real and imaginary parts, but you are doing it wrong. It will be much easier to use direct commands  abs  and  argument  for  z  in conjunction with  evalc  command, which tells Maple that  x  and  y  are real numbers. The empty circle (in the pic below) means that the origin does not belong to the boundary of this region:

restart;
z:=x+I*y:
A:=plots:-inequal(evalc~({argument(2*I*z)>=Pi/2,argument(2*I*z)<=Pi,abs(4*I*z)>0,abs(4*I*z)<=1}), x=-0.35..0.35, y=-0.35..0.35, thickness=2, optionsfeasible=[color="LightBlue"]):
B:=plots:-pointplot([[0,0]], symbol=circle, symbolsize=18):
plots:-display(A,B, size=[500,500]);

                        

 

When you write an arbitrary complex number  z  in algebraic form   z=x+I*y , Maple does not know that you are considering  x  and  y  as real numbers. Therefore, the commands  abs(z)  or  argument(z)  do not work directly. In this case, you can use the  evalc  command, which assumes that all symbols are real numbers. Also you can write  assuming real  instead. Then you do not need to write formulas for abs(z)  or  argument(z)  yourself, Maple will do it automatically. Below is the example  d)  solution:

restart;
z:=x+I*y:
abs(z);
evalc(abs(z));
plots:-inequal({abs(z)>=1,abs(z)<3,argument(z)<3*Pi/4,argument(z)>=-Pi/4}, x=-4..4, y=-4..4) assuming real;

                        

 

The direction field (by arrows) will only be displayed for one first-order equation or for an autonomous system of two first-order equations.

From the help for DEtools:-DEplot command: "A system of two first order differential equations produces a direction field plot, provided the system is determined to be autonomous. In addition, a single first order differential equation produces a direction field (as it can always be mapped to a system of two first order autonomous differential equations). A system is determined to be autonomous when all terms and factors, other than the differential, are free of the independent variable. For more information, see DEtools[autonomous]. For systems not meeting these criteria, no direction field is produced (only solution curves are possible in such instances). There can be only one independent variable."
 

Specifying a complex function in  complex variables is equivalent to specifying two real functions, each in  2*n  real variables.

Example for n=2 :

restart;
f:=(z1,z2)->(z1+z2)^2;
z1:=x1+I*y1: z2:=x2+I*y2:
u:=unapply(evalc(Re(f(z1,z2))),(x1,y1,x2,y2));
v:=unapply(evalc(Im(f(z1,z2))),(x1,y1,x2,y2));

(u+I*v)(1,2,3,4); # Example of a calculation

\

 

 

This expression is a real number (if  z  and  b  are real numbers):

A:=(ln (-z * I + b) - ln (z * I + b)) * I;
simplify(evalc(A)) assuming z>0,b>0 ;
simplify(evalc(A)) assuming z>0,b<0 ;

                   

 

                         

F:=beta[1]*exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2))/(1+exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2)));
evalc(F); # F in algebraic form (assuming all the parameters are reals)
evalc(Re(F));
evalc(Im(F));

 

I interpreted OP's question as how to find tetrahedra with integer edges and volume, and such that all edges are different. The code below finds all substantially different solutions, i.e. such tetrahedra, which cannot be obtained from one another by isometry, and whose edges are coprime, If the edge lengths <= 20, we obtain 68 solutions under these conditions. Also, all solutions are sorted in ascending order of volume (the first number in each list).


 

restart;
k:=0: N:=20:
L:=seq(seq([i,j],j=i+1..4),i=1..3):
M := Matrix(5, (i,j) -> `if`(i=j, 0, `if`(i=1 or j=1, 1, d[sort([i-1,j-1])[]]^2)));
V1:=LinearAlgebra:-Determinant(M):
for d[1,2] from 1 to N-2 do
for d[1,3] from d[1,2]+1 to N-1 do
for d[1,4] from d[1,3]+1 to N do
for d[2,3] from abs(d[1,3]-d[1,2])+1 to min(N,d[1,3]+d[1,2]-1) do
for d[2,4] from abs(d[1,4]-d[1,2])+1 to min(N,d[1,4]+d[1,2]-1) do
for d[3,4] from abs(d[1,4]-d[1,3])+1 to min(N,d[1,3]+d[1,4]-1) do
if d[2,3]<d[2,4]+d[3,4] and d[2,4]<d[2,3]+d[3,4] and d[3,4]<d[2,4]+d[2,3] then V2:=V1/288;
if type(V2,integer) then v1:=isqrt(V2);
if v1^2=V2 and v1>0 and nops({d[1,2],d[1,3],d[1,4],d[2,3],d[2,4],d[3,4]})=6 then V:=v1; k:=k+1; R[k]:=[V,[d__12=d[1,2],d__13=d[1,3],d__14=d[1,4],d__23=d[2,3],d__24=d[2,4],d__34=d[3,4]]] fi;fi;fi;
od: od: od: od: od: od:
R:=convert(R,list):
R0:=select(t->igcd(rhs~(t[2])[])=1, R):
R1:=[ListTools:-Categorize((X,Y)->{{rhs(X[2,1]),rhs(X[2,6])},{rhs(X[2,2]),rhs(X[2,5])},{rhs(X[2,3]),rhs(X[2,4])}}={{rhs(Y[2,1]),rhs(Y[2,6])},{rhs(Y[2,2]),rhs(Y[2,5])},{rhs(Y[2,3]),rhs(Y[2,4])}} and X[1]=Y[1], R0)]:
n:=nops(R1);
{seq(R1[i,1],i=1..n)}[];
 

Matrix(5, 5, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (1, 5) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = d[1, 2]^2, (2, 4) = d[1, 3]^2, (2, 5) = d[1, 4]^2, (3, 1) = 1, (3, 2) = d[1, 2]^2, (3, 3) = 0, (3, 4) = d[2, 3]^2, (3, 5) = d[2, 4]^2, (4, 1) = 1, (4, 2) = d[1, 3]^2, (4, 3) = d[2, 3]^2, (4, 4) = 0, (4, 5) = d[3, 4]^2, (5, 1) = 1, (5, 2) = d[1, 4]^2, (5, 3) = d[2, 4]^2, (5, 4) = d[3, 4]^2, (5, 5) = 0})

 

69

 

[6, [d__12 = 2, d__13 = 5, d__14 = 7, d__23 = 6, d__24 = 8, d__34 = 4]], [12, [d__12 = 2, d__13 = 5, d__14 = 13, d__23 = 6, d__24 = 14, d__34 = 16]], [18, [d__12 = 4, d__13 = 5, d__14 = 14, d__23 = 7, d__24 = 16, d__34 = 18]], [21, [d__12 = 2, d__13 = 9, d__14 = 11, d__23 = 10, d__24 = 12, d__34 = 8]], [21, [d__12 = 4, d__13 = 6, d__14 = 10, d__23 = 8, d__24 = 7, d__34 = 13]], [21, [d__12 = 8, d__13 = 10, d__14 = 12, d__23 = 16, d__24 = 17, d__34 = 19]], [24, [d__12 = 2, d__13 = 7, d__14 = 13, d__23 = 8, d__24 = 14, d__34 = 12]], [36, [d__12 = 4, d__13 = 6, d__14 = 10, d__23 = 7, d__24 = 12, d__34 = 13]], [36, [d__12 = 5, d__13 = 7, d__14 = 9, d__23 = 8, d__24 = 13, d__34 = 11]], [36, [d__12 = 6, d__13 = 8, d__14 = 14, d__23 = 11, d__24 = 16, d__34 = 7]], [36, [d__12 = 6, d__13 = 8, d__14 = 16, d__23 = 11, d__24 = 14, d__34 = 12]], [42, [d__12 = 4, d__13 = 5, d__14 = 18, d__23 = 6, d__24 = 20, d__34 = 16]], [42, [d__12 = 4, d__13 = 10, d__14 = 11, d__23 = 12, d__24 = 14, d__34 = 16]], [42, [d__12 = 4, d__13 = 10, d__14 = 14, d__23 = 12, d__24 = 11, d__34 = 17]], [42, [d__12 = 4, d__13 = 12, d__14 = 18, d__23 = 13, d__24 = 20, d__34 = 9]], [42, [d__12 = 5, d__13 = 13, d__14 = 15, d__23 = 16, d__24 = 19, d__34 = 7]], [42, [d__12 = 9, d__13 = 11, d__14 = 16, d__23 = 19, d__24 = 17, d__34 = 15]], [42, [d__12 = 10, d__13 = 11, d__14 = 17, d__23 = 16, d__24 = 14, d__34 = 12]], [48, [d__12 = 3, d__13 = 11, d__14 = 14, d__23 = 12, d__24 = 15, d__34 = 9]], [48, [d__12 = 4, d__13 = 6, d__14 = 16, d__23 = 8, d__24 = 14, d__34 = 19]], [48, [d__12 = 4, d__13 = 6, d__14 = 17, d__23 = 8, d__24 = 19, d__34 = 14]], [48, [d__12 = 4, d__13 = 14, d__14 = 17, d__23 = 16, d__24 = 19, d__34 = 6]], [48, [d__12 = 5, d__13 = 6, d__14 = 11, d__23 = 7, d__24 = 10, d__34 = 13]], [48, [d__12 = 5, d__13 = 6, d__14 = 11, d__23 = 7, d__24 = 14, d__34 = 13]], [48, [d__12 = 5, d__13 = 6, d__14 = 13, d__23 = 7, d__24 = 16, d__34 = 17]], [48, [d__12 = 5, d__13 = 6, d__14 = 16, d__23 = 7, d__24 = 13, d__34 = 14]], [48, [d__12 = 5, d__13 = 6, d__14 = 16, d__23 = 7, d__24 = 19, d__34 = 14]], [48, [d__12 = 5, d__13 = 7, d__14 = 10, d__23 = 8, d__24 = 11, d__34 = 15]], [48, [d__12 = 5, d__13 = 7, d__14 = 16, d__23 = 8, d__24 = 15, d__34 = 11]], [48, [d__12 = 5, d__13 = 10, d__14 = 15, d__23 = 11, d__24 = 16, d__34 = 7]], [48, [d__12 = 5, d__13 = 11, d__14 = 13, d__23 = 14, d__24 = 16, d__34 = 6]], [48, [d__12 = 5, d__13 = 14, d__14 = 18, d__23 = 15, d__24 = 17, d__34 = 8]], [48, [d__12 = 6, d__13 = 7, d__14 = 8, d__23 = 11, d__24 = 10, d__34 = 9]], [48, [d__12 = 6, d__13 = 13, d__14 = 14, d__23 = 17, d__24 = 16, d__34 = 7]], [60, [d__12 = 7, d__13 = 8, d__14 = 12, d__23 = 14, d__24 = 10, d__34 = 16]], [60, [d__12 = 7, d__13 = 10, d__14 = 16, d__23 = 12, d__24 = 11, d__34 = 14]], [63, [d__12 = 5, d__13 = 8, d__14 = 15, d__23 = 12, d__24 = 16, d__34 = 14]], [63, [d__12 = 6, d__13 = 10, d__14 = 16, d__23 = 11, d__24 = 17, d__34 = 8]], [72, [d__12 = 5, d__13 = 12, d__14 = 15, d__23 = 13, d__24 = 14, d__34 = 9]], [78, [d__12 = 7, d__13 = 11, d__14 = 13, d__23 = 16, d__24 = 19, d__34 = 15]], [84, [d__12 = 4, d__13 = 10, d__14 = 17, d__23 = 12, d__24 = 19, d__34 = 14]], [84, [d__12 = 6, d__13 = 7, d__14 = 16, d__23 = 8, d__24 = 14, d__34 = 19]], [84, [d__12 = 6, d__13 = 11, d__14 = 16, d__23 = 12, d__24 = 18, d__34 = 9]], [90, [d__12 = 6, d__13 = 8, d__14 = 14, d__23 = 11, d__24 = 17, d__34 = 12]], [90, [d__12 = 7, d__13 = 8, d__14 = 12, d__23 = 11, d__24 = 10, d__34 = 16]], [105, [d__12 = 6, d__13 = 8, d__14 = 16, d__23 = 12, d__24 = 15, d__34 = 18]], [105, [d__12 = 7, d__13 = 10, d__14 = 11, d__23 = 12, d__24 = 16, d__34 = 14]], [105, [d__12 = 8, d__13 = 9, d__14 = 10, d__23 = 11, d__24 = 12, d__34 = 16]], [105, [d__12 = 8, d__13 = 9, d__14 = 12, d__23 = 13, d__24 = 10, d__34 = 18]], [105, [d__12 = 8, d__13 = 9, d__14 = 16, d__23 = 13, d__24 = 18, d__34 = 10]], [105, [d__12 = 8, d__13 = 9, d__14 = 18, d__23 = 11, d__24 = 16, d__34 = 12]], [105, [d__12 = 8, d__13 = 10, d__14 = 16, d__23 = 12, d__24 = 18, d__34 = 9]], [105, [d__12 = 8, d__13 = 11, d__14 = 14, d__23 = 15, d__24 = 20, d__34 = 10]], [120, [d__12 = 7, d__13 = 8, d__14 = 13, d__23 = 11, d__24 = 14, d__34 = 15]], [120, [d__12 = 7, d__13 = 11, d__14 = 14, d__23 = 16, d__24 = 19, d__34 = 15]], [126, [d__12 = 4, d__13 = 15, d__14 = 20, d__23 = 16, d__24 = 18, d__34 = 19]], [126, [d__12 = 9, d__13 = 11, d__14 = 13, d__23 = 19, d__24 = 17, d__34 = 16]], [132, [d__12 = 7, d__13 = 13, d__14 = 14, d__23 = 16, d__24 = 18, d__34 = 10]], [132, [d__12 = 8, d__13 = 11, d__14 = 12, d__23 = 14, d__24 = 16, d__34 = 10]], [162, [d__12 = 8, d__13 = 11, d__14 = 12, d__23 = 15, d__24 = 16, d__34 = 14]], [165, [d__12 = 7, d__13 = 13, d__14 = 18, d__23 = 16, d__24 = 14, d__34 = 20]], [168, [d__12 = 8, d__13 = 9, d__14 = 15, d__23 = 13, d__24 = 19, d__34 = 18]], [168, [d__12 = 8, d__13 = 11, d__14 = 15, d__23 = 17, d__24 = 19, d__34 = 16]], [210, [d__12 = 8, d__13 = 10, d__14 = 16, d__23 = 12, d__24 = 17, d__34 = 19]], [231, [d__12 = 9, d__13 = 10, d__14 = 19, d__23 = 14, d__24 = 16, d__34 = 20]], [231, [d__12 = 10, d__13 = 11, d__14 = 17, d__23 = 12, d__24 = 14, d__34 = 16]], [288, [d__12 = 9, d__13 = 11, d__14 = 19, d__23 = 14, d__24 = 20, d__34 = 18]], [300, [d__12 = 10, d__13 = 14, d__14 = 20, d__23 = 16, d__24 = 15, d__34 = 19]], [330, [d__12 = 10, d__13 = 13, d__14 = 18, d__23 = 14, d__24 = 16, d__34 = 20]]

(1)

 


Edit. The code has been fixed. The necessary condition  X[1]=Y[1]  added to the  ListTools:-Categorize command.

Download itetr2.mw

Alternatively, you can do the same without matrices. Also, I multiplied each frame 5 times to make the animation slower.

T:= seq(k, k= 1..9):  X:= seq(k^2, k= 1..9):
plots:-display(seq(plot([seq([T[i],X[i]],i=1..k)])$5,k=1..9),insequence);

         

 

First 8 9 10 11 12 13 14 Last Page 10 of 272