Ask Your Question
1

Using max and plot

asked 2016-11-14 14:18:59 -0500

oldnovice gravatar image

I want to plot a function such as x mapsto max(x,1). How do I do that?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-11-14 14:26:21 -0500

kcrisman gravatar image

updated 2016-11-15 08:43:22 -0500

Try this using max_symbolic. It won't do as much as you might like, but you can plot it, at least.

Edit - didn't have time to include the code earlier:

plot(max_symbolic(x,1),(x,-5,5),ymin=0)
edit flag offensive delete link more

Comments

Thank you very much for your help. This does what I want.

oldnovice gravatar imageoldnovice ( 2016-11-15 08:23:48 -0500 )edit
1

answered 2016-11-15 08:07:39 -0500

Try using a lambda function.

This works for me:

sage: plot(lambda x: max(x, 1), (-5, 5), ymin=0)
edit flag offensive delete link more

Comments

Thank you, too. I really appreciate your help. This also does what I want.

oldnovice gravatar imageoldnovice ( 2016-11-15 08:24:22 -0500 )edit

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: 2016-11-14 14:18:59 -0500

Seen: 46 times

Last updated: Nov 15 '16