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.Mon, 28 Feb 2011 14:20:48 +0100x/x = 1 at x=0?https://ask.sagemath.org/question/7978/xx-1-at-x0/How can I find that x/x is undefined at x=0?
Or any way when I write x/x, it returns x/x instead of 1?Mon, 28 Feb 2011 13:45:13 +0100https://ask.sagemath.org/question/7978/xx-1-at-x0/Answer by kcrisman for <p>How can I find that x/x is undefined at x=0?</p>
<p>Or any way when I write x/x, it returns x/x instead of 1?</p>
https://ask.sagemath.org/question/7978/xx-1-at-x0/?answer=12154#post-id-12154There are a few ways to do this, though I do not know exactly what you need for this so it may or may not fill your needs.
sage: f = x.mul(1/x,hold=True)
sage: f
x/x
sage: f(x=3)
1
sage: f(x=0)
<snip>
RuntimeError: power::eval(): division by zero
However, this will still give
sage: f.derivative(x)
0
So I don't know if this is exactly what you want. Also, we still don't have a way to 'unhold' other than simplification at this time.
sage: f.simplify()
1
Mon, 28 Feb 2011 14:20:48 +0100https://ask.sagemath.org/question/7978/xx-1-at-x0/?answer=12154#post-id-12154