Kitonum

8246 Reputation

17 Badges

8 years, 254 days

MaplePrimes Activity


These are answers submitted by Kitonum

for the curve  x=cos(3*t), y=sin(2*t), t = 0 .. 2*Pi . 

restart;
plot([cos(3*t), sin(2*t), t = 0 .. 2*Pi]);
Sol:=solve({cos(3*t1)=cos(3*t2), sin(2*t1)=sin(2*t2)}, explicit);
simplify([Sol]);
map(t->[cos(3*rhs(t[1])),sin(2*rhs(t[1]))], convert(%,set));
% minus {%[-1]};  
# The final result

plots:-inequal (for nonlinear curves)  and  plots:- shadebetween  commands appear only in the latest versions of Maple. For older versions,  filledregions=true  option can be used (in new versions it works also):

f:= x-> -x^2+3*x+2:
l:= x-> 4*x:
m:= x-> 2*x-4:
plots:-display(plots:-implicitplot(max(y-f(x), y-l(x), m(x)-y, -y)<0,  x= -1.5..4.5, y= -1.5..5.5, coloring = ["LightCyan", white], filledregions = true, gridrefine=3), plot([f(x),l(x),m(x)], x= -1.5..4.5, y= -1.5..5.5, color=[red,green,blue], thickness=2), scaling=constrained);

                              

 

 

The same scale for each axis has been selected (scaling=constrained option)
 

The procedure  Check  solves the problem for a square matrix.

Check:=proc(A::Matrix)
uses LinearAlgebra;
is(`*`(convert(Eigenvalues(A), list)[ ])=Determinant(A));
end proc: 

 

Example of use:

A:=LinearAlgebra:-RandomMatrix(3, generator=0..9);
Check(A);

                                        

If you have several matrices, then just apply this procedure to each of them.


 

 

evala(convert(c, radical));

                                                     0

1.  RootOf  is a special way of presenting a solution, which is not always useful.
2. You have a rather complicated non-linear equation with several parameters. I think that it can be solved only numerically for specific values of the parameters and with the specified initial condition.

Example of numerical solution:

restart;
Eq:=diff(y(x), x) = -A*y(x)/x+x^alpha*(C+(y(x)^alpha/x^alpha-C)^(-`gamma`))/y(x)^alpha:
Sol:=dsolve({eval(Eq, [A=1,C=2,alpha=0.5,`gamma`=3]), y(1)=2}, numeric);
eval(y(x), Sol(2));  
# Calculation of the value y(2)
plots:-odeplot(Sol,[x,y(x)], x=1..5, view=[0..5,0..4]);  # The plot of y(x)

                 

 

 

 

This gives a higher quality:

restart;
expr:=x^2+y^2-2*y+1:
plot3d([r*cos(t), r*sin(t), eval(expr, [x=r*cos(t), y=r*sin(t)])], r=0..2, t=0..2*Pi, axes=normal, scaling=constrained);

 

Addition. One more way.

We can regard this surface as the image of the disk  x^2+y^2<=4  under the mapping  (x,y) -> (x, y, x^2+y^2-2*y+1). This method is useful in some cases:

Disk:=plot3d([r*cos(t),r*sin(t),0],r=0..2,t=0..2*Pi, style=surface, color=khaki):
f:=plottools:-transform((x,y)->[x,y,x^2+y^2-2*y+1]):
plots:-display(Disk, f(Disk), axes=normal, scaling=constrained);  
# The surface and its projection onto the xy-plane

                                     

 

 

Try the  plottools:-getdata  command.

Probably the paraboloid must be round and 0.25 is the maximum z-coordinate.

restart;
solve({eval(x^2/2+y^2/2, [x=R,y=0])=0.25, R>0});
assign(%):
plot3d([r*cos(phi),r*sin(phi),r^2/2], r=0..R, phi=0..2*Pi, scaling=constrained, axes=normal);

                        

 

For the complete solution of the problem, you need to find the surface area of this paraboloid.

In  GraphTheory  package there is no  copy  command, but there is  CopyGraph  command.

 

Addition. Example:

with(GraphTheory):
G := CycleGraph(5);
H := CopyGraph(G);
V:=[1,2,3]; 
HighlightVertex(H, V, red);
 DrawGraph(H);
 DrawGraph(G);

 

solve(20*x^3+10*x^2+4*x+1, explicit):  
20*(x-%[1])*map(simplify, sort(collect((x-%[2])*(x-%[3]), x)));
   # Exact factorization
evalf(%);   # Approximate factorization

Let  x=a*t ,  y=b*t+c

We have  cos(x)=cos(y)  and  sin(x)=sin(y)

These equalities are equivalent  to   x - y = 2*Pi*k ,  k  is integer

So  t = (c+2*Pi*k)/(a-b)

 

Conclusion: thus we see that the set of all solutions is the infinite arithmetic progression with initial term  c/(a-b)  (if  k=0)  and the common difference  2*Pi/(a-b)

 

Addition. The example of finding all solutions in a given interval  (0..20) for specific parameter values  [a=7,b=2,c=3]:

R:=eval((c+2*Pi*k)/(a-b), [a=7,b=2,c=3]);
K:=[isolve({R>=0,R<=20})];
seq(eval(R,k), k=K);

 

The first procedure uses  Partition  procedure from here. It gives all possible partitions of an odd number  >=9  into 3 prime summands.

PartitionOfOdd:=proc(n::odd)
local p;
uses NumberTheory;
p:=prevprime(n);
Partition(n, 3, {seq(ithprime(k),k=2..pi(n))});
end proc:

 

Example of use:

PartitionOfOdd(63);

[ [3, 7, 53], [3, 13, 47], [3, 17, 43], [3, 19, 41], [3, 23, 37], [3, 29, 31], [5, 5, 53], [5, 11, 47], [5, 17, 41], [5, 29, 29], [7, 13, 43], [7, 19, 37], [11, 11, 41], [11, 23, 29], [13, 13, 37], [13, 19, 31], [17, 17, 29], [17, 23, 23] ]

 

The second procedure gives only 1 partition, but it is much faster than the first one:

PartitionOfOdd1:=proc(n::odd)
local N, i, j, a, b, c;
uses NumberTheory;
N:=pi(n);
for i from 2 to N-1 do
for j from 2 to N-1 do
a:=ithprime(i); b:=ithprime(j); c:=n-a-b;
if isprime(c) then return [a,b,c] fi;
od; od;
end proc: 

 

Example of use:

PartitionOfOdd1(123456789);

                                                           [3, 29, 123456757]


 

Here is an example of animation of matrixplot . It was exported as  gif - file:

A:=LinearAlgebra:-RandomMatrix(7, generator = 0 .. 9);
P:=plots:-matrixplot(A, heights = histogram, axes = normal):
f:=t->plottools:-rotate(P, t, [[0,0,0],[0,0,1]]):
plots:-animate(f,[t], t=0..2*Pi, frames=90, scaling=constrained); 

                                            

 

 

Addition. Another example - the rotation with the axes:

A:=LinearAlgebra:-RandomMatrix(7, generator = 0 .. 9):
plots:-matrixplot(A, heights = histogram, axes = normal):
f:=t->plots:-matrixplot(A, heights = histogram, axes = normal, orientation=[-t,60]):
plots:-animate(f,[t], t=0..360, frames=90, scaling=constrained);

                                                   

ThirdDer := proc(f::procedure, x0, h)
(f(x0+2*h)-2*f(x0 +h)+2*f(x0 -h)-f(x0 -2*h))/2/h^3;
end proc: 

 

Example of use:

ThirdDer(sin, Pi, 0.01);

                                               0.9999800000

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