Kitonum

21695 Reputation

26 Badges

17 years, 186 days

MaplePrimes Activity


These are replies submitted by Kitonum

@smith_alpha 

1) op  command extracts operands from an expression. In syntax  op(list, e)  the list of integers indicates positions of operands at increasing nesting levels of an expression. See help for details.

2) Since your maximum is reached at a critical point, here are two more ways to solve the problem:

 

a:=eval(x, solve({diff(f,x)=0, diff(f,x,x)<0}));  # Direct short solution

or

extrema(f, {}, x, 's');  # From all the extrema values we select the point in which the maximum value

s;

a:=max(map(rhs@op, s));

It is interesting that purely visually in the output, they are indistinguishable. But Maple distinguishes them:

 

Pi, pi;

                            

 

evalf(%);

                

 

 

 

 

@Markiyan Hirnyk  What does the acronym  SCR?

@Carl Love  Thank you for the good advice!

@tomleslie  Even more easy way - to resolve this trivial example by the hand (or in mind). 

 

@cktamcu  Imput in the form  ∫xdlnx  contradicts Maple syntax to calculate integrals. See help on  int  command.

@Markiyan Hirnyk  You wrote "We see that Maple 2015.1 does take into account the numpoints option". This statement in no way motivated.

In Maple 2015.1 we have:

restart;

A := Student[Calculus1]:-VolumeOfRevolution(-x^2+2*x, sqrt(-x^2+2*x), x = 0 .. 2, output = plot):
B := Student[Calculus1]:-VolumeOfRevolution(-x^2+2*x, sqrt(-x^2+2*x), x = 0 .. 2, output = plot):
C := Student[Calculus1]:-VolumeOfRevolution(-x^2+2*x, sqrt(-x^2+2*x), x = 0 .. 2, output = plot, numpoints = 10000):

plots[display](Array([A, B, C]));

 

We see that the imputs in  A  and  B  are the same, but in  output of A green and blue lines are present. So the difference is not related to  numpoints option. B and C are different in  numpoints  option, but the outputs are the same. The hole near the point  (2,0,0)  is present in all variants.

 

 

 

@Markiyan Hirnyk  To construct a surface of revolution about the axis Ox of the curve  y=f(x), x=0..a, Maple probably using parametric surface  [x, |f(x)|*cos(phi), |f(x)|*sin(phi)] , x=0..a, phi=0..2*Pi  Obviously  Student[Calculus1]:-VolumeOfRevolution  command  ignores  numpoints  option. In the direct plotting by plot3d and slightly increased numpoints the hole disappears:

restart;

plot3d([x, sqrt(-x^2+2*x)*cos(phi), sqrt(-x^2+2*x)*sin(phi)], x = 0 .. 2, phi = 0 .. 2*Pi, color = pink, axes = normal, labels = [x, y, z], numpoints = 1000);

                            

 

 

 

  

@Markiyan Hirnyk  As can be seen from the plot above for each value of  X = 0..1  we have not one but two values of  Y .

@Carl Love  Of course, you're right! For a complete elimination of the parameter it is necessary to solve the cubic equation.

@Markiyan Hirnyk  I do not know how many more you need examples to believe the complete inefficiency of DirectSearch  package for solving problems of discrete optimization. Here are two very obvious example. It is taken from your question about the maximum of determinant with numbers 1..16. Consider two simpler examples of the determinant of the second order (numbers 1..4) and third order (the numbers 1..9). 

The first example is trivial and can be solved in the mind for a few seconds. Here's the work  DirectSearch  package:

restart;

ts:=time():

F:=LinearAlgebra[Determinant](Matrix([[x[1],x[2]],[x[3],x[4]]]));

DirectSearch[GlobalOptima](F, {[x[1],x[2],x[3],x[4]]=Matrix(map(convert,combinat[permute]([$1..4]),Vector))}, maximize);

time()-ts;

                                       

 

 

The solution of the same problem for the determinant of the third order:

restart;

ts:=time():

F:=LinearAlgebra[Determinant](Matrix([[x[1],x[2],x[3]],[x[4],x[5],x[6]],[x[7],x[8],x[9]]]));

DirectSearch[GlobalOptima](F, {[seq(x[i],i=1..9)]=Matrix(map(convert,combinat[permute]([$1..9]),Vector))}, maximize);

time()-ts;

 

As you can see, I did not wait for any result and interrupted calculation.

 

The latest example is solved in 20 seconds by simple enumeration:

restart;

ts:=time():

P:=combinat[permute]([$1..9]):

M:=-infinity:

f:=unapply(LinearAlgebra[Determinant](Matrix(3, [seq(x||i, i=1..9)])), seq(x||i, i=1..9)):

for p in P do

d:=f(op(p));

if d>M then M:=d; L:=[d,p] fi;

od:

L[1],Matrix(3,L[2]);

time()-ts;

                            

 

 

@Markiyan Hirnyk  You call  566073  as a worthy output  in comparison with the exact result  5927 ?

@Markiyan Hirnyk   

Digits := 200:

 fsolve(100^x - x^100=0, x = 2 .. infinity);

         100.000000000000 ... 

 

 

@Markiyan Hirnyk  As you can see, it took a lot of options for finding all solutions. Here's an easier way. From continuity and properties of functions it follows that two roots are in the ranges  x=-1..0  and  x=1..2  and third exact root  x=100  is evident.

Eq:=100^x=x^100:

fsolve(Eq, x=-1..0);

fsolve(Eq, x=1..2);

                  -0.9568903883

                    1.049519190

 

Another way:

RootFinding[Analytic](100^x=x^100, re=-1..110, im=-1..1):

select(t->type(t, realcons), [%]);

                  [-0.956890388296380, 1.04951918980717, 100.000000000000]

 

@Carl Love  Thank you, but I have already made the amendment earlier.

@Carl Love  That's good, but it works only for newer versions Maple. Variant for all versions:

P:=a*x^2*y*z+b*x*y*z+c*x^2*y*z+d*x*y^2*z+e*x*y*z:

L:=[coeffs(P, [x,y,z], 't')]: 

H:= table(zip(`=`, [t], L)):

H[x^2*y*z];

                         a+c

First 92 93 94 95 96 97 98 Last Page 94 of 133