Drawing Graphs in Sage using Array and Loop

Here is the code:

v=[x^2,sin(x)]
r=[1,2]
for i in range(2):
    r[i]=plot(v[i],(x,-2,2),thickness =3.0 rgbcolor(0.5,1,0),legend_label=v[i])
    r[i].save()

It will create two graphs:

Advertisements

About Priyanka Kapoor

Simple, Hardworking & friendly.....
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s