Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21666 > unrolled thread

Subtract two squares a-b in a sqrt numbersystem

Started byjonas.thornvall@gmail.com
First post2013-10-20 09:24 -0700
Last post2013-10-21 15:09 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Subtract two squares a-b in a sqrt numbersystem jonas.thornvall@gmail.com - 2013-10-20 09:24 -0700
    Re: Subtract two squares a-b in a sqrt numbersystem "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-10-20 17:33 -0700
      Re: Subtract two squares a-b in a sqrt numbersystem jonas.thornvall@gmail.com - 2013-10-21 14:51 -0700
        Re: Subtract two squares a-b in a sqrt numbersystem "Chris M. Thomasson" <no@spam.invalid> - 2013-10-21 15:09 -0700

#21666 — Subtract two squares a-b in a sqrt numbersystem

Fromjonas.thornvall@gmail.com
Date2013-10-20 09:24 -0700
SubjectSubtract two squares a-b in a sqrt numbersystem
Message-ID<bea7f9c0-c64d-4ca0-8d54-fd01cc66ea1f@googlegroups.com>
If a number system write out numbers as a sequense of SQRTs+int summed together make up the numbers how would one go on subtracting squares?

Using small exmaple we want to subtract 11^2-5^2
Well in this numbersystem it would of course just be written 11-5

Isn't there a geometrical or set theoretic way using the fact that we can calculate the area creating and adding two overlapping rectangles, and then we subtract area reused twice and end up with. 

(11*6+11*6)-(6*6) and computational wise it of course seem easier to first do the squaring into integers and then perform a straight subtraction.

But could there be gains the way i show for very big squares, or is it always a loss situation?





[toc] | [next] | [standalone]


#21669

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2013-10-20 17:33 -0700
Message-ID<384eea20-0791-442f-b4b8-685a434bdc5a@googlegroups.com>
In reply to#21666
On Sunday, October 20, 2013 11:24:18 AM UTC-5, jonas.t...@gmail.com wrote:
> If a number system write out numbers as a sequense of SQRTs+int summed together make up the numbers how would one go on subtracting squares?
> 
> Using small exmaple we want to subtract 11^2-5^2
> 
> Well in this numbersystem it would of course just be written 11-5
> 
> Isn't there a geometrical or set theoretic way using the fact that we can calculate the area creating and adding two overlapping rectangles, and then we subtract area reused twice and end up with. 
> 
> (11*6+11*6)-(6*6) and computational wise it of course seem easier to first do the squaring into integers and then perform a straight subtraction.
> 
> But could there be gains the way i show for very big squares, or is it always a loss situation?

An interesting fact:

n^2 = 1 + Sigma [0,n] (2n-1)

11^2 = 1+3+5+7+9+11+13+15+17+19+21
 5^2 = 1+3+5+7+9

So by subtraction you'd have (96):
x^2 = 11+13+15+17+19+21

So you can see that each element could be removed directly but for much larger numbers this would not be very efficient as you'd have to expand the series. But this isn't necessary either:

11^2 = 1 + Sigma [0,11] (2n-1)
 5^2 = 1 + Sigma [0,5] (2n-1)

subtraction would then be:

   1 + Sigma [0,11] (2n-1)
- {1 + Sigma [0,5] (2n-1)}
---------------------------
       Sigma [6,11] (2n-1)

So by manipulating the index of the series directly you could get an exact answer for much larger numbers.

Hopefully I understood your question correctly.

[toc] | [prev] | [next] | [standalone]


#21681

Fromjonas.thornvall@gmail.com
Date2013-10-21 14:51 -0700
Message-ID<ea50443a-676b-4d76-baba-d2f81a9de3bc@googlegroups.com>
In reply to#21669
Den måndagen den 21:e oktober 2013 kl. 02:33:17 UTC+2 skrev Michael Haufe (TNO):
> On Sunday, October 20, 2013 11:24:18 AM UTC-5, jonas.t...@gmail.com wrote:
> 
> > If a number system write out numbers as a sequense of SQRTs+int summed together make up the numbers how would one go on subtracting squares?
> 
> > 
> 
> > Using small exmaple we want to subtract 11^2-5^2
> 
> > 
> 
> > Well in this numbersystem it would of course just be written 11-5
> 
> > 
> 
> > Isn't there a geometrical or set theoretic way using the fact that we can calculate the area creating and adding two overlapping rectangles, and then we subtract area reused twice and end up with. 
> 
> > 
> 
> > (11*6+11*6)-(6*6) and computational wise it of course seem easier to first do the squaring into integers and then perform a straight subtraction.
> 
> > 
> 
> > But could there be gains the way i show for very big squares, or is it always a loss situation?
> 
> 
> 
> An interesting fact:
> 
> 
> 
> n^2 = 1 + Sigma [0,n] (2n-1)
> 
> 
> 
> 11^2 = 1+3+5+7+9+11+13+15+17+19+21
> 
>  5^2 = 1+3+5+7+9
> 
> 
> 
> So by subtraction you'd have (96):
> 
> x^2 = 11+13+15+17+19+21
> 
> 
> 
> So you can see that each element could be removed directly but for much larger numbers this would not be very efficient as you'd have to expand the series. But this isn't necessary either:
> 
> 
> 
> 11^2 = 1 + Sigma [0,11] (2n-1)
> 
>  5^2 = 1 + Sigma [0,5] (2n-1)
> 
> 
> 
> subtraction would then be:
> 
> 
> 
>    1 + Sigma [0,11] (2n-1)
> 
> - {1 + Sigma [0,5] (2n-1)}
> 
> ---------------------------
> 
>        Sigma [6,11] (2n-1)
> 
> 
> 
> So by manipulating the index of the series directly you could get an exact answer for much larger numbers.
> 
> 
> 
> Hopefully I understood your question correctly.

Yes you did, was long time since i did any math so i have to look a bit at sigma to fully understand what it is about, but the first example made perfect sense to me. Have to learn interpretate the later and learn to use sigma again.

Thanks

[toc] | [prev] | [next] | [standalone]


#21683

From"Chris M. Thomasson" <no@spam.invalid>
Date2013-10-21 15:09 -0700
Message-ID<l448mk$pbr$1@speranza.aioe.org>
In reply to#21681
> > wrote in message 
> > news:ea50443a-676b-4d76-baba-d2f81a9de3bc@googlegroups.com...
[...]
> > Hopefully I understood your question correctly.

> Yes you did, was long time since i did any math so i have to look a bit at
>  sigma to fully understand what it is about, but the first example made
> perfect sense to me. Have to learn interpretate the later and learn to
> use sigma again.

Sum up the addends... 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web