Ask Your Question
0

Fill between two curves

asked 2013-03-29 22:03:56 +0100

xoviat gravatar image

I am attempting to fill the area between two curves. To more clearly illustrate what I am trying to accomplish, I would like to represent the area of the following integral:

integrate x-x^2 from 0 to 1

I can currently show the area under x with fill=True, but this is not what I want. What I want is for the fill to extend only to x^2 rather than all the way down to the x axis.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-03-29 22:46:05 +0100

kcrisman gravatar image

See here for a slew of fill options. Probably one of these will fit your needs.

sage: plot(x,(x,0,1),fill=x^2)
sage: plot([x,x^2],(x,0,1),fill={0:[1]})
edit flag offensive delete link more
3

answered 2013-03-29 22:45:02 +0100

ppurka gravatar image

Use a dict {<index of first curve>: [<index of second curve>]}, like this:

sage: plot([x, x^2], fill={0:[1]})

See the plot documentation for more examples.

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

Stats

Asked: 2013-03-29 22:03:56 +0100

Seen: 3,385 times

Last updated: Mar 29 '13