ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 30 Jun 2013 08:39:48 -0500Print value of vertical & horizontal asymptote?http://ask.sagemath.org/question/10297/print-value-of-vertical-horizontal-asymptote/By default the program draws a blue line displaying the vertical asymptote of a function, which is very helpful. If I could get it to display a line through the horizontal asymptote, & print their value, if would be very helpful.
I attempted the following to get the vertical asymptote & had no luck at all:
ans = solve( 7/(x-3) == 0, x)
v0 = ans[0].rhs()
print(v0)
Error message:
Traceback (click to the left of this block for traceback)
...
IndexError: list index out of rangeSun, 30 Jun 2013 04:58:14 -0500http://ask.sagemath.org/question/10297/print-value-of-vertical-horizontal-asymptote/Answer by tmonteil for <p>By default the program draws a blue line displaying the vertical asymptote of a function, which is very helpful. If I could get it to display a line through the horizontal asymptote, & print their value, if would be very helpful.</p>
<p>I attempted the following to get the vertical asymptote & had no luck at all:</p>
<pre><code>ans = solve( 7/(x-3) == 0, x)
v0 = ans[0].rhs()
print(v0)
</code></pre>
<p>Error message: </p>
<pre><code>Traceback (click to the left of this block for traceback)
...
IndexError: list index out of range
</code></pre>
http://ask.sagemath.org/question/10297/print-value-of-vertical-horizontal-asymptote/?answer=15161#post-id-15161When you write:
solve( 7/(x-3) == 0, x)
you look for solutions of the equation $7/(x-3) = 0$, which has no solution. If you want to discover the poles of your function (not the zeroes) to locate where your function has vertical asymptotes, you should look for the zeroes of the inverse of your function:
sage: f(x) = 7/(x-3)
sage: ans = solve(1/f == 0, x)
sage: ans[0].rhs()
3
If you want to locate the horizontal asymptotes, you shoult look at the limit of your function in $+\infty$ and $-\infty$:
sage: limit(f,x=+infinity)
x |--> 0
sage: limit(f,x=-infinity)
x |--> 0
Here, the vertical asymptote has equation $x=3$, and the horizontal asymptote has equation $y=0$.
Sun, 30 Jun 2013 08:39:48 -0500http://ask.sagemath.org/question/10297/print-value-of-vertical-horizontal-asymptote/?answer=15161#post-id-15161