Ask Your Question

Plotting multiple functions with different growth rates

asked 2020-08-25 14:39:57 +0200

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

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-25 15:18:30 +0200

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:, 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


Asked: 2020-08-25 14:39:04 +0200

Seen: 46 times

Last updated: Aug 25 '20