You are not logged in.
login | register

Discussion: All Topics
Topic: same error in your applet?
Related Item:

Post a new topic to the tool: Polynomial Root Finder App discussion
<< see all messages in this topic
<previous message | next message >

Subject:   same error in your applet?
Author: sione
Date: Dec 11 2003

It is not an error in my applet. As I have mentioned in my earlier post that I
have fixed the precision (tolerance) at 1.490116119384766E-8 . I will have to
re-write this number in ordinary form rather than standard form and I hope it
makes the explanation a bit clearer.

precision is 0.00000001490116119384766 in ordinary form

the solutions are:

1)  -1.41421356   (ie, -sqr(2))
2)  -1 + 3.9484299147897906E-8 * i
3)  -1 - 3.9484299147897906E-8 * i
4)  1.41421356     (ie, sqr(2))

If you plot all the roots in the Complex diagram, you will find that roots 2 & 3
coincide at -1 , this means that the conjugate pair (ie, roots 2 & 3) are just
one answer , that is a REPEATED REAL ROOT at -1 , where the imaginary parts
are almost zero or VERY CLOSE to the REAL axis so as to be treated that as zero
to such precision. That is why precision (tolerance) is used in numerical
computing to avoid such complex root solutions of polynomial equations which
arise out of thin-air that suppose not to have complex roots, such as your
equation , 'x^4+2x^3-x^2-4x-2' .

When I changed the precision to 5E-8 or in ordinary form,

precision 0.00000005

The roots then becomes,

1)  -1.41421356   (ie, -sqr(2))
2)  -1
3)  -1
4)  1.41421356     (ie, sqr(2))

which is exactly as what your calculator shows you. Since my applet is to find
roots, NOT to FACTORISE , then there is no point in showing REPEATED ROOTS as
-1, since it will confuse the user of thinking that there would be  4
x-intercepts points if you do plot the equation 'x^4+2x^3-x^2-4x-2' on
the graph. There are only 3 intercept points but one of the intercept point is
REPEATED (that is x = -1) , and that is why my routine will only show 3 Real
solutions, if I would have allowed user specified precision to be input to the

Computer Algebra Explanation

There are 2 ways of doing mathematics using a computer or calculator.

1) Symbolic computing
2) Numerical computing

Now , my applet uses method 2 (Numerical computing), which is the majority of
computer based applications are using. In numerical computing , you will always
find that sometimes , complex number solutions creeps in to the final answer,
and this is UNAVOIDABLE in current computing technology. The reason is , that
there are a lot of computations called round-off error (rounding up & rounding
down) of numerical numbers. This is a consequent of round-off error that why
you see that solutions suppose to be REAL ended up with appreable amount of an
imaginary part although very very small, such as 2 of the roots in equation,

-1 + 3.9484299147897906E-8 * i
-1 - 3.9484299147897906E-8 * i

That is why precision is used in numerical computing to combat this
uncontrollable round-off error of the computer. OK , you should be aware that
the number 1 is not really  1  in the computer bit-word (bit-register)
representation. In computer bit-word representation of number 1 it is really
1.00000000000000002 rather than 1, and this should not suprise you as to where
the complex root solutions appear, because during the calculations that are many
calculation steps leading to the answer. In these mid-steps calculation,
round-up and round-down do occur. All the computation in Electronic
hard-wares, such as mobile phone, microwave oven, dish-washer, computer, and
any device that has a DSP (Digital Signal Processor) chipset involve numerical
computing and the round-off error I have mentioned do occur as a reality of
life for these devices.

The other method for mathematical computing using a computer is Symbolic
manipulation. That is a fraction representation such as '1/2' or '4/5' os not
numeric, but symbols. In software terms they are called "Objects". If you have
used Mathematica or Maple computer algebra systems (CAS), these softwares does
symbolic and numeric as well. CAS is slow for intensive computation because it
operates on OBJECTS rather than primitive numbers, and the rules are applied as
expert systems. CAS is only used for R&D and learning but not for compute
intensive numeric applications. For example, in the area of "Computational Fluid
Dynamics" simulation, software applications (numeric-based software) usually
runs for days (3 days at minimum), before visual analysis is done on the data.
Such software is in routine use at NASA, Boeing, Lock-Heed for simulations of
the design of air-crafts geometry. These compute intensive applications ARE
NOT using symbolic CAS , such as MathCAD , Mathematica or Maple because they
will take forever to caculate results. Sometimes in symbolic calculations, you
will often find incomputable results. Example, try to integrate this equation is
a symbolic CAS based systems, 'sqrt(x^2*sin(x^3) + 4*x)'  and you will come up
to a dead end. The CAS will tell you that the solution cannot be DETERMINED. Now
this is the problem with symbolic systems. Numeric computing can solve the
answer to the above example equaion with no problem at all. Numerical computing
will always solve an answer regardless how hard the problem is, BUT you have to
live with the effects of ROUND-OFF error.

I believe, that  TI-89  uses a smaller precision (tolerance) number for
round-off that it computes all the roots and shows the factorization as:

(x+1)^2 * (x^2 - 2)

Try and type in any equation of upto 30-term polynomials or more and see if
TI-89 can solve. If it cannot , then it does use symbolic mode for
calculation. The algorithm behind my applet can solve all roots upto any number
of polynomial terms , say  100-terms polynomal or more, such as,

a0*x^100 + a1*x^99 + a2*x^98 + ... + a100

where a0, a1, a2, a3 , ... , a100  are the coefficients of the polynomial.
Numerical computing techniques can solve such polynomial shown above and find
all the solutions. I have just limit the applet to 5-terms because it is no
use to have more than 5 terms because MathForum audience is for high school
maths only. If any request in the future to have more terms included , I will do
that for the applet.

So , to answer your comment that my applet has the same error, NO IT IS NOT. It
is the different precision used in TI-89 and the one I used in my applet. If I
know what precision TI-89 used, and I will re-compile my applet with that
same precision as TI-89, you will definitely see the same results.

The precision I used 1.490116119384766E-8  is not a number I picked out of
thin air, but it is the sqaure root of the smallest number (EPSILON) that you
can add to number 1 and the result will be different.

EPSILON = 2.220446049250313E-16

Why do I take my precision to be 'sqrt(EPSILON)' , this is an issue of the
subject of numerical analysis that explains why, which I can go into but there
is no space here to do so. If you add any number to 1 which is less than EPSILON
the result will remain 1, and if the number is greater than or equal to EPSILON,
then the result will be different from one. EPSILON is dependent on the computer
language used. Java is what the applet used is the same as Fortran, C and

Finally, take a look at issues of Numerical computing that causes disaster
(causing deaths).


Reply to this message          Quote this message when replying?
yes  no
Post a new topic to the tool: Polynomial Root Finder App discussion
Visit related discussions:
Polynomial Root Finder App tool
Texas Instruments

Discussion Help