ordinary/accumulator recursion

Randles srandles@bigpond.net.au
Mon, 10 Sep 2001 17:02:58 +1000


This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C13A1A.710813C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi, Im a computer science undergraduate and we are studying haskell as =
part of our course. I have a question on recursion that i'd like to =
receive some sort of answer to.

The question is to write a function to sum the first n terms in the =
series:

1/1 + 1/3 + 1/5+ .. + 1/(2n-1)

using ordinary recursion and then using accumulator recursion.

Please help!

Regards Stephanie

------=_NextPart_000_0017_01C13A1A.710813C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi, Im a computer science undergraduate =
and we are=20
studying haskell as part of our course. I have a question on recursion =
that i'd=20
like to receive some sort of answer to.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The question is to write a function to =
sum the=20
first n terms in the series:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1/1 + 1/3 + 1/5+ .. + =
1/(2n-1)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>using ordinary recursion and then using =
accumulator=20
recursion.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Please help!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards =
Stephanie</FONT></DIV></BODY></HTML>

------=_NextPart_000_0017_01C13A1A.710813C0--