Ask Your Question
1

plotting points

asked 2014-09-30 21:22:38 +0100

ivana gravatar image

updated 2014-09-30 21:48:16 +0100

tmonteil gravatar image

How can I show points that I get as the result in line 11? I have that two circles, but I do not know how to get points on the graph.

var('x, y')
ft = (x+1)^2-(y)^2-1
f=circle((-1,0), 1)
p = plot(f,-5,5, thickness=2)

@interact
def _(r=(1..4)):
  g = circle((1,0), r)
  pt = plot(g,-5, 5, color='green', thickness=2)
  gt= (x-1)^2+ y^2-r
  pot = solve([ft,gt], x, y)
  html('$tocke=\;%s$'%latex(pot))
  show(  p + pt, ymin = -5, ymax = 4)
edit retag flag offensive close merge delete

Comments

also I don't know why I get four, and not two solutions for points

ivana gravatar imageivana ( 2014-09-30 22:39:54 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-30 23:51:57 +0100

ndomes gravatar image

updated 2014-09-30 23:57:07 +0100

var('x, y')
ft = (x+1)^2-(y)^2-1
f=circle((-1,0), 1,thickness=2)

@interact
def _(r=(1..4)):
    g = circle((1,0), r,color='green', thickness=2)
    gt= (x-1)^2+ y^2-r
    pot = solve([ft,gt], x, y,solution_dict=True)
    P = []
    for L in pot:
        try:
            P.append(point((L[x],L[y]),color='red',pointsize=20))
        except:
            pass
    html('$tocke=\;%s$'%latex(pot))
    show(  f + g + sum(P) , ymin = -5, ymax = 4,aspect_ratio=1)
edit flag offensive delete link more

Comments

but it doesn't work for lager r (when r=2,3,4)

ivana gravatar imageivana ( 2014-10-01 08:47:49 +0100 )edit

I made some changes (that I did wrong in pointing out circles), and now your idea for points works perfectly. thank you

ivana gravatar imageivana ( 2014-10-01 09:50:04 +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: 2014-09-30 21:22:38 +0100

Seen: 530 times

Last updated: Sep 30 '14