## 8662 Reputation

8 years, 348 days

## Re...

@Franzs  Just now I noticed this new thread that duplicates your previous question. Look there my comment.

@Franzs   Maple shows the specified color only those planes that are present when setting the body. Add inequality  z>=-40 :

with(PolyhedralSets);
P1 := PolyhedralSet({-x-20 <= 0, -x-20 <= 20-y, -x-20 <= -(1/2)*y, -x-20 <= -z, -x-20 <= -(x+y)*(1/2), -x-20 <= -(y+z)*(1/2), z>=-40});
Plot(P1, axes = normal, view = [-40 .. 40, -40 .. 40, -40 .. 40], orientation = [30, -30, -60], color = blue, thickness = 2);
Plot(P1, axes = normal, view = [-40 .. 40, -40 .. 40, -40 .. -40], orientation = [0, 0, 0], color = blue, thickness = 2);

Rotation of the initial figure around the z axis:

restart;
with(PolyhedralSets):
P1 := PolyhedralSet({-x-20 <= 0, -x-20 <= 20-y, -x-20 <= -(1/2)*y, -x-20 <= -z, -x-20 <= -(x+y)*(1/2), -x-20 <= -(y+z)*(1/2)}):
A:=Plot(P1, axes = normal, view = [-40 .. 40, -40 .. 40, -40 .. 40], orientation = [30, -30, -60], color = blue, thickness = 2):
f:=alpha->plottools:-rotate(A, alpha, [[0,0,0],[0,0,1]]):
plots:-animate(plots:-display, [f(alpha)], alpha=0..2*Pi, frames=90);

## Impossible also...

@asa12   You wrote: If change to F(exp(t)) = 2*t, is it possible?

No, because for  t=exp(1)  we have:

F(F(exp(t))) = F(2*t) = F(2*exp(1)) = F(exp(ln(2)+1) = 2*(ln(2)+1) <> 0

## expand...

@Markiyan Hirnyk   Use  expand  command first:

y=0.0000125698-0.0000125698*cos(54*x);
a:=convert(%,fraction);
b:=content(rhs(a), cos(54*x));
c:=primpart(rhs(a), cos(54*x));
y=b*``(c);
convert(%, float, 6);
diff(expand(rhs(%)), x);

## extrema and more...

@toandhsp The acer's method with  extrema  can also be used for this example, but one addition is needed. If the curve defining the relationship between the variables were smooth as in the initial example, then there would be no problems. But in this example there is the point  (x=4, y=3) lying on this curve in which the differentiability is broken. Therefore, this point must be checked separately for the presence of an extremum:

restart;
z:=x+I*y;
R:=evalc(3*abs(z-4-3*I)+4*abs(z-8-6*I) = 20);
is(eval(R, [x=4,y=3]));
is(eval(R, [x=8,y=6]));
a:=op(extrema(sqrt(x^2+y^2), {R}, {x,y}, 's'));
# The first candidate for an extremum
A:=[op(s[1])];
b:=simplify(eval(sqrt(x^2+y^2), [x=4,y=3]));
# The second candidate for an extremum
Min=min(a, b), Max=max(a, b);  # The results
plots:-display(plots:-implicitplot(R, x=0..9, y=0..8, color=blue, gridrefine=5), plottools:-disk([4,3], 0.1, color=red), plottools:-disk(rhs~(A), 0.1, color=red), view=[0..9,0..8]);  # Visualization

## ?...

@Markiyan Hirnyk  Sorry, but I do not understand your reaction. Maybe someone else can satisfy your curiosity.

## A continuous function defined on a segme...

@John Fredsted  For  z=x+I*y  we have a continuous function  (x,y)->sqrt(x^2+y^2)  defined on the segment connecting the points  A(-3, 2)  and  B(3, 8) . In fact, this will be a function of one variable, because  [x,y]=(1-t)*[-3,2]+t*[3,8]  or  x=6*t-3, y=2+6*t  for t in [0,1] . If an extremum (min  or  max) is reached within a segment, then this will be a critical point for this function, that is, the derivative at this point is 0. But the extremum can be reached at the ends of the segment and the corresponding points do not need to be critical. In this example, the maximum is reached at the end of the segment for  t = 1 .

## The easiest way...

@John Fredsted  I think this is the simplest way to solve this problem. The difference in efficiency is not too big:

primesInRange := (a::posint,b::posint) -> select(isprime,[\$(a..b)]):

t:=time():
PrimesInRange(10^5,10^6):
time()-t;

t:=time():
primesInRange(10^5,10^6):
time()-t;

2.750
5.375

## Correction...

@Carl Love  Should be  p<=b

## Procedure...

A simple procedure  MyPolyhedron  solves your problems. Required parameter  Faces  is the list of all faces of the polyhedron given as lists of its vertices. Optional parameters: 'plot' (by default), vertices, edges.

MyPolyhedron:=proc(Faces, opt:='plot')
local n, S;
n:=nops(Faces);
S:=seq(plottools:-polygon(Faces[i], color=khaki), i=1..n);
if opt='plot' then return plots:-display(S, scaling=constrained) else
if opt=vertices then return {op(map(op, Faces))} else
if opt=edges then {seq(seq({Faces[i,j], Faces[i,`if`(j<nops(Faces[i]), j+1, 1)]}, j=1..nops(Faces[i])), i=1..n)} fi; fi; fi;
end proc:

Example of use:

Faces:=[[[2,1,0],[-2,1,0],[-2,-1,0],[2,-1,0]], [[2,1,0],[1,0,2],[2,-1,0]], [[2,1,0],[-2,1,0],[-1,0,2],[1,0,2]], [[-2,1,0],[-1,0,2],[-2,-1,0]], [[2,-1,0],[-2,-1,0],[-1,0,2],[1,0,2]]]:
MyPolyhedron(Faces);
MyPolyhedron(Faces, vertices);
MyPolyhedron(Faces, edges);

## A solution...

In Maple 2017.0 i get a solution without any problems:

restart;
Sys:={p=(w^2+v*w)/(1-2*u-w), q=u+w, r=w}:
solve(Sys, {u,v,w});
simplify(eval(Sys, %));
# Checking

## OK...

@vv  Thank you for this improvement.

## Not only a luck...

@vv  Maple copes with this example, if a little more help it (in  f1  we manually split  f  into 2 summands):

restart;
f := (3*(x+exp(x))^(2/3)+(x^2+3*x)*exp(x)+4*x^2)/((x+exp(x))^(2/3)*x);
f1:=3/x+``(((x^2+3*x)*exp(x)+4*x^2)/((x+exp(x))^(2/3)*x));
IntegrationTools:-Expand(int(f1, x));
normal(diff(%, x))
# Checking

## Re...

@magiblot  From the plot it is clear that the maximum point lies in the third quadrant (x<0, y<0). Then by the mouse I just turned the plot (top view) and took a close point, lying in a triangle (x=-5, y=-5) as an initial point.  For  the minimum point everything is similar.

 1 2 3 4 5 6 7 Last Page 1 of 68
﻿