vv

13922 Reputation

20 Badges

10 years, 9 days

MaplePrimes Activity


These are replies submitted by vv

@Cham 

You make a mistake in this case (if you want to use modern Maple and efficient code).
See also "angle bracket" in  https://en.wikipedia.org/wiki/Bracket.

@John Fredsted 

Do you have an example where delayed evaluation does not work?

BTW,

Tools > Options > Display > Typesetting level = Standard (instead of Extended) 

implies that your original construct works!

 

But indeed, the situation is strange:

 

 

A:=Vector(2,(a) -> Matrix(2,2,(b,c) -> m||a||b||c)):

%;

Error, (in Vector[column]) number of elements on right side must match subselection on left side

 

A[1];

Matrix(2, 2, {(1, 1) = m111, (1, 2) = m112, (2, 1) = m121, (2, 2) = m122})

(1)

A;

Error, (in Vector[column]) number of elements on right side must match subselection on left side

 

lprint(A);

Vector[column](2, {1 = Matrix(2, 2, {(1, 1) = m111, (1, 2) = m112, (2, 1) = m121, (2, 2) = m122}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []), 2 = Matrix(2, 2, {(1, 1) = m211, (1, 2) = m212, (2, 1) = m221, (2, 2) = m222}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

 

 

 

################

restart;

f:=(a) -> 'Matrix'(2,2,(b,c) -> m||a||b||c):

V:=Vector(2,F);

V := Vector(2, {(1) = F(1), (2) = F(2)})

(2)

eval(V, F=f);

Error, (in Vector[column]) number of elements on right side must match subselection on left side

 

V:=Vector(2, 'f');

V := Vector(2, {(1) = Matrix(2, 2, {(1, 1) = m111, (1, 2) = m112, (2, 1) = m121, (2, 2) = m122}), (2) = Matrix(2, 2, {(1, 1) = m211, (1, 2) = m212, (2, 1) = m221, (2, 2) = m222})})

(3)

V:=Vector(2):

for i to 2 do V[i]:=f(i) od: V;

Error, (in Vector[column]) number of elements on right side must match subselection on left side

 

for i to 2 do V[i]:='f'(i) od: V;

Vector(2, {(1) = Matrix(2, 2, {(1, 1) = m111, (1, 2) = m112, (2, 1) = m121, (2, 2) = m122}), (2) = Matrix(2, 2, {(1, 1) = m211, (1, 2) = m212, (2, 1) = m221, (2, 2) = m222})})

(4)

 

@Kitonum 

You forgot the case f(a,b)=0, g(a,b)=0, h(a,b)>0.

@Kitonum 

Of course the integral can be computed. My point was that without a general algorithm implemented, many functions with simple elementary antiderivatives will need consistent help from the user to be integrated.

It was a pure luck that expanding the integrand was successful (the three resulting integrals have cancelled).
For example, for:

f := (3*(x+exp(x))^(2/3)+(x^2+3*x)*exp(x)+4*x^2)/((x+exp(x))^(2/3)*x);

IntegrationTools:-Expand(int(f, x));

will not work.

[ The integral is   3*(x+exp(x))^(1/3)*x+3*ln(x)  ]

AFAIK the Risch algorithm is not (fully) implemented for functions involving roots.

 

 

OK, I quit, anyway you are going to persist in error ad infinitum.

@Markiyan Hirnyk 

@Markiyan Hirnyk 

Example:

 

 

 

f:=sin(1/x)/x;

sin(1/x)/x

(1)

GlobalSearch(f, {x = 0.01 .. 1}, solutions = 3);

Array([[-80.1168531456592, [x = 0.124807962966356e-1], 19], [-23.5831306496334, [x = 0.423651896147433e-1], 17], [-17.3076086078585, [x = 0.576821758588231e-1], 20]])

(2)

GlobalOptima(f, {x = 0.01 .. 1});

[HFloat(-98.9652206531187), [x = HFloat(0.010104044142551094)], 138]

(3)

If you refuse to accept such a clear situation, it's OK for me.

@Markiyan Hirnyk 

@Markiyan Hirnyk 

The help is very clear: for global extrema, use GlobalOptima. You found 3 extrema which could be global or local.

@Markiyan Hirnyk 

This is only a partial workaround, DS fails. You have asked 3 local extrema, you cannot know whether 1 is global or not.

@Markiyan Hirnyk 

DS is a very good package, but i doubt that you have never seen a fail.

f:=ln(ln( exp(exp(exp(10^10*(x-1/7)))) + y)):
absminmax(f,{x>=1/7,y>=0,x<=3/7,y<=1});

gives the correct result min=1.
In DS, min=Float(infinity) and  sometimes min=0.

 

@tomleslie 

Your point of view would apply for almost any exact method versus a numeric one. Should we reject the exact methods?
Note that it is also simple to construct examples where DirectSearch fails.
In this case the exact methods can be extended for (some) functions with infinitely many roots (such as the periodic ones): just use solve with option `allsolutions` and filter the results. Of course  for most cases a symbolic result is impossible, but this is also true for int, solve, factor, is, dsolve ...

@magiblot 

Both use Lagrange multipliers. extrema is more "professional". LagrangeMultipliers is more "didactic"and has some plotting options.

Let's say you are interested in guessing the related sequence

seq( bernoulli(n+2),n=0..100 );

What strategy would you recommend in this case?

 

@Carl Love 

As I see, we are like Newton and Leibniz :-)

First 115 116 117 118 119 120 121 Last Page 117 of 176