Re: [Axiom] Bug or feature of max



Marc Boyer <Marc.Boyer@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:

Give an example, then I can give you help that's easier to digest.

The real problem I was trying to solve was:
Let be
Beta(x,R,T) = R * Max( x - T , 0 )
To(o) = ( R * T + b - r * o )
with functions and parametres are Real.
How does looks the following expression
Beta(x,R,T(R+b/r))

I guess you mean To(R+b/r) here?

I was a bit surprised to see that the 'max' part of the expression was no
more there.

Yes, that's surprising at first.

But I can also solve it by hand.

But you don't want to. Just put what I send after my signature this in a file
you then )read or into .axiom.input, so it is read automatically. Then you get

(You have to use "Max" instead of "max"!)

(23) -> Beta(x,R,T) == R * Max( x - T , 0 )

(24) -> To(o) == R * T + b - r * o

(25) -> Beta(x,R,To(R+b/r))

(25) R Max(x + R r - R T,0)
Type: Expression Integer
(26) -> eval(Max(a, b), [a, b], [sqrt 2, 14142135622/10000000000])

+-+
(26) \|2
Type: Expression Integer
(27) -> Max(%e, %pi)

(27) %pi

No need to understand domains anymore.

Martin

-------------------------------------------------------------------------------
COEFFS ==> INT
-- if you are going to work with expressions over floats once, put
-- COEFFS ==> FLOAT
-- instead

opmax := operator 'Max

Max(a: EXPR COEFFS, b: EXPR COEFFS): EXPR COEFFS ==
s := numericIfCan a
(s case "failed") => kernel(opmax, [a, b])
t := numericIfCan b
(t case "failed") => kernel(opmax, [a, b])
if s > t then a else b

evaluate(opmax, _
(l: List EXPR COEFFS): EXPR COEFFS +-> Max(first l, second l))_
$BOP1(EXPR COEFFS)

-------------------------------------------------------------------------------
.