Ask Your Question
1

Using max and plot

asked 2016-11-14 21:18:59 +0200

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 21:26:21 +0200

kcrisman gravatar image

updated 2016-11-15 15:43:22 +0200

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 15:23:48 +0200 )edit
1

answered 2016-11-15 15:07:39 +0200

slelievre gravatar image

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 15:24:22 +0200 )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 21:18:59 +0200

Seen: 393 times

Last updated: Nov 15 '16