Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-12

Special math. functions (erf, erfc, ...)

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johann Glaser

Hi!

I'm searching for FreePascal implementations of some special mathematical functions related to statistics like erf, erfc and some other cumulative probability functions. Did anybody implement such functions already (e.g. from the Numerical Recipies)?

Is it allowed to use the Numerical Recipies PDF files (e.g. http://www.nrbook.com/b/bookcpdf/c6-2.pdf) and type ones Pascal program one-by-one to the printed source code?

Thanks
Hansi

Johann Glaser Vienna University of Technology Electrical Engineering ____ http://www.johann-glaser.at/ ____
Florian Klaempfl
to Johann Glaser
Show quoted text 11 lines
Hi! I'm searching for FreePascal implementations of some special mathematical functions related to statistics like erf, erfc and some other cumulative probability functions. Did anybody implement such functions already (e.g. from the Numerical Recipies)? Is it allowed to use the Numerical Recipies PDF files (e.g. http://www.nrbook.com/b/bookcpdf/c6-2.pdf) and type ones Pascal program one-by-one to the printed source code?

http://www.numerical-recipes.com/infotop.html#distinfo

Johann Glaser
to Florian Klaempfl

Hi!

Florian Klaempfl wrote 14 lines
Johann Glaser schrieb: > Hi! > > I'm searching for FreePascal implementations of some special > mathematical functions related to statistics like erf, erfc and some > other cumulative probability functions. Did anybody implement such > functions already (e.g. from the Numerical Recipies)? > > Is it allowed to use the Numerical Recipies PDF files (e.g. > http://www.nrbook.com/b/bookcpdf/c6-2.pdf) and type ones Pascal program > one-by-one to the printed source code? > http://www.numerical-recipes.com/infotop.html#distinfo

Thanks for pointing this out. So, it is not possible to use the source code from the PDFs to do anything "useful".

But I found the GNU Scientific Library (GSL) which includes a lot, and especially some functions I'm seeking for. Did anybody write some FreePascal bindings for that?

Bye
Hansi

Johann Glaser
to Unknown author

Hi!

Am Samstag, den 16.12.2006, 11:30 +0000 schrieb

Show quoted text 10 lines
Hi Hansi, > I'm searching for FreePascal implementations of some special > mathematical functions related to statistics like erf, erfc and some > other cumulative probability functions. Did anybody implement such > functions already (e.g. from the Numerical Recipies)? Some functions are available here in the unit ustat.zip: http://www.polarhome.com/~franco

Thanks for the hint! I can now calculate normal distribution and chi²-distribution. Do you know where I can find documentation on how to calculate the ciritcal values (i.e. inverse) of students' (t) distribution, F-distribution and for some non-parametric tests (Newman-Keuls-test, Cochran-Test, U-Test, ...)

Thanks
Hansi

Unknown author
to Johann Glaser

Hi Hansi,

Show quoted text 14 lines
> I'm searching for FreePascal implementations of some special > mathematical functions related to statistics like erf, erfc and some > other cumulative probability functions. Did anybody implement such > functions already (e.g. from the Numerical Recipies)? Some functions are available here in the unit ustat.zip: http://www.polarhome.com/~franco Thanks for the hint! I can now calculate normal distribution and chi-distribution. Do you know where I can find documentation on how to calculate the ciritcal values (i.e. inverse) of students' (t) distribution, F-distribution and for some non-parametric tests (Newman-Keuls-test, Cochran-Test, U-Test, ...)

The direct/inverse students' distribution and F-distribution are in the sources stdtrl.c and fdtrl.c of the Moshier's ldouble C library:

http://www.moshier.net/ldouble.zip

You can read about Cochran and SNK methods in many books, also available via web. A starting point for statistics resources may be the site

http://home.ubalt.edu/ntsbarsh/Business-stat/R.htm

Franco

Jeff Miller
to Johann Glaser: Hi! Am Samstag, den 16.12.2006, 11:30 +0000 schrieb Thanks for the hint! I can now…

This is slightly off-topic, but nonetheless somewhat relevant to these special math functions...

Can anyone explain what is the precision of fpc's
built-in math functions like sqrt, ln, exp, and so on?

According to the online documentation, these take
a ValReal argument and return a ValReal result:

  e.g.:  function sqrt(d: ValReal):ValReal;

But what exactly is a ValReal? Real? Double? Extended?

It would be ideal if these math functions would take arguments of different precision and return results in the same precision. Is that what happens?

I am asking because I need extended precision versions of sqrt, etc, and I do not believe fpc provides that (at least by default). I have seen the mpcalc unit, but I was hoping for a solution that doesn't involve a special unit (with special coding).

Thank you for any information or suggestions...

Jeff

Jonas Maebe
to Jeff Miller
Jeff Miller wrote 10 lines
This is slightly off-topic, but nonetheless somewhat relevant to these special math functions... Can anyone explain what is the precision of fpc's built-in math functions like sqrt, ln, exp, and so on? According to the online documentation, these take a ValReal argument and return a ValReal result: e.g.: function sqrt(d: ValReal):ValReal; But what exactly is a ValReal? Real? Double? Extended?

The highest supported precision by the compiler on the used fpu. For x86 and x86_64 (except for Win64, because it no longer supports the x87) that is 80 bits "extended", on other platforms that's currently 64 bits (except maybe those that use emulation, they may be limited to 32 bits).

It would be ideal if these math functions would take arguments of different precision and return results in the same precision. Is that what happens?

No, they always return a result with the highest possible precision.

I am asking because I need extended precision versions of sqrt, etc, and I do not believe fpc provides that (at least by default).

It does (on x86 and non-Win64 x86-64 at least).

Jonas

Alexey Pavluchenko
to Johann Glaser: Hi! I'm searching for FreePascal implementations of some special mathematical functions…

Hello Johann,

Friday, December 15, 2006, 10:28:04 PM, you wrote:

JG> I'm searching for FreePascal implementations of some special JG> mathematical functions related to statistics like erf, erfc and some JG> other cumulative probability functions. Did anybody implement such JG> functions already (e.g. from the Numerical Recipies)?

http://www.unilim.fr/pages_perso/jean.debord/index.htm

Also check

http://www-rab.larc.nasa.gov/nmp/fNMPhome.htm

Best regards, Alexey