Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4760
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: need a quicker method for SquaresR func |
| Date | 2011-09-05 11:18 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j42b66$rsr$1@smc.vnet.net> (permalink) |
> SquaresR ... like JacobiTheta OR something else....
Hi. I see you don't have an answer.
I don't either, but I thought this was interesting
http://mathworld.wolfram.com/SumofSquaresFunction.html
Item # 39 had a code for R4.
Downloading the workbook gave this as 1 alternative as a generating
function, but I'm afraid it's slower.
fx[n_]:=Coefficient[Series[EllipticTheta[3,0,q]^4,{q,0,n}],q,n]
fx[10000]//Timing
{4.65, 18744}
SquaresR[4,10000]//Timing
{0.00008, 18744}
This version was faster, but not as fast as the built-in function:
8 Plus@@Select[Divisors[100000000],Mod[#,4]!=0&]//Timing
{0.002715,11718744}
SquaresR[4,100000000]//Timing
{0.000972,11718744}
As a side note, it looks like the solution is about 2-3 times the size
of the input, on average.
So, I would guess your answer is larger than your input.
Sounds like a tough problem with inputs that large.
t=Table[SquaresR[4,n]/n //N, {n,1000,300000,1000}] ;
{Mean[t],StandardDeviation[t]}
{2.956801,1.680969}
= = = = = = = = = =
Good Luck. :>)
Dana DeLouis
$Version
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)
On Aug 25, 7:12 am, Time Traveler <time.traveler...@gmail.com> wrote:
> Hi;
> For a research project I need a quicker way to obtain SquaresR
> function. example --> SquaresR[4 , H] . The problem is ;
>
> Integer H is quite large (about 200 digit) and it takes exceedingly
> long time to return the ans. Is there a quicker way to find this
> stated function by a different methods, like JacobiTheta OR
> something else....
>
> Thanks for help in advance
> Time
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: need a quicker method for SquaresR func Dana DeLouis <dana01@me.com> - 2011-09-05 11:18 +0000
csiph-web