Kitonum

21500 Reputation

26 Badges

17 years, 60 days

MaplePrimes Activity


These are answers submitted by Kitonum

I understood the  "identify"  word as the need to collect identical objects into separate groups (lists). The code below does this:

restart;
Eq1:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]+183.346494441862*`τu`[2, 2]-1069.52121757753*`τu`[3, 2]+178.253536262923*`τu`[1, 3]-1069.52121757753*`τu`[2, 3]+6238.87376920228*`τu`[3, 3]:
Eq2:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]-91.6732472209439*`τu`[3, 2]+178.253536262923*`τu`[1, 3]+356.507072525849*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-3/7:
Eq3:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]+356.507072525849*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]-91.6732472209439*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-9/7:
Eq4:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]+20.3718327157631*`τu`[2, 2]+30.5577490736484*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]+30.5577490736484*`τu`[2, 3]+45.8366236104784*`τu`[3, 3]-12/7:
Eq5:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]+50.9295817894067*`τu`[1, 2]-305.577490736439*`τu`[2, 2]+1782.53536262923*`τu`[3, 2]+504.202859715131*`τu`[1, 3]-3025.21715829077*`τu`[2, 3]+17647.1000900295*`τu`[3, 3]-18/7:
Eq6:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+50.9295817894067*`τu`[1, 2]+101.859163578814*`τu`[2, 2]+152.788745368241*`τu`[3, 2]+504.202859715131*`τu`[1, 3]+1008.40571943027*`τu`[2, 3]+1512.60857914560*`τu`[3, 3]-3:
Eq7:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]-91.6732472209439*`τu`[3, 2]+178.253536262923*`τu`[1, 3]+356.507072525849*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-3/7:
Eq8:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]+20.3718327157631*`τu`[2, 2]+30.5577490736484*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]+30.5577490736484*`τu`[2, 3]+45.8366236104784*`τu`[3, 3]-12/7:
Eq9:=41.7622570673196*`τu`[3, 1]+41.7622570673196*`τu`[1, 3]+15.2788745368220*`τu`[1, 1]+83.5245141346398*`τu`[2, 3]+30.5577490736443*`τu`[2, 1]+113.063671572516*`τu`[3, 3]+83.5245141346398*`τu`[3, 2]+30.5577490736443*`τu`[1, 2]+61.1154981472892*`τu`[2, 2]:

S:=[seq([i,Eq||i], i=1..9)];
S1:=[ListTools:-Categorize((u,v)->u[2]=v[2], S)];
map(t->op~(1,t), S1);
op(select(t->nops(t)>1, %));

The final result:     
                                    [2, 7], [4, 8]


If you just need to remove duplicates, then do

{seq(Eq||i, i=1..9)};

 

If we divide the total area of all the necessary pieces of plywood into the area of 1 standard plywood sheet  48*96=4608, we get about 2.56. Thus, at least 3 standard sheets are required. I just cut out proportional sized pieces of paper and in 10 minutes I found the right solution. Thus, 3 standard sheets are needed. All calculations and visualization are below. For ease of identification, pieces of the same size are painted in the same color. All sizes are in inches.

restart;

4 - "40.625 x 20" - green
2 - "36 x 20" - blue
2 - "34.75 x 20" - khaki
3 - "33.75 x 12" - cyan
6 - "18.825 x 12" - red
3 - "32.5 x 12" - pink
3 - "33.75 x 19.5" - gold

S[0]:=48*96; S[1]:=40.625*20; S[2]:=36*20; S[3]:=34.75*20; S[4]:=33.75*12; S[5]:=18.825*12; S[6]:=32.5*12; S[7]:=33.75*19.5;
L:=[4,2,2,3,6,3,3];
add(L[i]*S[i], i=1..7)/S[0];

4608

 

812.500

 

720

 

695.00

 

405.00

 

225.900

 

390.0

 

658.125

 

[4, 2, 2, 3, 6, 3, 3]

 

2.559629991

(1)


Code for a visualization

with(plottools): with(plots):
Colors:=[green,blue,khaki,cyan,red,pink,gold,yellow]:

A1:=rectangle([0,20],[40.625,0], color=Colors[1]):
A2:=rectangle([0,20+20],[40.625,20], color=Colors[1]):
A3:=rectangle([0,20+40],[40.625,40], color=Colors[1]):
A4:=rectangle([0,20+60],[40.625,60], color=Colors[1]):
A5:=rectangle([0,20*4+12],[33.75,0], color=Colors[4]):
A:=polygon([[40.625,0],[48,0],[48,96],[0,96],[0,92],[33.75,92],[33.75,80],[40.625,80]], color=Colors[8]):
T1:=textplot([[20,10,"40.625 x 20"],[20,30,"40.625 x 20"],[20,50,"40.625 x 20"],[20,70,"40.625 x 20"],[17,85,"33.75 x 12"]], font=[times,14]):
A11:=display(seq(A||k,k=1..5),A,T1):

B1:=rectangle([0,34.75],[20,0], color=Colors[3]):
B2:=rectangle([20,34.75],[32,1], color=Colors[4]):
B3:=rectangle([32,34.75],[44,1], color=Colors[4]):
B4:=rectangle([0,34.75+33.75],[19.5,34.75], color=Colors[7]):
B5:=rectangle([19.5,34.75+33.75],[19.5*2,34.75], color=Colors[7]):
B6:=rectangle([0,34.75+33.75+19.5],[33.75,34.75+33.75], color=Colors[7]):
B7:=rectangle([33.75,34.75+33.75+18.825],[33.75+12,34.75+33.75], color=Colors[5]):
B:=polygon([[20,0],[48,0],[48,96],[0,96],[0,34.75+33.75+19.5],[33.75,34.75+33.75+19.5],[33.75,34.75+33.75+18.825],[33.75+12,34.75+33.75+18.825],[33.75+12,34.75+33.75],[19.5*2,34.75+33.75],[19.5*2,34.75],[44,34.75],[44,1],[20,1]], color=Colors[8]):
T2:=textplot([[70,18,"34.75 x 20",'rotation' = (1/2)*Pi],[70,50,"33.75 x 19.5",'rotation' = (1/2)*Pi],[85,50,"33.75 x 19.5",'rotation' = (1/2)*Pi],[77,80,"33.75 x 19.5"],[86,18,"33.75 x 12",'rotation' = (1/2)*Pi],[97,18,"33.75 x 12",'rotation' = (1/2)*Pi],[100,77,"18.825 x 12",'rotation' = (1/2)*Pi]], font=[times,14]):
B11:=display(translate(display(seq(B||k,k=1..7),B),60,0),T2):

C1:=rectangle([0,32.5],[12,0], color=Colors[6]):
C2:=translate(C1,12,0):
C3:=translate(C1,24,0):
C4:=rectangle([36,18.825],[48,0], color=Colors[5]):
C5:=seq(translate(C4,0,18.825*k), k=1..4):
C6:=rectangle([0,52.5],[36,32.5], color=Colors[2]):
C7:=translate(C6,0,20):
C8:=rectangle([0,92.5],[34.75,72.5], color=Colors[3]):
C:=polygon([[0,92.5],[34.75,92.5],[34.75,72.5],[36,72.5],[36,96-18.825*5],[48,96-18.825*5],[48,96],[0,96]], color=Colors[8]):
T3:=textplot([[126,16,"32.5 x 12",'rotation' = (1/2)*Pi],[138,16,"32.5 x 12",'rotation' = (1/2)*Pi],[150,16,"32.5 x 12",'rotation' = (1/2)*Pi],seq([164,9+18.825*k,"18.825 x 12",'rotation' = (1/2)*Pi],k=0..4),[138,42,"36 x 20"],[138,62,"36 x 20"],[138,84,"34.75 x 20"]], font=[times,14]):
C11:=display(translate(display(seq(C||k,k=1..8),C), 120,0),T3):

display(A11,B11,C11, scaling=constrained, size=[950,540], axes=none);

 

 

 

                 

Plywood1.mw  

Use the  isolve  command for this:


 

eq1 := [isolve({2*m-5 < 0, -3*m <= 5})]

[{m = -1}, {m = 0}, {m = 1}, {m = 2}]

(1)

nops(eq1)

4

(2)

``

``

eq2 := [isolve({m-3 < 0, -m <= 6})]

[{m = -6}, {m = -5}, {m = -4}, {m = -3}, {m = -2}, {m = -1}, {m = 0}, {m = 1}, {m = 2}]

(3)

nops(eq2)

9

(4)

``

 

Addition. Unfortunately,  isolve  command is not effective enough and quite often (in more difficult situations) it does not cope with the task of finding integer points. On this occasion, look at these 2 posts:  https://www.mapleprimes.com/posts/202437-Integer-Points-In-Polyhedral-Regions  and  https://www.mapleprimes.com/posts/202542-Integer-Points-In-Curved-Regions

 

Download help_list_integer_equation_new.mw

This is the standard integer linear programming problem. See wiki  https://en.wikipedia.org/wiki/Cutting_stock_problem 

See also  How do I solve Cutting Stock Problem in Maple - MaplePrimes 

We project points  C  and  D  on the plane of the base of the cylinder. We get points  C'  and  D' . Obviously  ABC'D'  is a rectangle. For the origin we take the center of this rectangle, we direct the  x axis through the middle of  AB, and the  y axis through the middle of  BC' . Let  AB = a  and  C'B=b .  To find  a  and  b , we have a simple system of two equations with 2 unknowns. We solve it with Maple:

solve({a^2+b^2=6^2, b^2+2^2=a^2, a>0, b>0});

               {a = 2*5^(1/2),  b = 4}

Further finding the coordinates of all points is obvious.

If you want to enter those programmatically (without a palette directly from the keyboard) in 1D Input or 2D Input modes, then this can be done as in the examples below:

conjugate(a); 
`#mover(mi("a"),mo("~"))`;
`#mover(mi("a"),mo("&circ;"))`;
`#mover(mi("a"),mo("&rarr;"))`;

Output:
                                     

 

You can write even shorter with the same result:

restart;
f := (Pi*x+2*c+2*m)/(mu__c*S)+2*epsilon/(mu__a*S)+(Pi*x+2*c)/(mu__s*S);
int(1/f, x=0..w)   assuming positive;

You can simplify the final result a little:

combine(%) assuming positive;

 

I removed the double quotes and added 2 more options:

restart;
f:=x->1/x^2:
plot(f(x), x = -10 .. 10, thickness = 3, labels = ["", ""], tickmarks = [[4 = infinity, -4 = -infinity], [0]], view = [-6 .. 6, 0 .. 5], scaling = constrained, size = [900, 375]);

 

If you mean the  FunctionAdvisor  command then it appeared in Maple 9 in 2003. 
See  ?updates,v9

restart;
Sys:={x=a/(1+C^2)^(3/2), y=a*C^3/(1+C^2)^(3/2)}:
simplify(map(t->t^(2/3), Sys));
`+`(op(%));
applyop(simplify,2,%) assuming a>0, C>0;

                    


In fact, of course, the original set  {x=..., y=...}  does not coincide with the set  x^(2/3)+y^(2/3)=a^(2/3) , since for a chosen parameter  a  sign of  x  will always coincide with the sign of  a  (in my interpretation without the minus). However, under the conditions  a>0, C>0, x>=0, y>=0  these sets coincide.

Try

f:=(l::list)-> eval([y,y*z-x,-15*x*y-x*z-x],zip(`=`,[x,y,z],l));

f([1,2,3]);
                              
[2, 5, -34]


But why not just write

f:=(x,y,z)-> [y,y*z-x,-15*x*y-x*z-x];

f(1,2,3); 
                                
 [ 2,5,-34]  

  


                             

  

   

# Ellips x^2/a^2+y^2/b^2=1, a>b
# Circle x^2+y^2=a^2
# The ellipse is obtained by compressing the circle to the Ox axis with a coefficient k=b/a

a:=5: b:=3: k:=b/a:
F:=plottools:-transform((x,y)->[x,k*y]):
A:=plot([a*cos(t),a*sin(t), t=0..2*Pi], color=blue, thickness=2):
plots:-display(A, F(A));

 

Your problem is the problem of finding  the geometric median  for a finite set of points. See  https://en.wikipedia.org/wiki/Geometric_median

If not all points lie on one straight line, then the solution is always unique  as in your example . Otherwise (all points on one straight line) if there are an even number of points, then there are infinitely many solutions, as in the example below:

Points:=[0, 1, 3, 10]:
plot(add(abs(x-p), p=Points), x=-2..12);


Unfortunately, both commands below do not solve this simple example:

restart;
Points:=[0, 1, 3, 10]:
S:=add(abs(x-p), p=Points);
minimize(S, location);
Optimization:-Minimize(S);

 

Coordinates of points found wrong. You can take (for example) as below

with(geom3d):
point(B, -3/2, -2, 0):
point(A, 3/2, -2, 0):
point(C, -3/2, 2, 0):
point(S, x, y, z):
solve([distance(S, A) = 3, distance(S, B) = 5, distance(S, C) = 7], [x, y, z], explicit);


I just swapped the points  A  and  B .

The method you are referring to is based on the usual shift and has a significant drawback - the thickness of such a surface in different places will be different. This is clearly seen in 2D-examples below. In the first plot, the second curve is obtained by shifting the parabola  y=x^2  by 0.1 up. In the second graph, the second curve passes through the ends of the all normals with the length 0.1 at the points of the parabola  y=x^2 :

restart;
plot([x^2, x^2+0.1], x=-1.5..1.5, color=black, scaling=constrained);
A:=plot(x^2, x=-1.5..1.5, color=black, scaling=constrained):
B:=plot([x-2*x/sqrt(1+4*x^2)*0.1, x^2+1/sqrt(1+4*x^2)*0.1, x=-1.5..1.5], color=black, scaling=constrained):
plots:-display(A, B);

                         


Below is the same method with normals applied to the surface defined by the explicit equation  z=x^2-y^2. For clarity, both sides of the surface and its end face are made in different colors:

f:=(x,y)->x^2-y^2:
A:=plot3d(f(x,y), x=-1..1, y=-1..1, color=pink, style=surface):
Dx:=diff(f(x,y),x): Dy:=diff(f(x,y),y):
d:=sqrt(Dx^2+Dy^2+1): h:=0.1:
B:=plot3d([x-Dx/d*h,y-Dy/d*h,f(x,y)+h/d], x=-1..1, y=-1..1, color=blue, style=surface):
C1:=plot3d([1-2/sqrt(2^2+Dy^2+1)*h*s,y-Dy/sqrt(2^2+Dy^2+1)*h*s,f(1,y)+h*s/sqrt(2^2+Dy^2+1)], s=0..1, y=-1..1, color=cyan, style=surface):
C2:=plot3d([-1+2/sqrt(2^2+Dy^2+1)*h*s,y-Dy/sqrt(2^2+Dy^2+1)*h*s,f(-1,y)+h*s/sqrt(2^2+Dy^2+1)], s=0..1, y=-1..1, color=cyan, style=surface):
C3:=plot3d([x-Dx/sqrt(Dx^2+2^2+1)*h*s,1+2/sqrt(Dx^2+2^2+1)*h*s,f(x,1)+h*s/sqrt(Dx^2+2^2+1)], s=0..1, x=-1..1, color=cyan, style=surface):
C4:=plot3d([x-Dx/sqrt(Dx^2+2^2+1)*h*s,-1-2/sqrt(Dx^2+2^2+1)*h*s,f(x,-1)+h*s/sqrt(Dx^2+2^2+1)], s=0..1, x=-1..1, color=cyan, style=surface):
plots:-display(A, B, C1, C2, C3, C4, axes=none);

                         

Exactly the same method can be used for a surface defined parametrically, only the formulas for the normals will be different. For a surface specified implicitly, some technical difficulties arise in the implementation of this method, but I can roughly imagine how they can be solved. Soon I am going to write a post with a procedure to automate all the steps in this plotting.

thick.mw

First 81 82 83 84 85 86 87 Last Page 83 of 290