Ask Your Question
0

Plot a curve in the region defined

asked 2017-01-13 12:03:27 +0100

Sha gravatar image

I have the following region :

p, t= var('p t') 
a=(-2*p*t^2-p^2*t)+(2*t*p-p^2)+t+1 
b=(p*t^2+2*p^2*t)+(2*t*p-t^2)-p+1 
c=(p*t^2-p^2*t)+(t^2+2*t*p+p^2)+t-p #3 sides (a,b,c) in terms of theta and phi
region_plot([a+b>=c, b+c>=a, c+a>=b], (t,-2,2), (p,-2,2))

And I want to plot a curve C=t*p*(t-p)+t*p+2*(t-p)-1 on the region in first quadrant. How am I suppose to do that.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-01-13 14:11:37 +0100

kcrisman gravatar image

Just use implicit_plot:

p, t= var('p t') 
a=(-2*p*t^2-p^2*t)+(2*t*p-p^2)+t+1 
b=(p*t^2+2*p^2*t)+(2*t*p-t^2)-p+1 
c=(p*t^2-p^2*t)+(t^2+2*t*p+p^2)+t-p #3 sides (a,b,c) in terms of theta and phi
R = region_plot([a+b>=c, b+c>=a, c+a>=b], (t,-2,2), (p,-2,2))
C = implicit_plot(t*p*(t-p)+t*p+2*(t-p)-1,(t,-2,2), (p,-2,2),color='red')
show(R+C)
edit flag offensive delete link more

Comments

1

Thank you. This gave me exactly the answer I was looking for.

Sha gravatar imageSha ( 2017-01-14 01:57:01 +0100 )edit

You're welcome!

kcrisman gravatar imagekcrisman ( 2017-01-14 03:42:54 +0100 )edit

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: 2017-01-13 12:03:27 +0100

Seen: 223 times

Last updated: Jan 13 '17