13290 Reputation

24 Badges

11 years, 43 days

MaplePrimes Activity

These are answers submitted by Kitonum

This is the standard integer linear programming problem. See wiki 

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:




You can write even shorter with the same result:

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:

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

Sys:={x=a/(1+C^2)^(3/2), y=a*C^3/(1+C^2)^(3/2)}:
simplify(map(t->t^(2/3), Sys));
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.


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

[2, 5, -34]

But why not just write

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

 [ 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:
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

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:

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


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

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 :

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:

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.

We get 2 solutions:

A := [0, 0, 0];
B := [c, 0, 0];
S := [x, 0, z];
solve([Distance(S, A) = a, Distance(S, B) = b], [x, z], explicit) assuming a > 0, b > 0, c > 0;

Obviously, the solutions have a geometric meaning if the triangle inequalities  are hold for the parameters  a, b, c

Of course, degenerate cases are also possible when the solution is unique ( z=0  and the points  A, B, S  lie on the same line ). It will be if  a=b+c  or c=a+b  or b=a+c :

Sol:=solve([Distance(S, A) = a, Distance(S, B) = b], [x, z], explicit) assuming a > 0, b > 0, c > 0;
simplify(eval(z,Sol[1]), {a=b+c});
simplify(eval(z,Sol[1]), {b=a+c});
simplify(eval(z,Sol[1]), {c=a+b});


the selection from first level operands (as you wanted):

select(t->type(t,{ln(anything),ln(anything)^anything}), %);

                           {ln(x+y)^2, ln(y)}


Maybe you should abandon a polar grid and do as in the example below:

plots:-polarplot(t,t=0..Pi,color=black, thickness=3, coordinateview = [0 .. Pi, 0 .. Pi]);
plot(t,t=0..Pi,color=black, thickness=3, coords=polar, scaling=constrained, gridlines);



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