ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 01 Oct 2014 09:50:04 +0200plotting pointshttps://ask.sagemath.org/question/24348/plotting-points/ 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)
Tue, 30 Sep 2014 21:22:38 +0200https://ask.sagemath.org/question/24348/plotting-points/Comment by ivana for <p>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. </p>
<pre><code>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)
</code></pre>
https://ask.sagemath.org/question/24348/plotting-points/?comment=24351#post-id-24351also I don't know why I get four, and not two solutions for pointsTue, 30 Sep 2014 22:39:54 +0200https://ask.sagemath.org/question/24348/plotting-points/?comment=24351#post-id-24351Answer by ndomes for <p>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. </p>
<pre><code>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)
</code></pre>
https://ask.sagemath.org/question/24348/plotting-points/?answer=24354#post-id-24354
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) Tue, 30 Sep 2014 23:51:57 +0200https://ask.sagemath.org/question/24348/plotting-points/?answer=24354#post-id-24354Comment by ivana for <pre><code>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)
</code></pre>
https://ask.sagemath.org/question/24348/plotting-points/?comment=24359#post-id-24359but it doesn't work for lager r (when r=2,3,4)Wed, 01 Oct 2014 08:47:49 +0200https://ask.sagemath.org/question/24348/plotting-points/?comment=24359#post-id-24359Comment by ivana for <pre><code>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)
</code></pre>
https://ask.sagemath.org/question/24348/plotting-points/?comment=24360#post-id-24360I made some changes (that I did wrong in pointing out circles), and now your idea for points works perfectly. thank youWed, 01 Oct 2014 09:50:04 +0200https://ask.sagemath.org/question/24348/plotting-points/?comment=24360#post-id-24360