Kitonum

21440 Reputation

26 Badges

17 years, 36 days

MaplePrimes Activity


These are answers submitted by Kitonum

Total there are 4 solutions:

solve({(13/4)*m-(7/4)*n-3 = 0,
-(17/2)*n*2^n +34*m= 0});
allvalues(%);
evalf(%);

            {m = -0.1262032999, n = -1.948663272}, {m = 2., n = 2.}, {m = 1.551915566-4.737602358*I, n =     1.167843193-8.798404378*I}, {m = 1.551915566+4.737602358*I, n = 1.167843193+8.798404378*I}
                                             

On the plot we see the 2 real solutions .

It is easy to verify that your curve is the circle in space obtained by rotating the vector  <5, 0, 0>  around the vector  <1, 1, 1> . So we get simpler parametric equations of this circle. The example shows its coloring in 3 colors:

restart;
with(Student[LinearAlgebra]):
A:=RotationMatrix(t, <1,1,1>);
Curve:=convert(A.<5,0,0>,list);  # Parametric equations of the circle
plots:-spacecurve(Curve, t=0..2*Pi, thickness=5, colorscheme=[red,blue,green,red], axes=normal);

           

 

 

Your tangents intersect on the red curve, sol  are its parametric equations (m is the parameter). Besides a static plot for  m=2 , I also made the animation of all this.
 

restart;
with(plots):
_EnvHorizontalName := 'x'; _EnvVerticalName := 'y';
para := -2*p*x+y^2 = 0;
para1 := -2*p1*x+y^2 = 0;
t := y-m*x-p/(2*m) = 0;
t1 := y+x/m+(1/2)*p1*m = 0;
sol := op(solve([t, t1], [x, y]));
eliminate({rhs(sol[1]), rhs(sol[2])}, m);

  p := 1; p1 := -2;
PARA := implicitplot(para, x = -3 .. 3, y = -3 .. 3, color = blue);
PARA1 := implicitplot(para1, x = -3 .. 3, y = -3 .. 3, color = green);
Tang := implicitplot(eval(t,m=2), x = -3 .. 3, y = -3 .. 3, color = brown);
Tang1 := implicitplot(eval(t1,m=2), x = -3 .. 3, y = -3 .. 3, color = aquamarine);

A:=display(eval([PARA, PARA1, Tang, Tang1],m=2), view = [-3 .. 3, -3 .. 3], scaling = constrained):
B:=plot([eval([x,y],sol)[], m=-3..4], color=red, discont):

display(A,B, size=[500,500], view=[-2.5..2.5,-2.5..2.5]);

A1:=display(PARA, PARA1, view = [-3 .. 3, -3 .. 3], scaling = constrained):

animate(implicitplot,[[t,t1],x = -3 .. 3, y = -3 .. 3, color = [brown,aquamarine]], m=-2.5..3.5, frames=90, background=display(B,A1), size=[500,500], view=[-2.5..2.5,-2.5..2.5]);

x

 

y

 

-2*p*x+y^2 = 0

 

-2*p1*x+y^2 = 0

 

y-m*x-(1/2)*p/m = 0

 

y+x/m+(1/2)*p1*m = 0

 

[x = -(1/2)*(m^2*p1+p)/(m^2+1), y = -(1/2)*(m^4*p1-p)/((m^2+1)*m)]

 

[{m = RootOf(_Z^2*p1+p)}, {p}]

 

1

 

-2

 

 

 

 

 

 

 

 


 

Download plots_and-animation.mw

For plotting, you can use Re, Im  and  abs  commands, which return respectively the real part, imaginary part and module of a complex number. Since you have a function of  2 variables, it is more natural to use  plot3d  command.


 

restart

with(plots, implicitplot)

ode := diff(y(w), w)+(sqrt((12*Pi)(y(w)^2+m^2*w^2))*y(w)+m^2*w)/y(w) = 0

diff(y(w), w)+(2*3^(1/2)*Pi(y(w)^2+m^2*w^2)^(1/2)*y(w)+m^2*w)/y(w) = 0

(1)

Ans := dsolve([ode])

[{ln(w)+(1/4)*ln(-m^4-2*m^2*y(w)^2/w^2-y(w)^4/w^4+12*y(w)^2*Pi/w^2)-(3/2)*arctan((1/4)*(-2*m^2-2*y(w)^2/w^2+12*Pi)/(3*Pi*m^2-9*Pi^2)^(1/2))*Pi/(3*Pi*m^2-9*Pi^2)^(1/2)+(1/4)*ln(2*Pi^(1/2)*3^(1/2)*y(w)/w-y(w)^2/w^2-m^2)-(3/2)*arctan((1/2)*(2*Pi^(1/2)*3^(1/2)-2*y(w)/w)/(m^2-3*Pi)^(1/2))/((3*m^2-9*Pi)/Pi)^(1/2)-(1/4)*ln(2*Pi^(1/2)*3^(1/2)*y(w)/w+m^2+y(w)^2/w^2)+(3/2)*arctan((1/2)*(2*y(w)/w+2*Pi^(1/2)*3^(1/2))/(m^2-3*Pi)^(1/2))/((3*m^2-9*Pi)/Pi)^(1/2)-_C1 = 0}]

(2)

P:=subs(y(w)=Y,eval(lhs(Ans[1, 1]), [_C1 = 0, m = 1]))

ln(w)+(1/4)*ln(-1-2*Y^2/w^2-Y^4/w^4+12*Y^2*Pi/w^2)-(3/2)*arctan((1/4)*(-2-2*Y^2/w^2+12*Pi)/(-9*Pi^2+3*Pi)^(1/2))*Pi/(-9*Pi^2+3*Pi)^(1/2)+(1/4)*ln(2*Pi^(1/2)*3^(1/2)*Y/w-Y^2/w^2-1)-(3/2)*arctan((1/2)*(2*Pi^(1/2)*3^(1/2)-2*Y/w)/(1-3*Pi)^(1/2))/((-9*Pi+3)/Pi)^(1/2)-(1/4)*ln(2*Pi^(1/2)*3^(1/2)*Y/w+1+Y^2/w^2)+(3/2)*arctan((1/2)*(2*Y/w+2*Pi^(1/2)*3^(1/2))/(1-3*Pi)^(1/2))/((-9*Pi+3)/Pi)^(1/2)

(3)

implicitplot(Re(P),w=-1..1,Y=-1..1, color=red, gridrefine=4);
implicitplot(Im(P),w=-1..1,Y=-1..1, color=blue, gridrefine=4);

 

 

plot3d(Re(P),w=-1..1,Y=-1..1, grid=[100,100]);
plot3d(Im(P),w=-1..1,Y=-1..1, grid=[100,100]);
plot3d(abs(P),w=-1..1,Y=-1..1, grid=[100,100]);

 

 

 

 


 

Download P2_new.mw

F:=int(sqrt(1+((k*Pi)/l*cos((Pi*x)/l))^2), x) assuming k>0,l>0 ;
F1:=simplify(%);
FR:=combine(eval(F1,x=b)-eval(F1,x=a)); # The final result

 

I can not confirm this behavior, in Maple 2018.2 everything works as expected. But you can radically solve the problem and not use this option at all. Just first find all the discontinuity points using  discont  or  fdiscont  commands, and then plot your function by cutting these points by small neighborhoods as in the example below.

restart;
discont(frac(x^2/3), x);
allvalues(%);
about(_Z1);
seq(plot(frac(x^2/3)*3, x=sqrt(3)*sqrt(n)+0.001..sqrt(3)*sqrt(n+1)-0.001), n=0..9):
plots:-display(%, scaling=constrained, size=[900,400]);

         

       

Or use the  map  command, which causes Maple to sequentially calculate the integral of each summand:

map(int, g, theta = 0 .. Pi)  assuming r>0;

                      


Axel's approach does not work in Maple 2018.

Edit. Of course, as acer showed in his comment, the  IntegrationTools:-Expand  command solves the problem.

I think this task is not too simple for a beginner, since there are many different objects in it. Here is a solution using  eval  and  diff  commands (the differentiation operator  D  does not seem to work for vector functions for Maple <=2018). A detailed commentary is provided for each line of code so that the beginner understands what it is doing. I gave different names for the parameters of the original curve  and the tangent line  s  (they are often confused but they are not related to each other). Ranges  t=0..1.4  and  s=-0.3..0.4  are chosen so that everything looks beautiful and informative.

restart;
f:=[t,t^2,t^3]; # The parametric equations of the original curve
t0:=1; # The value of the parameter at the tangency point
P:=eval(f,t=t0); # The coordinates of the tangency point  
df:=eval(diff(f,t), t=t0); # The coordinates of the tangent vector at t=t0
with(plots):
A:=spacecurve(f, t=0..1.4, color=red, thickness=2,labels=[x,y,z]): # The plot of the original curve
T:=map(p->s*p,df)+P; # The parametric equations of the tangent line 
B:=spacecurve(T, s=-0.3..0.4, color=blue, thickness=3): # The plot of the tangent line 
C:=pointplot3d(P,color=red,symbol=solidsphere,symbolsize=10): # The plot of the tangency point  
display(A,B,C, axes=normal, orientation=[-35,75], scaling=constrained); # All at once

          

 

 

Download ABC.mw

I significantly reduced the  stepsize  option, slightly increased  the ranges for  x  and  y , and removed unused lines of code.
 

with(DEtools)

with(plots)

with(LinearAlgebra)

p1 := phaseportrait([diff(x(t), t) = x(t)*(1-x(t)^2-y(t)^2)+y(t)*(y(t)^2+(x(t)^2-1)^2), diff(y(t), t) = y(t)*(1-x(t)^2-y(t)^2)-x(t)*(y(t)^2+(x(t)^2-1)^2)], [x(t), y(t)], t = 0 .. 50, [[x(0) = -3, y(0) = .5], [x(0) = 4, y(0) = 2]], x = -5 .. 5, y = -5 .. 5, dirgrid = [13, 13], stepsize = 0.1e-2, axes = BOXED); p1

 

p2 := pointplot([[1, 0], [-1, 0], [0, 0]], symbolsize = 20, symbol = solidcircle, color = black)

 

 

display(p1, p2, size = [500, 500])

 

solve({x*(-x^2-y^2+1)+y*(y^2+(x^2-1)^2), y*(-x^2-y^2+1)-x*(y^2+(x^2-1)^2)}, {x, y})

{x = 0, y = 0}, {x = RootOf(_Z^8-6*_Z^6+11*_Z^4-6*_Z^2+2), y = RootOf(_Z^8-6*_Z^6+11*_Z^4-6*_Z^2+2)^5-3*RootOf(_Z^8-6*_Z^6+11*_Z^4-6*_Z^2+2)^3+RootOf(_Z^8-6*_Z^6+11*_Z^4-6*_Z^2+2)}, {x = 1, y = 0}, {x = -1, y = 0}, {x = RootOf(_Z^2-2), y = RootOf(_Z^2+1)}

(1)

subs({x = .5, y = -.5}, x*(-x^2-y^2+1)+y*(y^2+(x^2-1)^2))

-.15625

(2)

sys := [x*(-x^2-y^2+1)+y*(y^2+(x^2-1)^2), y*(-x^2-y^2+1)-x*(y^2+(x^2-1)^2)]

[x*(-x^2-y^2+1)+y*(y^2+(x^2-1)^2), y*(-x^2-y^2+1)-x*(y^2+(x^2-1)^2)]

(3)

A := Jacobian(sys, [x, y])

Matrix(%id = 18446746360039790702)

(4)

latex(Matrix(2, 2, {(1, 1) = -2, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0}))

 \left[ \begin {array}{cc} -2&0\\ \noalign{\medskip}0&0\end {array}
 \right]

 

A1 := subs([x = 1, y = 0], A)

Matrix(%id = 18446746360040191630)

(5)

A2 := subs([x = -1, y = 0], A)

Matrix(%id = 18446746360040194406)

(6)

A3 := subs([x = 0, y = 0], A)

Matrix(%id = 18446746360040197166)

(7)

r1, e1 := Eigenvectors(A1)

Vector[column](%id = 18446746360083677662), Matrix(%id = 18446746360083677782)

(8)

r2, e2 := Eigenvectors(A3)

Vector[column](%id = 18446746359967554606), Matrix(%id = 18446746359967554726)

(9)

NULL


 

Download as22a_new.mw

Here is the procedure that inserts a rational number with the lowest denominator (vv's assumption) between any 2 list items. If there are several such numbers, then the smallest number is inserted.

FindSamples:=proc(sourcesamples)
local N, P;
N:=nops(sourcesamples);
P:=proc(a,b)
local a1, b1, m1, n, m;
if a=b then error "Should be a<>b" fi;
a1,b1:=op(convert(sort([a,b],(x,y)->evalf(x)<evalf(y)),rational));
for n from 1 do
m1:=a1*n;
m:=`if`(type(m1,integer),m1+1,ceil(m1));
if is(m/n>a1) and is(m/n<b1) then return m/n fi;
od;
end proc:
[ceil(sourcesamples[1])-1, seq(op([sourcesamples[i],P(sourcesamples[i],sourcesamples[i+1])]), i=1..N-1),sourcesamples[N],floor(sourcesamples[N])+1];
end proc:

The usage for your example:
sourcesamples :=[evalf(-1-sqrt(7)), -2, 1, evalf(-1 + sqrt(7)), 2];
FindSamples(sourcesamples);
                    

The main role in this procedure is played by the subprocedure  P , which returns a rational number between   and   with the lowest denominator. Here is a specific example of the application of this procedure: Take 2 numbers 3.14 and 3.15 (these are approximations of the number  Pi  with 3 digits with a deficiency and an excess) and find the intermediate number with the lowest denominator:

P:=proc(a,b) 
local a1, b1, m1, n, m; 
if a=b then error "Should be a<>b" fi;
a1,b1:=op(convert(sort([a,b],(x,y)->evalf(x)<evalf(y)),rational)); 
for n from 1 do 
m1:=a1*n; 
m:=`if`(type(m1,integer),m1+1,ceil(m1)); 
if is(m/n>a1) and is(m/n<b1) then return m/n fi; 
od;
end proc:
P(3.14, 3.15);

                         
 
Edit. The procedure  P  has been improved. Now it works much faster.

First, we complete the squares to estimate the ranges for the loop variables.
There are 2 integer solutions:

restart;
Eq:=7*(x^2+y^2+z^2)+2*x+4*y-8*z-8;
Student:-Precalculus:-CompleteSquare(Eq, [x,y,z]);
Eq1:=%/7; k:=0: T:=table(): 
for x from -2 to 2 do
for y from -2 to 2 do
for z from -2 to 2 do
if Eq=0 then k:=k+1; T[k]:=[x,y,z] fi;
od: od: od:
T:=convert(T,list);

               

      

Two syntax errors:
1. N/2  should be a positive integer.
2. Should be  add  instead of  sum.

Your example:

N:=10:
A:=Array(1..N/2);
add(A);

 

Here is your example automatically. It works for an arbitrary list:

restart;
L:= [-1+sqrt(7), -1 - sqrt(7)]:

L1:=sort(L,(x,y)->evalf(x)<=evalf(y));
m:=floor(L1[1]);  M:=ceil(L1[-1]);
[$ m..M, op(L)];
samples:=sort(%, (x,y)->evalf(x)<=evalf(y));
evalf(samples);

                    

Edit. If you need to insert something between the list items, you can do so:

[seq(op([A,s]), s=samples), A];

    

 

solve(a*x^2 + b*x + c=0, x, parametric=true, real);

                         

 

Here is a simple procedure that allows you to beautifully plot graphs in 3D. Required parameters: Names - the list of  vertex names, Coords - the list of vertex coordinates, Edges - the set of edges. Opt  is an optional parameter that determines the graphic properties of objects (the color of the vertices, the size of the vertices (as a fraction of the average distance between the vertices), the color of the edges, the thickness of the edges).

 

restart;
DrawGraph3D:=proc(Names::list,Coords::list, Edges::set(set), Opt::list:=[gold,0.05,brown,3])
local n, Dist, f, h, V, L, T;
uses plottools, plots, ListTools;
n:=nops(Edges);
Dist:=(A,B)->sqrt((A[1]-B[1])^2+(A[2]-B[2])^2+(A[3]-B[3])^2);
f:=x->Coords[Search(x,Names)];
h:=add(map(x->Dist(f(x[1]),f(x[2])), convert(Edges,list)))/n;
V:=seq(sphere(c,Opt[2]*h,style=surface,color=Opt[1]), c=Coords);
L:=seq(line(f(c[1]),f(c[2]),color=Opt[3],thickness=Opt[4]), c=Edges);
T:=textplot3d([seq([f(c)[1],f(c)[2],f(c)[3]+0.05*h,c], c=Names)], font=[times,16],align={left,above});
display(V, L, T, scaling=constrained, axes=none);
end proc:


Examples of use

DrawGraph3D([a,b,c,d],[seq([cos(2*Pi*k/3),sin(2*Pi*k/3),0],k=0..2),[0,0,1]],{{a,b},{b,c},{c,a},{d,a},{d,b},{d,c}},[red,0.06,blue,2]);

DrawGraph3D([$ 1..7],[seq([cos(2*Pi*k/5),sin(2*Pi*k/5),0],k=0..4),[0,0,1],[0,0,-1]],{seq({i,i+1},i=1..4),{5,1},seq({6,i},i=1..5),seq({7,i},i=1..5)}); # Graphic options by default

 

 


 

Download DrawGraph3D_2.mw

Animation of this picture:

plots:-animate(plots:-display,[plottools:-rotate(%,phi,[[0,0,0],[0,0,1]])], phi=0..2*Pi, frames=60);

                   

 

 

Edit.

First 67 68 69 70 71 72 73 Last Page 69 of 289