continued fraction 
Author Message
 continued fraction

do anyone can provide me a code of continued fraction where the inputs
will be the a(i) and b(i)?


Thu, 25 Aug 2011 12:52:44 GMT  
 continued fraction

Quote:
> do anyone can provide me a code of continued fraction where the inputs
> will be the a(i) and b(i)?

Use E01RBF from NAG library: http://www.nag.co.uk/numeric/Fl/manual/pdf/E01/e01rbf.pdf

A.



Fri, 26 Aug 2011 03:40:14 GMT  
 continued fraction

Quote:
> do anyone can provide me a code of continued fraction where the inputs
> will be the a(i) and b(i)?

Ref: AMS 55, otherwise known as the "Handbook of Mathematical
Functions" or "Abramowitz & Stegun", Section 3.10.1, page 19.

One online version is here

http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP?Res=200&Pag...

See the matrix formulation listed in (3) or the corresponding
equations.

If you have partial quotients, then the a(i) are 1. For example,
approximate PI by computing partial quotients

3, 7, 15, 1, 292 ...

for which the convergents are

3, 22/7, 333/106, 355/113 ...

and so on.

--- e



Fri, 26 Aug 2011 04:05:39 GMT  
 continued fraction
oh thanks. i made it with "numerical recepies"


Fri, 26 Aug 2011 11:16:11 GMT  
 continued fraction

Quote:

>oh thanks. i made it with "numerical recepies"

That book should be burnt.  Some of it is reliable; other bits are
so bad that even an inexperienced programmer is better off writing
something from scratch.  Version 2 is much better than version 1,
but is still dire.

Regards,
Nick Maclaren.



Fri, 26 Aug 2011 16:24:40 GMT  
 continued fraction

Quote:

>>oh thanks. i made it with "numerical recepies"

> That book should be burnt.  Some of it is reliable; other bits are
> so bad that even an inexperienced programmer is better off writing
> something from scratch.

I think it's useful as a sort of high-level overview of what the major
algorithms are in various subfields of numerical analysis, without
getting bogged down in the details. If you want to know the details,
there are of course much better books for any specific subject, but
I'm not aware of any single book that provides the breadth of NR. Even
the "general purpose" NA books seem to focus on a much narrower choice
of subjects, although this then of course allows a much more indepth
treatment.

As for the code itself, I think it's mostly useful as a sort of
pseudocode. Once you have the overview, you know what to search for
e.g. on netlib, or you can implement it yourself. I've never used the
code myself, but I also recall it had some more or less obnoxious
licensing restrictions.

Quote:
>  Version 2 is much better than version 1,
> but is still dire.

Any idea of the recently released 3rd edition? They seem to have
scrapped the fortran and C versions and gone with only C++. Then
again, at least the C version of the 2nd edition is more or less F77
written in C syntax, so I guess their C++ isn't any better either. But
as long as you use it as pseudocode rather than implementation code to
lift, it doesn't matter that much which language it's done in.

--
JB



Fri, 26 Aug 2011 20:10:40 GMT  
 continued fraction

Quote:



>>>oh thanks. i made it with "numerical recepies"

>> That book should be burnt.  Some of it is reliable; other bits are
>> so bad that even an inexperienced programmer is better off writing
>> something from scratch.

>I think it's useful as a sort of high-level overview of what the major
>algorithms are in various subfields of numerical analysis, without
>getting bogged down in the details. If you want to know the details,
>there are of course much better books for any specific subject, but
>I'm not aware of any single book that provides the breadth of NR. ...

Nor one that is as likely to lead the reader into catastrophe.  Its
"high level" comments are as much a problem as its code - some are
true and reliable, but some are potentially catastrophic.  And, of
course, only an expert can tell which :-(

Regards,
Nick Maclaren.



Fri, 26 Aug 2011 20:46:48 GMT  
 continued fraction

Quote:

> > That book should be burnt.  Some of it is reliable; other bits are
> > so bad that even an inexperienced programmer is better off writing
> > something from scratch.

> I think it's useful as a sort of high-level overview of what the major
> algorithms are in various subfields of numerical analysis, without
> getting bogged down in the details.

I think it is one of the best introductory books on numerical
algorithms available for scientists and engineers.  It has problems,
as do other books in this area, but if you try to think of an
alternative book that covers the same material, there isn't anything
better.

Having said that, the authors never really wrote a good f90 version
of the book.  Their f90 book was really a supplement to their
previous f77 book, so it is not convenient to use.  The latest
version is written in C++, and it uses a lot of language specific
features, so I don't know how useful it is going to be to a
scientist or engineer interesting in writing fortran programs.

I think the f77 version of the book is probably the best for what it
was.  The C version relied on illegal pointer constructs in order to
try to make the C code look like the formal equations.  As mentioned
above, the f90 version was incomplete by itself.  The first C++
version corrupted the equations to make them look more like the
programming language.  The latest version in C++ uses too many of
the obscure OOP features of the language  and is difficult for a
scientist or engineer to understand.

As far as using code from the book, there is almost always better
code available from netlib, or lapack, or TOMS, or whatever, but
this code is not good for teaching, or learning, either introductory
numerical methods or scientific programming in general.

It seems that as the fortran community has now moved past f77, there
really is a need for a modern version of the NR book.  I don't know
if it will ever be written.

$.02 -Ron Shepard



Sat, 27 Aug 2011 01:11:01 GMT  
 continued fraction


Quote:

>I think it is one of the best introductory books on numerical
>algorithms available for scientists and engineers.  It has problems,
>as do other books in this area, but if you try to think of an
>alternative book that covers the same material, there isn't anything
>better.

And, if you are the sort of person who gets consulted when competent
programmers can't work out why their code isn't giving the right
answers, there aren't many things that are worse :-(

About half of the cases brought to me where the code came from there
were fixed by either replacing the NR code with something crude but
much better, or by telling the user that NR's claim that the method
would solve the problem was quite simply wrong.

Regards,
Nick Maclaren.



Sat, 27 Aug 2011 00:29:37 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Continued Fractions.

2. Pell Equation (was: Continued Fractions.)

3. Continued fractions, help needed.

4. continued fractions

5. Looking for references: Gosper, Continued Fraction Arithmetic

6. Finite Continued Fractions in SICP

7. iterative vs recursive processes WAS Finite Continued Fractions

8. continued fraction software MERRCZ

9. fractions

10. LinkJ fractions hack

11. Floats and Fractions

12. Eyyptian unit fractions

 

 
Powered by phpBB® Forum Software