login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for Division by zero during evaluation revision 1 of 1

1
Editor: test1
Time: 2019/07/26 14:29:52 GMT+0
Note:

changed:
-
Evaluation may lead to spurious division by zero.  This problem is not limited
to FriCAS, in fact it is general mathematical fact which limits what computers
(and people) can do.  Simplest example is $x/x$.  When we plug in nonzero number
for $x$ we get $1$.  However, plugging in $0$ leads to division by $0$.
So, the expression $x/x$ defines function different from $1$, namely $0$
is not in the domain of function defined by $x/x$.  For rational functions
we can easily limit the problem by canceling common divisors.  FriCAS
expression domain is doing this auitomatically:
\begin{axiom}
sin(x)/sin(x)
\end{axiom}
Even for rational function we may still get into trouble in more complicated
situations.  Consider $x/(x +y)$.  Evaluation this at $x = 0$, $y = 0$ in
one step, that is as 'eval(x/(x + y), [x = 0, y = 0])' leads to division by
zero.  OTOH evaluating in two steps gives value, but this value depends on
order of evaluation, first setting $y$ to $0$ we get $1$, while first
setting $x$ to $0$ gives $0$:
\begin{axiom}
eval(x/(x + y), [y = 0])
eval(x/(x + y), [x = 0])
\end{axiom}

Problem becomes more complicated when we consider algebraic expression.
Take differential form $dx/\sqrt(x^3 - 1)$.   This form have no
singularities on curve with equation $y^2 = x^3 - 1$.  More precisely,
to give well-defined meaning to square root we consider this curve.
Then $y$ is square root of $x^3 - 1$ and our form is $dx/y$.  In
$(x, y)$ coordinates we have singularity when $y=0$ (and another singularity
at infinity).  However, in different coordinates we can get nonsingular
expression at any given point.  But we can not get coordinates good
for all point: for any fixed coordinate system there will be singular
points, even though for any point we can choose coordinate system
with no singularity at this point.

Evaluation may lead to spurious division by zero. This problem is not limited to FriCAS, in fact it is general mathematical fact which limits what computers (and people) can do. Simplest example is x/x. When we plug in nonzero number for x we get 1. However, plugging in 0 leads to division by 0. So, the expression x/x defines function different from 1, namely 0 is not in the domain of function defined by x/x. For rational functions we can easily limit the problem by canceling common divisors. FriCAS expression domain is doing this auitomatically:

fricas
sin(x)/sin(x)

\label{eq1}1(1)
Type: Expression(Integer)

Even for rational function we may still get into trouble in more complicated situations. Consider x/(x +y). Evaluation this at x = 0, y = 0 in one step, that is as 'eval(x/(x + y), [x = 0, y = 0]?)' leads to division by zero. OTOH evaluating in two steps gives value, but this value depends on order of evaluation, first setting y to 0 we get 1, while first setting x to 0 gives 0:

fricas
eval(x/(x + y), [y = 0])

\label{eq2}1(2)
Type: Fraction(Polynomial(Integer))
fricas
eval(x/(x + y), [x = 0])

\label{eq3}0(3)
Type: Fraction(Polynomial(Integer))

Problem becomes more complicated when we consider algebraic expression. Take differential form dx/\sqrt(x^3 - 1). This form have no singularities on curve with equation y^2 = x^3 - 1. More precisely, to give well-defined meaning to square root we consider this curve. Then y is square root of x^3 - 1 and our form is dx/y. In (x, y) coordinates we have singularity when y=0 (and another singularity at infinity). However, in different coordinates we can get nonsingular expression at any given point. But we can not get coordinates good for all point: for any fixed coordinate system there will be singular points, even though for any point we can choose coordinate system with no singularity at this point.