Define the function which is a polynomial in one variable with a couple of undetermined coefficients
In[]:=
f[x_]:=
1
4
(-1+x)
4
(1+x)
-a[1]-
(-1+x)a[2]
1+x
+
2(-1+x)
3
(1+x)
-
2
2
(1+x)
a[2]+
2(1+x)-
(-1+x)a[2]
2
(1+x)
+
a[2]
1+x
-1+x
+
3
a[1]+
(-1+x)a[2]
1+x
It seems like f is singular in 1, when rewriting it, however, one can clearly see that this is not the case.
In[]:=
f[x]​​f[x]//Expand//Simplify
Out[]=
1
4
(-1+x)
4
(1+x)
-a[1]-
(-1+x)a[2]
1+x
+
2(-1+x)
3
(1+x)
-
2
2
(1+x)
a[2]+
2(1+x)-
(-1+x)a[2]
2
(1+x)
+
a[2]
1+x
-1+x
+
3
a[1]+
(-1+x)a[2]
1+x
Out[]=
1
4
(1+x)((-1+x)
3
(1+x)
3
a[1]
+3
2
(-1+
2
x
)
2
a[1]
a[2]+a[2](7+
2
a[2]
-4
3
x
2
a[2]
-4x(-1+
2
a[2]
)+
4
x
(-1+
2
a[2]
)+6
2
x
(1+
2
a[2]
))+(-1+
2
x
)a[1](-1+3
2
a[2]
+
2
x
(-1+3
2
a[2]
)-2x(1+3
2
a[2]
)))
Evaluation of f at 1 gives the Error ‘
"Infinite expression
1
0
encountered.
’
In[]:=
f[1]
Power
:Infinite expression
1
0
encountered.
Infinity
:Indeterminate expression 0ComplexInfinity encountered.
Out[]=
Indeterminate
Evaluation at y and then substituting y with 1 again gives the Error ‘
"Infinite expression
1
0
encountered.
’
In[]:=
f[y]/.y->1
Power
:Infinite expression
1
0
encountered.
Infinity
:Indeterminate expression 0ComplexInfinity encountered.
Out[]=
Indeterminate
Now, defining the same(!!) function, just rewritten so that it is obvious that is is not singular.
In[]:=
g[x_]:=f[x]//Expand//Simplify​​g[x]
Out[]=
1
4
(1+x)((-1+x)
3
(1+x)
3
a[1]
+3
2
(-1+
2
x
)
2
a[1]
a[2]+a[2](7+
2
a[2]
-4
3
x
2
a[2]
-4x(-1+
2
a[2]
)+
4
x
(-1+
2
a[2]
)+6
2
x
(1+
2
a[2]
))+(-1+
2
x
)a[1](-1+3
2
a[2]
+
2
x
(-1+3
2
a[2]
)-2x(1+3
2
a[2]
)))
Evaluation directly at 1 again gives the Error ‘
"Infinite expression
1
0
encountered.
’
In[]:=
g[1]
Power
:Infinite expression
1
0
encountered.
Infinity
:Indeterminate expression 0ComplexInfinity encountered.
Out[]=
Indeterminate
However, evaluation at y and substituting y with 1 gives the correct result
In[]:=
g[y]/.y->1
Out[]=
1
2
a[2](6-2
2
a[2]
-4(-1+
2
a[2]
)+6(1+
2
a[2]
))