Ask Your Question
1

I want to manipulate max(x/b,a) so that I end up with an expression with max(0,ab-x)

asked 2014-12-10 17:11:18 -0500

Anon2 gravatar image

On paper I would factor 1/b and then subtract and add x and end up with the expression I am looking for.

1/b max(x, ab)

1/b {max(0,ab-x) + x}

Is there a way to do this in sage?

edit retag flag offensive close merge delete

Comments

You seem to be assuming that b is positive.

slelievre gravatar imageslelievre ( 2014-12-11 12:37:34 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-12-11 12:32:52 -0500

It seems that for now max is not a symbolic function, ie, when you type max(x/b, a), this is not kept as a symbolic expression involving the symbolic function max. Instead, it is immediately evaluated (using some form of comparison on symbolic expressions.

sage: var('a b x')
(a, b, x)
sage: expr = max(x/b,a)
sage: expr
x/b

I think there is some ticket about making more functions symbolic in Sage, it would be worth checking if max is among the functions targeted by that ticket.

One obstacle might be that max is a standard Python function and there are objections to modifying it in Sage. This obstacle is a problem for Sage in other areas too, such as interval arithmetic.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-10 17:11:18 -0500

Seen: 111 times

Last updated: Dec 11 '14