Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21681
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2013-10-21 14:51 -0700 |
| References | <bea7f9c0-c64d-4ca0-8d54-fd01cc66ea1f@googlegroups.com> <384eea20-0791-442f-b4b8-685a434bdc5a@googlegroups.com> |
| Message-ID | <ea50443a-676b-4d76-baba-d2f81a9de3bc@googlegroups.com> (permalink) |
| Subject | Re: Subtract two squares a-b in a sqrt numbersystem |
| From | jonas.thornvall@gmail.com |
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
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web