Kitonum

21173 Reputation

26 Badges

16 years, 223 days

MaplePrimes Activity


These are answers submitted by Kitonum

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);

                                                   

 

Colors are encoded as integers from 1 to 5.

restart;
L:=[seq(i$4, i=1..5)]:
P:=combinat:-permute(L,4):
k:=0:
for p in P do
if p[1]<>p[2] and p[2]<>p[3] and p[3]<>p[4] and p[4]<>p[1] 
then k:=k+1 fi;
od: 
k;

                                                                       260

Since  C=Pi-A-B , we have the problem of finding the minimum (or maximum) of a continuous function of two variables in a closed bounded area (this is a triangle  EFG  in the figure below). mmcdara showed that this function has no critical points in this region, so the minimum (or maximum) is necessarily reached at the boundary of the region. Therefore, the problem is reduced to finding the minimum of a function of one variable on the segments  EG, EF  and  FG .

The worksheet is not loading for some reason, so see the link below.

We see that the minimum is equal to 1/4 and is reached at the points  E(Pi/3, Pi/3)  and  G(Pi/2, Pi/4) , but if  A<Pi/2 , then only at the point  E .
 

Download problem.mw

restart;
P:=map(p->convert(p,Matrix,3,3), combinat:-permute([0$9,1$9],9)):
n:=0:
for p in P do
S:=convert~([p[1],p[2],p[3],p[..,1],p[..,2],p[..,3]],set);
if andmap(t->{0,1} subset t, S) then n:=n+1 fi;
od:
n;

                                                                    102

Unfortunately, Maple doesn't think to simplify the sum of the first and third terms after the simplification, but we can tell him to do so:

restart;
Expr:=G1*P3 + G1*P5 + G1*P6 + G2*P3 + G2*P6 + G3*P2 + G3*P5 + G4*P2 + G4*P3 + G4*P5 + G4*P6 + G5*P2 + G5*P3 + G5*P5 + G5*P6 + G6*P3 + G6*P6 + G7*P2 + G7*P5 + G8*P2 + G8*P3 + G8*P5 + G8*P6;
Expr1:=simplify(Expr);
L:=[op(Expr1)]:
t:=op(1,L)+op(3,L):
factor(t)+simplify(Expr-t); # The final result

G1*P3+G1*P5+G1*P6+G2*P3+G2*P6+G3*P2+G3*P5+G4*P2+G4*P3+G4*P5+G4*P6+G5*P2+G5*P3+G5*P5+G5*P6+G6*P3+G6*P6+G7*P2+G7*P5+G8*P2+G8*P3+G8*P5+G8*P6

 

(G1+G2+G4+G5+G6+G8)*P3+(G1+G3+G4+G5+G7+G8)*P5+(G1+G2+G4+G5+G6+G8)*P6+P2*(G3+G4+G5+G7+G8)

 

(G1+G2+G4+G5+G6+G8)*(P3+P6)+(G1+G3+G4+G5+G7+G8)*P5+P2*(G3+G4+G5+G7+G8)

(1)

 

Download simplification.mw

If we want the number  n  to match the number of petals, then

restart;
Rose:= (n::integer)-> plots:-polarplot(`if`(n::even,sin(n/2*t),sin(n*t)), filled, color= `if`(n::odd, pink, aquamarine)):

Rose(4);  Rose(3); # Examples

 

@mylikes  You didn't specify your version of Maple. It's probably a pretty old version if your code doesn't work. Try the two options below. The first option is the standard way to calculate the double integral. If it doesn't work, then try the second option, which reduces the double integral to a repeated one:
 

restart;
r:=-36*u^3*v*(-1 + u + v)*(3*u^2 + u*v - 5*u - 2*v + 2)/(-1 + u)^2;
int(r, [u=0..1-v, v=0..1]); # The first option
int(int(r, u=0..1-v), v=0..1);  # The second option

 

Examples:

ilog10(10110)+1;
ilog10(111010110)+1;

                                                        5
                                                        9

First 14 15 16 17 18 19 20 Last Page 16 of 287