1 | initial version |

I see. You are using a *symbolic* equation in the latter case, which will definitely barf at dividing by zero, but the things you are putting in are "real literals".

sage: type(a) <type 'sage.symbolic.expression.expression'=""> sage: type(vdict[a]) <type 'sage.rings.real_mpfr.realliteral'="">

As such, they obey 'usual' division rules for floating-point things like

sage: vdict[x]/vdict[x] NaN

So if you don't want mathematically correct behavior, I suggest not using a symbolic variable!

sage: eq_y = y == z sage: def mysubs(a=.1,x=0.,eq=eq_y): ....: t = a/x ....: return eq.subs(z=t) ....: sage: mysubs() y == +infinity sage: mysubs(.0,.0) y == NaN

Indeed, we get

sage: vdict = {} sage: vdict['a'] = 0. sage: vdict['x'] = 0. sage: mysubs(**vdict) y == NaN

2 | No.2 Revision |

I see. You are using a *symbolic* equation in the latter case, which will definitely barf at dividing by zero, but the things you are putting in are "real literals".

```
sage: type(a)
<type
```~~'sage.symbolic.expression.expression'="">
~~'sage.symbolic.expression.Expression'>
sage: type(vdict[a])
<type ~~'sage.rings.real_mpfr.realliteral'="">~~'sage.rings.real_mpfr.RealLiteral'>

As such, they obey 'usual' division rules for floating-point things like

```
sage: vdict[x]/vdict[x]
```~~NaN~~NaN

So if you don't want mathematically correct behavior, I suggest not using a symbolic variable!

```
sage: eq_y = y == z
sage: def mysubs(a=.1,x=0.,eq=eq_y):
....: t = a/x
....: return eq.subs(z=t)
....:
sage: mysubs()
y == +infinity
sage: mysubs(.0,.0)
y ==
```~~NaN~~NaN

Indeed, we get

```
sage: vdict = {}
sage: vdict['a'] = 0.
sage: vdict['x'] = 0.
sage: mysubs(**vdict)
y ==
```~~NaN~~NaN

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.