_Maxim_

729 Reputation

12 Badges

9 years, 65 days

MaplePrimes Activity


These are questions asked by _Maxim_

v := x -> `if`(x::numeric, x^2, 'procname(args)'):
u := x -> `if`(x::numeric, x^2, 'procname(args)'):

Optimization:-NLPSolve(v(x), {-1 <= x, x <= 1});
Error, (in Optimization:-NLPSolve) unsupported type of index, HFloat(1.0)

Optimization:-NLPSolve(u(x), {-1 <= x, x <= 1});
      [1.83670992315982423*10^(-40), [x = -1.35525271560688*10^(-20)]]

u and v are identical.

f := proc(x, rec := true)
  if rec then Optimization:-NLPSolve(2, y -> (y -~ 1/4).(y -~ 1/4), [], [<-1, -1>, <1, 1>],
    maximize = false) end if;
  (x -~ 1/4).(x -~ 1/4)
end proc:

fgrad := proc(x, g) g[1 .. 2] := 2*~(x -~ 1/4) end proc:

Optimization:-NLPSolve(2, f, [], [<-1, -1>, <1, 1>],
  maximize = false, objectivegradient = fgrad);
Warning, no iterations performed as initial point satisfies first-order conditions
        [0.125000000000000000, Vector[column](2, [0., 0.])]


Optimization:-NLPSolve(2, x -> f(x, false), [],  [<-1, -1>, <1, 1>],
  maximize = false, objectivegradient = fgrad);
        [0., Vector[column](2, [.250000000000000, .250000000000000])]

The inner NLPSolve doesn't do anything, except it breaks the outer NLPSolve.

f:= z-> MeijerG([[1/2], []], [[], [1]], z);

simplify(f(z));
                               0
convert(f(z), hypergeom);
                               0
f(.2);
Error, (in evalf/MeijerG/limit) numeric exception: division by zero

f(2.2);
                         -0.4721129136

It seems that when MeijerG is not analytic on the unit circle, simplify and convert give a result that's valid only inside the unit circle.

ii := evalr(csch(INTERVAL(-infinity .. -1, 1 .. infinity)));
             INTERVAL(-csch(1) .. 0, csch(1) .. 0)

evalr(ii-ii);
                            -csch(1)

(Make sure you don't have the Typesetting level set to Extended, or ii won't be displayed correctly.)

There are no functions to test for interval membership (or to compute intersections/unions of intervals), so it's unclear how Maple treats the interval csch(1)..0, but apparently evalr is getting tripped up by it.

Also:

evalr(sech(INTERVAL(-infinity .. -1, 1 .. infinity)));
                               0

evalr(arccsch(INTERVAL(-infinity .. -1, 1 .. infinity)));
Error, (in evalr/arccsch) too many levels of recursion

 

Here Maple treats the intervals as independent, as I think it should:

INTERVAL(1 .. 2)+INTERVAL(1 .. 2);
              INTERVAL(1 .. 2) + INTERVAL(1 .. 2)

INTERVAL(1 .. 2)-INTERVAL(1 .. 2);
              INTERVAL(1 .. 2) - INTERVAL(1 .. 2)

(even though for the first one an autosimplification to 2*INTERVAL(1..2) wouldn't matter). But as soon as there are non-linear terms, Maple ignores that rule:

INTERVAL(1 .. 2)^2-INTERVAL(1 .. 2)^2;
                               0

INTERVAL(1 .. 2)/INTERVAL(1 .. 2);
                               1

INTERVAL(-1 .. 1)*INTERVAL(-1 .. 1);
                                        2
                       INTERVAL(-1 .. 1) 

That means I cannot substitute intervals for variables in a formula. In fact, I don't know how INTERVAL(-1 .. 1)*INTERVAL(-1 .. 1) can be computed as a product of two independent intervals at all, there doesn't seem to be any way to pass it to evalr.

 

First 6 7 8 9 10 11 12 Page 8 of 14