First time here? Check out the FAQ!

Ask Your Question
1

Using max and plot

asked 8 years ago

oldnovice gravatar image

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 8 years ago

kcrisman gravatar image

updated 8 years ago

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)
Preview: (hide)
link

Comments

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

oldnovice gravatar imageoldnovice ( 8 years ago )
1

answered 8 years ago

slelievre gravatar image

Try using a lambda function.

This works for me:

sage: plot(lambda x: max(x, 1), (-5, 5), ymin=0)
Preview: (hide)
link

Comments

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

oldnovice gravatar imageoldnovice ( 8 years ago )

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: 8 years ago

Seen: 793 times

Last updated: Nov 15 '16