Kitonum

21435 Reputation

26 Badges

17 years, 24 days

MaplePrimes Activity


These are answers submitted by Kitonum

You wrote that you don't like the black border when we use the  legend  option. We can show the legends without using this option and without any borders. Here are two solutions to the problem. In the left picture below, the equations of the graphs are written next to the corresponding lines. In the right picture, the equations are written next to small segments of the corresponding color (as done when using the  legend option):

restart;
p:=eval([x,y],solve({y=1/x,y=1/x^2},{x,y})):
A:=plot([1/x,1/x^2], x=0..4, 0..4, color=[red,blue]):
T:=plots:-textplot([[1,1,typeset("(", p[1],",",p[2], ")")],[0.5,3.4,y=1/x^2],[2.8,0.3,y=1/x]],align={above,right}, font=[times,bold,14]):
P:=plots:-pointplot([1,1], symbol=solidcircle, symbolsize=15):
T1:=plots:-textplot([[1.2,1.1,typeset("(", p[1],",",p[2], ")")],[3.5,2,y=1/x^2],[3.5,2.6,y=1/x]], font=[times,bold,14]):
A1:=plot([[[2.5,2],[3,2]],[[2.5,2.6],[3,2.6]]], color=[blue,red]):
P1:=plots:-display(A,T,P):
P2:=plots:-display(A,T1,P,A1):
plots:-display(<P1 | P2>);

   

                 

The  plot  command has no options for constructing asymptotes, but you can first automatically calculate the asymptotes using the  Student:-Calculus1:-Asymptotes  command, and then plot them using the formulas already found. In your example below, for plotting I have replaced the asymptote  x=0  with  x=0.05  so that it does not coincide with the vertical axis:
 

restart:
expr:=(x^2 + 5*x + 1)/abs(x):
A:=plot(expr, x= -8..6, -5.5..12, color= green, thickness=2, legend=(f(x)=expr)):
As:=Student:-Calculus1:-Asymptotes(expr, x); # List of all the asymptotes
As1:=subsop(3=(x=0.05),As):
B:=plots:-implicitplot(As1, x=-8..6, y=-5.5..12, linestyle=3, color=[blue,cyan,red], thickness=0, legend=As):
plots:-display(A, B, size=[400,500]);

[y = -x-5, y = x+5, x = 0]

 

 

 


 

Download asymp.mw

The cause of the problem is easy to see if your code is written in 1Dmath:

restart;

K__vxa[1] := 2.0154553049*10^17;

0.2015455305e18

(1)

`#mrow(mi("\`K__vxa\`"),mfenced(mn("1"),open = "&lsqb;",close = "&rsqb;"))`+K__vxa[1];

`#mrow(mi("\`K__vxa\`"),mfenced(mn("1"),open = "&lsqb;",close = "&rsqb;"))`+0.2015455305e18

(2)

NULL

Download Prj_1Dmath.mw

Should be Pi  not  pi:

evalc(exp(2*I*k*Pi)) assuming k::integer;
evalc(exp((2*k+1)*I*Pi)) assuming k::integer;
evalc(exp(I*Pi/2));
evalc(exp(3*I*Pi/2));
evalc(exp(I*Pi/3));

Another easy way is to replace the curve with a polygon with more sides (I used 500 ones):

#Circle of reference
R0 := 1:
C0 := t-> < cos(t), sin(t), 0 >:

#Variable radius
R := t-> R0*(1 + 1/2*sin(t)):

#Variable phase
Dt := t-> Pi/2*sin(2*t):

#CONCAVE Curve
C := t-> R(t)*C0(t - Dt(t)):
'C(t)' = C(t);

#Range
t1, t2 := 0, 2*Pi:

#Plot
GC := plots:-spacecurve(C(t), t = t1..t2, color = "Red", thickness = 3
, linestyle = solid
, scaling = constrained, axes = frame, orientation = [50,40,0]):
GB:=plottools:-polygon([seq(convert(C(t),list),t=0..evalf(2*Pi),evalf(2*Pi/500))], color=red):
plots:-display(GB );

C(t) = (Vector(3, {(1) = (1+(1/2)*sin(t))*cos(t-(1/2)*Pi*sin(2*t)), (2) = (1+(1/2)*sin(t))*sin(t-(1/2)*Pi*sin(2*t)), (3) = 0}))

 

 

 

Download PPP.mw

You have presented the original expression  (*)  as a picture. But if you want to write it in Maple language, then you can use the  conjugate command. With further conversions, the following problem arises related to the use of square brackets. [M,A]  in Maple means list of objects  M  and  . If you just write  [M,A] - 3*[M,B] = 7*[M,C] , Maple will automatically do these linear operations on lists and you get  [-2*M, -3*B+A] = [7*M, 7*C] . Therefore, in the conversion below, instead of square brackets, we use a function  f  of two variables. You yourself can easily replace it with any function you need.

restart;
expr:=conjugate(MA)-3*conjugate(MB) = 7*conjugate(MC);
expr1:=subsindets(expr,function,t->op(1,t));
expr2:=subsindets(expr1,symbol,t->f(seq(substring(t,i),i=1..2)));

                    

I don't know what the square brackets in your question mean.

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;

                        

 

First 25 26 27 28 29 30 31 Last Page 27 of 289