Kitonum

21530 Reputation

26 Badges

17 years, 85 days

MaplePrimes Activity


These are answers submitted by Kitonum

Two circle may touch internal or external way. Therefore, we have 8 systems to find solutions. In this example there are four solutions:

restart;

P:=combinat[permute]([1$3,-1$3], 3);  # All variants of arrangements of signs in the systems

n:=0:

for p in P do

S:=[solve({x0^2+y0^2=(r+p[1]*5)^2, (x0-5)^2+(y0-4)^2=(r+p[2]*2)^2, (x0-13)^2+y0^2=(r+p[3]*3)^2}, explicit)];

for s in S do

if evalf(rhs(s[1]))>=0 and Im(rhs(s[2]))=0 and Im(rhs(s[3]))=0 then n:=n+1; L[n]:=s; fi;

od: od:

convert(L, list);  # All the solutions

M:=evalf(%); 

 

 The code is general in nature and it can easily be re-written as a procedure.

 

Visualization (original circles are green):

C1:=x^2+y^2=25: C2:=(x-5)^2+(y-4)^2=4: C3:=(x-13)^2+y^2=9:   # The equations of original circles

for k from 1 to 4 do

C[k]:=eval((x-x0)^2+(y-y0)^2=r^2, M[k]): # The equations of found circles.

od:

plots[implicitplot]([C1,C2,C3,seq(C[k],k=1..4)], x=-12..22, y=-12..10, thickness=[3$3,2$4], color=[green$3, red,blue,yellow,violet], scaling=constrained, gridrefine=3);

 

 

The simple procedure  CyclePerm  solves your problem:

restart;

CyclePerm:=proc(L::list)

local n;

n:=nops(L);

seq([op(L[i..n]), op(L[1..i-1])], i=1..n);

end proc:

 

Your example:

CyclePerm([1,2,3]);

[1,2,3], [2,3,1], [3,1,2]

 

or in the for cycle for yours or similar example:

L:=[1,2,3]:  n:=nops(L):

for i from 1 to n do

op(L[i..n]), op(L[1..i-1]);

od;

               1,2,3

               2,3,1

               3,1,2

See the main rules here

For greater accuracy, use a spline approximation. With an increase in the degree of the spline (default value  is 3) the accuracy increases. 

 

Examples:

y:=unapply(CurveFitting[Spline](<seq(x, x=0..1, 0.1)>,<seq(x^2, x=0..1, 0.1)>, x), x):

y1:=unapply(CurveFitting[Spline](<seq(x, x=0..1, 0.1)>,<seq(x^2, x=0..1, 0.1)>, x, degree=5), x):

int(y, 0..1);

int(y1, 0..1);

                                                                    0.3334295580

                                                                    0.3333333333

 

um_vue 10

a1 := Matrix(3, 4, [1, 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 16]):

a2 := Matrix(3, 2, [5, 6, 11, 12, 17, 18]):

a3 := Matrix(2, [19, 20, 25, 26]):

a4 := Matrix(2, 4, [21, 22, 23, 24, 27, 28, 29, 30]):

<<a1|a2>, <a3|a4>>;  # your matrix

                              

Or even shorter :

<a1,a2; a3,a4>;

 

You can download  OrthogonalExpansions  package  for Maple from here  This package includes commands for working with Fourier series.

If given a curve in the plane by its parametric equations  L := [x(t), y(t), t=t1 .. t2]  then the following simple procedure  RotationAroundOy  helps you to plot the surface of rotation of  L  around Oy-axis.

Code of the procedure:

RotationAroundOy := proc(L)

plot3d([abs(L[1])*cos(phi), L[2], abs(L[1])*sin(phi)], L[3], phi = 0 .. 2*Pi);

end proc:

 

Example of use:

L1 := [t, t, t = 2 .. 4]:  # the line segment in 2D

L2 := [cos(t)+3, sin(t), t = 0 .. 2*Pi]:   # the circle in 2D

plots[display](RotationAroundOy~([L1, L2]), axes = normal, view = [-4.9 .. 4.9, -1.9 .. 4.9, -4.9 .. 4.9]);

                     

 

Instead of two objects  L1  and  L2  as in the example, you can specify any number of objects. 

plottools[getdata](plot(x^2-4, x=-3..3));

For plotting spacecurves in Maple 2015  linestyle=solid  option is required.

Comparison of 2 ways:

restart;

A:=plots[spacecurve]([cos(t), sin(t),t], t=1..5, linestyle=solid, axes=framed):

B:=Student[VectorCalculus][SpaceCurve](<cos(t),sin(t),t>,t=1..5, linestyle=solid, axes=framed):

plots[display](<A|B>);

I arbitrarily added the initial condition  g(0) = 0.5 :

sol := dsolve({diff(f(x), x,x)+6*x*(diff(f(x), x))+f(x), diff(g(x), x) = f(x)*g(x), f(0) = 0, g(0) = 0.5, D(f)(0) = 1}, type = numeric);

 

Use  seq  command instead of for loop:

L:=[-3, -2.5, 0, 1, 3/2, Pi, sqrt(5)];

seq([s, type(s,nonnegint)], s=L);

 

 

 

A:=Matrix([[1,2,3], [4,5,6]]);

A[..,1..2];

                       

 

 

I have changed the last two lines of Preben's code:

1) With the command  simplify  with option  zero , I removed all the zero imaginary parts.
2) The vector of eigenvalues was converted to the list.
3) The matrix of eigenvectors converted into a sequence of explicit column-vectors

convert(simplify(L, zero), list);   #The list of eigenvalues

seq(simplify(V, zero) [ .. , i], i = 1 .. 12);   #The  eigenvectors corresponding to the eigenvalues, in order

by only the single  plot  command:

plot([x^2-4, [[-2, 0],[2, 0]]], x = -2.9 .. 2.9, style = [line, point], color = [blue, red], thickness = 2, symbol= solidcircle, symbolsize = 20, scaling = constrained);

                                            

 

 

with(geometry):

Eq:=x=9*t^2 + 3*t  + 367,y=3*t^2 + 2*t + 122:

eliminate({Eq}, t);

conic(c,op(%[2]),[x,y]);

detail(c);

plot([rhs~([Eq])[],t=-0.5..0.1], color=red,thickness=3);

 

 

 

Plotting on the basis of parametric equations (without additional options) provides higher quality graphics than with the implicit equation.

First 205 206 207 208 209 210 211 Last Page 207 of 290