Ask Your Question
1

Plotting multiple functions with different growth rates

asked 4 years ago

pafleranga gravatar image

Hi, I'm new to sagemath. I wanted to plot two different functions with different growth rates. For example, 1/x and x. I used the following code snippet. Because 1/x goes to infinity at 0, the other function can not be distinguished from the 1/x function in the plot. How can I limit plotting to specific range for example, plot only y from 0 to 10 and from 0 to 10 ?

f1 = plot((x), (x,0,2))
f2 = plot((1/x), (x,0,2))
show(f1+f2)
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

slelievre gravatar image

Use the ymin and ymax keywords.

sage: f1 = plot((x), (x, 0, 2))
sage: f2 = plot((1/x), (x, 0, 2))
sage: p = f1 + f2
sage: p.show(ymin=0, ymax=10)
Preview: (hide)
link

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

Seen: 212 times

Last updated: Aug 25 '20