Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11316
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Functions That Remember Values They Have Found |
| Date | 2012-08-12 05:48 +0000 |
| Message-ID | <k07g47$cm4$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
> Hgeom[n_] :=
> H[n] = Sum[(1 - 0.5)^i/(1 - 0.5^i) Hgeom[n - i], {i, 1, n}]/n
> Hgeom[0] = 1;
Hi. I see you have a solution. If you later want to eliminate the recursive part...
fx[n_]:=((-1)^-n 2^(1/2 (-1+n) n))/QPochhammer[2,2,n]
Hgeom3[18]//Timing
{0.00296, =
11417981541647679048466287755595961091061972992/864390930149924278258644465301081415783295060766875}
fx[18]//Timing
{0.000073, =
11417981541647679048466287755595961091061972992/864390930149924278258644465301081415783295060766875}
%%[[-1]]==%[[-1]]
True
fx[4]//N
0.203175
= = = = = = = = = =
HTH :>)
=E2=80=A8Dana DeLouis
Mac & Mathematica 8
To understand recursion, one must first understand recursion.
=E2=80=A8= = = = = = = = = =
On Aug 6, 4:53 am, Esteban Gonz=C3=A1lez Morales <yo8...@gmail.com> wrote:
> Hi, I was trying to create a recursive function and I read the help about it, and wrote this code
>
> Hgeom[n_] :=
> H[n] = Sum[(1 - 0.5)^i/(1 - 0.5^i) Hgeom[n - i], {i, 1, n}]/n
> Hgeom[0] = 1;
>
> However, when I calculate Hgeom[10] it gives me the right value, and then I ask for the information about Hgeom and get that it has values calculated.
>
> Have you any idea what could have gone wrong?
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Functions That Remember Values They Have Found Dana DeLouis <dana01@me.com> - 2012-08-12 05:48 +0000
csiph-web