Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#126 2016-06-18 04:28:08

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

regarding experience I was professor in engineering college in engineering subjects but I had more fancy towards mathematics. I had taught "Finite Element methods" for mechanical engineering students. Possibly this should have been in the introduction.

I already knew that.

eww. What was that?

Numerical instability due to subtractive cancellation and roundoff.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#127 2016-06-18 04:31:07

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

That's interesting.

Turing machines, theoretically, can only handle integers. It takes an infinite amount of memory to deal with actual real numbers.


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#128 2016-06-18 04:32:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

As we view them integers are just numbers where epsilon (e) is 0. All other floating point numbers are viewed as x + e.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#129 2016-06-18 04:35:43

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

Okay, what is epsilon?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#130 2016-06-18 04:39:54

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Without the jargon, it means a little bit, the error.

For instance, 1 / 10 is not on M's number line. The number line for computer is not a line as it is represented in mathematics, instead it looks like a line with lots of holes in it. Sort of like Morse code,


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#131 2016-06-18 04:41:31

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

Sort of like the cantor set.


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#132 2016-06-18 04:43:47

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Nothing so weird.

Run this pseudocode in your favorite language:

n = 10

While n != 0

Print n

n = n - .1

Do while


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#133 2016-06-18 04:47:28

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

Functionally?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#134 2016-06-18 04:48:39

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Procedurally, just like the pseudocode will be fastest.

n = 10; While[n != 0, Print[n]; n = n - .1]


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#135 2016-06-18 05:03:51

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

Okay, it does not terminate. That was weird.

http://ideone.com/6byWXI

Maybe some typechecking will help?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#136 2016-06-18 05:04:54

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

That was weird.

Not weird, perfectly natural. What I have been trying to say in the last 233 posts. FPmath and pure math they just ain't the same things. That is why that ugly graph that should have been x = 0 ( a horizontal line ) was not!

Maybe some typechecking will help?

Nothing will help! Do you know why?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#137 2016-06-18 05:25:42

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

No, why?

I think comparing a float and an integer is bad. We need typechecking.


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#138 2016-06-18 05:28:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Forget that!

1 / 10 does not exist on a computer number line. There is no finite binary representation for it. Most decimals do not have one. In math you are subtracting 1 / 10. For a computer he is subtracting .1000000000000000055511151231257827021181583404541015625


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#139 2016-06-18 12:53:52

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

What about this code, then?

>>> 0.2 - 0.1 == 0
True

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#140 2016-06-18 14:36:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

I do not understand it?

Anyway, the code I gave you is a very poor way of doing that. It is a well known trap. It was designed to show you some of the possible ways fp arithmetic can jump up and bite you.

That way I call representation error. See, there is no way to represent 1 / 10 in binary, so when you enter a = 1 / 10 the computer can not really do that. 1 / 3 is like that too and so are most other decimals. And there are other sources of error too. That is why when doing numerical work and anyone using a computer is, you must know how to get around those problems.

So far we have seen

1) Subtractive cancellation.

2) Representation errors.

Want to see more?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#141 2016-06-18 15:45:35

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Polynomial Root Finding

To solve x^2-8x=0 If we iterate x=x^2/8  from any start (except 8) will you ever attain the value of 8? the higher power of x is always a suspect on R.H.S except when |x|<1.


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#142 2016-06-18 16:02:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

That system, based on the derivative, can be attracted to the root x = 0 but it will repelled away from the other root of x = 8 unless 8 is entered exactly.

A better way to get the root of x = 8 is to use the form

which converges.

Here it is seen converging when x0 = 5

uK5bkiS.png

Here it is seen converging when x0 = 10

CIhzoPI.png


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#143 2016-06-18 18:36:10

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

bobbym wrote:

I do not understand it?

Anyway, the code I gave you is a very poor way of doing that. It is a well known trap. It was designed to show you some of the possible ways fp arithmetic can jump up and bite you.

That way I call representation error. See, there is no way to represent 1 / 10 in binary, so when you enter a = 1 / 10 the computer can not really do that. 1 / 3 is like that too and so are most other decimals. And there are other sources of error too. That is why when doing numerical work and anyone using a compute is you must know how to get around those problems.

So far we have seen

1) Subtractive cancellation.

2) Representation errors.

Want to see more?

Sure


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#144 2016-06-19 02:29:17

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Polynomial Root Finding

Agnishom wrote:

No, why?

I think comparing a float and an integer is bad. We need typechecking.

Even comparing 2 floats also you have to take care. They can be considered equal if the difference in percentage is less than some low value say 0.001%


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#145 2016-06-19 02:59:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Yep, comparing floats using = is not a good idea.

Sure

Take this difference equation and get for me a[20].

Print out your a[0] to a[20], all 21 numbers.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#146 2016-06-19 03:31:47

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

With M?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#147 2016-06-19 03:34:19

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Nope, use something else that only has double precision.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#148 2016-06-19 03:50:17

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Polynomial Root Finding

Am I supposed to program the log function myself?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#149 2016-06-19 03:52:20

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Polynomial Root Finding

Use this value 0.1177830356563835


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#150 2016-06-19 04:05:25

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Polynomial Root Finding

Feels good to have everything ready cause you've already did it?

Offline

Board footer

Powered by FluxBB