Ask Your Question
1

Plotting multiple functions with different growth rates

asked 2020-08-25 07:39:57 -0500

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)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-08-25 08:18:30 -0500

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)
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: 2020-08-25 07:39:04 -0500

Seen: 29 times

Last updated: Aug 25