Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Sage Beginner's Guide
  • Table Of Contents Toc
Sage Beginner's Guide

Sage Beginner's Guide

By : Craig Finch
3.9 (11)
close
close
Sage Beginner's Guide

Sage Beginner's Guide

3.9 (11)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
close
close
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Time for action – plotting symbolic expressions


Let's plot some simple functions. Enter the following code:

p1 = plot(sin, (-2*pi, 2*pi), thickness=2.0, rgbcolor=(0.5, 1, 0),
    legend_label='sin(x)')
p2 = plot(cos, (-2*pi, 2*pi), thickness=3.0, color='purple',
    alpha=0.5, legend_label='cos(x)')
plt = p1 + p2
plt.axes_labels(['x', 'f(x)'])

show(plt)

If you run the code from the interactive shell, the plot will open in a separate window. If you run it from the notebook interface, the plot will appear below the input cell. In either case, the result should look like this:

What just happened?

T his example demonstrated the most basic type of plotting in Sage. The plot function requires the following arguments:

graphics_object = plot(callable symbolic expression, (independent_var, ind_var_min, ind_var_max))

The first argument is a callable symbolic expression, and the second argument is a tuple consisting of the independent variable, the lower limit of the domain, and the upper limit. If there...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Sage Beginner's Guide
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon