Kitonum

21525 Reputation

26 Badges

17 years, 74 days

MaplePrimes Activity


These are answers submitted by Kitonum

1. You are trying to plot a curve in space as the intersection of two implicitly defined surfaces. The plotting of such lines is based on sign changes. But in your example, these 2 surfaces only touch each other, i.e. no sign changes.
2. Lines in space are best plotted using the  plots:-spacecurve  command, in which the line is given by its parametic equations.

restart;
P1:=plots:-implicitplot3d( [x^2 + b*x + c=0 , b^2 - 4*c=0], b = -4..4, c = -4..4, x = -4..4, style=surface, color=["Green","Yellow"],grid=[50,50,50]):
P2:=plots:-spacecurve([b, b^2/4, -b/2], b = -4..4, color=red, thickness=5, view=[-4..4,-4..4,-4..4], labels=[b,c,x]):
plots:-display(P1, P2);

                                             

 

restart;
sol:=dsolve({diff(y(x),x,x)+2*diff(y(x),x)^2+8*y(x)=0, y(0)=0 , D(y)(0)=1}, numeric);
plots:-odeplot(sol,[x,y(x)], x=0..10);

                                      

 

restart;
for oo to 2 do
    M[oo] := InertForm:-Display(EI/L,inert=false)*(4*theta(oo) + 2*theta(oo + 1));
end do;

                                 

 

This problem can be solved in 2 ways. Using the rotation matrix around some axis, we can obtain a parametrization of this rotation surface, i.e. its explicit parametric equations. But this is a rather cumbersome method, although the construction quality will be the highest. An easier and faster way is to use the  plottools:-rotate command which is implemented below:

 

restart;
f := x -> x^2+2:
g := x -> 1/2*x+1:

P1:=proc(a)
local L, L1, L2, L3, L11, Line;
uses plots, plottools;
L:=spacecurve([[0,t,f(t)],[0,t,g(t)]], t=0..1,color=red,thickness=3);
L1:=spacecurve([0,0,t], t=1..2, color=pink, thickness=0);
L2:=spacecurve([[0,t,f(t)],[0,t,g(t)]], t=0..1, color=pink, thickness=0);
L3:=spacecurve([0,1,t], t=3/2..3, color=pink,thickness=0);
L11:=display(L1,L2,L3);
Line:=line([0,0,8],[0,3,-1], color=blue, thickness=2);
display(L, Line, seq(rotate(L11,k*a/60,[[0,0,8],[0,2,2]]), k=1..60),rotate(L,a,[[0,0,8],[0,2,2]]), scaling=constrained, axes=normal, view=[-3.5..3.5,-0.5..4.5,-1.5..5.5]);
end proc:

plots:-animate(P1, [a], a=0..2*Pi, frames=90, orientation=[-15,65], paraminfo=false);

                                 
Edit. I remembered that the construction of the rotation matrix is automated in the  Student:-LinearAlgebra  subpackage. Below is the solution to this problem using the rotation matrix:

restart;
f := x -> x^2+2:
g := x -> 1/2*x+1:
M:=Student:-LinearAlgebra:-RotationMatrix(phi,<0,2,-6>):

P:=proc(a)
local Opt, T1, T2, v1, v2, v3, v4, P1, P2, P3, P4, L, Line;
uses plots, plottools;
Opt:=phi=0..a, color=pink;
T1:=v -> <v[1],v[2],v[3]+8>: T2:=v -> <v[1],v[2],v[3]-8>:
v1:=<0,x,f(x)>: v2:=<0,x,g(x)>: v3:=<0,0,t>: v4:=<0,1,t>:
P1:=plot3d(convert(T1(M.T2(v1)),list), x=0..1, Opt):
P2:=plot3d(convert(T1(M.T2(v2)),list), x=0..1, Opt):
P3:=plot3d(convert(T1(M.T2(v3)),list), t=1..2, Opt):
P4:=plot3d(convert(T1(M.T2(v4)),list), t=3/2..3, Opt):
L:=spacecurve([[0,t,t^2+2],[0,t,t/2+1]], t=0..1,color=red,thickness=3):
Line:=line([0,0,8],[0,3,-1], color=blue, thickness=2);
display(P1,P2,P3,P4, L, Line, scaling=constrained, axes=normal, view=[-3.5..3.5,-0.5..4.5,-0.5..5.5]);
end proc:

plots:-animate(P, [a], a=0..2*Pi, frames=90,  orientation=[-15,65], paraminfo=false);

                                      

If you want to get a high-quality plot of a body of rotation, then it is better to use the  plot3d  command. I made an animation of getting this body (the scale along the axes is made the same scaling=constrained):

restart;
f := x -> x^2+2:
g := x -> 1/2*x+1:
V := int(f(x)^2 - g(x)^2,x=0..1)*Pi;

P:=proc(a)
local Opt, P1, P2, P3, P4, L;
uses plots;
Opt:=phi=Pi/2..a, color=pink;
P1:=plot3d([f(x)*cos(phi),x,f(x)*sin(phi)], x=0..1, Opt):
P2:=plot3d([g(x)*cos(phi),x,g(x)*sin(phi)], x=0..1, Opt):
P3:=plot3d([r*cos(phi),0, r*sin(phi)], r=1..2, Opt):
P4:=plot3d([r*cos(phi),1, r*sin(phi)], r=3/2..3, Opt):
L:=spacecurve([[0,t,t^2+2],[0,t,t/2+1]], t=0..1,color=red,thickness=3):
display(P1,P2,P3,P4,L, scaling=constrained, axes=normal, view=[-3.5..3.5,-0.5..3.5,-3.5..3.5]);
end proc:

plots:-animate(P, [a], a=Pi/2..2*Pi+Pi/2, frames=90, orientation=[40,75], paraminfo=false);




                                                  

 

 

Use the procedure form for the plotting:

restart;
h:=p->MapleTA:-Builtin:-inverf(p);
plot(h, -1..1);

 

Try the  parse  command for this.

Use the  PolyhedralSets  package.

restart;
L:=[[-1.5, -0.5, 0.], [-1.5, 0.5, 0.], [-1., -1., -0.7071067810], [-1., 1., -0.7071067810], [-0.5, -1.5, 0.], [-0.5, -0.5, -1.414213562], [-0.5, 0.5, -1.414213562], [-0.5, 1.5, 0.], [0.5, -1.5, 0.], [0.5, -0.5, -1.414213562], [0.5, 0.5, -1.414213562], [0.5, 1.5, 0.], [1., -1., -0.7071067810], [1., 1., -0.7071067810], [1.5, -0.5, 0.], [1.5, 0.5, 0.]]:
L1:=map(t->convert~(t,fraction), L);
with(PolyhedralSets):
P:=PolyhedralSet(L1):
Plot(P, scaling=constrained);

                                                 

or

Plot(P, style=line, scaling=constrained);

                                  

PS. I increased the number of digits when specifying the coordinates of some vertices (multiples of the root of 2). Otherwise, Maple finds that the vertices of the pentagons do not lie in the same plane and adds extra edges.


 

Maybe the following:

A:=<1,2;3,4>: B:=<6,7;8,9>:
A%.B=A.B;

                                   

Here is  a solution to the problem without the Iterator package (the package appeared for the first time in Maple 2016). This is important for those who have older versions of Maple. First, you must initialize the user procedure SumPartition. Below is the text of the procedure and 2 examples:
 

restart;
SumPartition:=proc(S::set)
local SetPartition, n, L, L1;
uses ListTools,combinat;
SetPartition:=proc(S::set, Q::list(posint))  # Procedure finds all partitions of the set  S  into subsets of the specific size given Q.
local L, P, T, S1, S2, n, i, j, m, k;
if `+`(op(Q))<>nops(S) then error "Should be `+`(op(Q))=nops(S)" fi;
L:=convert(Q,set);
T:=[seq([L[i],Occurrences(L[i],Q)], i=1..nops(L))];
P:=convert(T,set);
S1:=S;  S2:={{}}; n:=nops(P);
for i to n do
m:=P[i,1]; k:=P[i,2];
for j to k do
S2:={seq(seq({op(s),t}, t=choose(S1 minus `union`(op(s)),m)), s=S2)};
od; od;
S2;
end proc:
L:=partition(nops(S));
L1:=map(t->SetPartition(S,t)[], L);
map(t->convert~(t,`+`), L1);
end proc:


Examples:

SumPartition({a,b,c});
SumPartition({a,b,c,d});

                      [{a, b, c}, {a, b + c}, {b, a + c}, {c, a + b}, {a + b + c}]
[{a, b, c, d}, {a, b, c + d}, {a, c, b + d}, {a, d, b + c},   {b, c, a + d}, {b, d, a + c}, {c, d, a + b}, {a + b, c + d},  {a + c, b + d}, {a + d, b + c}, {a, b + c + d}, {b, a + c + d},   {c, a + b + d}, {d, a + b + c}, {a + b + c + d}]
 

In the context of your question, undefined is just a symbol (a common name for matrix items) and nothing more. This symbol can be short (consisting of one letter) or longer, like yours. If you want this symbol to be without indexes, do as below:

Matrix(2, 2, (i,j)->undefined);

 

We reduce the solution of the problem to the solution of a system of 4 equations with 4 unknowns. Unfortunately the  solve  command does not give an explicit result. We use the  fsolve  command, getting the result with high precision. The  identify  command gives a symbolic expression for the answer, that is, the length of AB is 28/3 cm

restart;
local D:
A:=<x,y>: B:=<-b,0>: C:=<c,0>: D:=<0,0>:
L:=X->sqrt(X[1]^2+X[2]^2):
Dist:=(X,Y)->L(X-Y):
Angle:=(X,Y)->arccos(X.Y/L(X)/L(Y)):
AB:=B-A: AD:=D-A: AC:=C-A:
Sys:={Dist(A,D)=4,Angle(AB,AD)=20*Pi/180,Angle(AC,AD)=80*Pi/180,b/c=4/3} assuming real;
Digits:=50:
fsolve(Sys, {x=0..infinity,y=0..infinity,b=0..infinity,c=0..infinity});
eval(Dist(A,B),%);
identify(%);

     

Download GP.mw

restart; 
expr:=[[(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)), 1.290994449*sqrt((-.1296*r+1.512*r^2-.36*r^3+6.1*r^4-2*r^5-0.72e-1*r^2*ln(10.*r)-.3*r^4*ln(10.*r)+(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))*(.216*r-2.52*r^2+.12*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))], [(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)), -1.290994449*sqrt((-.1296*r+1.512*r^2-.36*r^3+6.1*r^4-2*r^5-0.72e-1*r^2*ln(10.*r)-.3*r^4*ln(10.*r)+(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))*(.216*r-2.52*r^2+.12*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))]]:

plot([seq([expr[j][], r = 0 .. 1], j = 1 .. 2)], color = blue, numpoints=1000);

 

Here's a straight forward solution that doesn't use any special formulas.

Let us denote by  x  the number of students who made only the 1st and 3rd trips, by  y - only the 1st and 2 trips, by  z - only the 2nd and 3rd trips. In total we have  x+y+z+160  students at this School. The problem is reduced to solving a system of 3 equations with 3 unknowns:
 

restart;
Total:=x+y+z+160:
solve({x+160+y=50/100*Total, y+160+z=80/100*Total, z+160+x=90/100*Total});
eval(Total, %);

                               

 

 

restart;
convert((3*n-8)/(n-3), parfrac);

                                                   

 

First 16 17 18 19 20 21 22 Last Page 18 of 290