comp.lang.ada
 help / color / mirror / Atom feed
* Erfc() function in ADA
@ 2019-04-01 16:28 leov
  2019-04-01 17:01 ` gautier_niouzes
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: leov @ 2019-04-01 16:28 UTC (permalink / raw)


Greetings, I have been looking into reimplementing a collection of numerical heavy code from R/C++ into ADA and so far things seem doable. My only question is about the support for the error function and in particular the complementary error function erfc(). I assume this is library dependent so I would appreciate any information if erfc() is part of the ADA standard library or perhaps provided by GNAT in some form?

-Leo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 16:28 Erfc() function in ADA leov
@ 2019-04-01 17:01 ` gautier_niouzes
  2019-04-01 17:05   ` leov
  2019-04-01 23:35 ` Jerry
  2019-04-02 10:39 ` gautier_niouzes
  2 siblings, 1 reply; 8+ messages in thread
From: gautier_niouzes @ 2019-04-01 17:01 UTC (permalink / raw)


You can get easily the error function from the Phi function which is available in the following library: http://mathpaqs.sourceforge.net/
HTH


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 17:01 ` gautier_niouzes
@ 2019-04-01 17:05   ` leov
  0 siblings, 0 replies; 8+ messages in thread
From: leov @ 2019-04-01 17:05 UTC (permalink / raw)


On Monday, April 1, 2019 at 1:01:09 PM UTC-4, gautier...@hotmail.com wrote:
> You can get easily the error function from the Phi function which is available in the following library: http://mathpaqs.sourceforge.net/
> HTH

Thank you! I was actually looking for phi which is not available in the C++ standard library so we use erfc() to compute it. So this is a perfect match.

-Leo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 16:28 Erfc() function in ADA leov
  2019-04-01 17:01 ` gautier_niouzes
@ 2019-04-01 23:35 ` Jerry
  2019-04-02  8:07   ` Dmitry A. Kazakov
  2019-04-07 23:01   ` Jerry
  2019-04-02 10:39 ` gautier_niouzes
  2 siblings, 2 replies; 8+ messages in thread
From: Jerry @ 2019-04-01 23:35 UTC (permalink / raw)


On Monday, April 1, 2019 at 9:29:00 AM UTC-7, le...@gammawizard.com wrote:
> Greetings, I have been looking into reimplementing a collection of numerical heavy code from R/C++ into ADA and so far things seem doable. My only question is about the support for the error function and in particular the complementary error function erfc(). I assume this is library dependent so I would appreciate any information if erfc() is part of the ADA standard library or perhaps provided by GNAT in some form?
> 
> -Leo

I have used Ada for intense numerical work for many years and it awesome for that. But from time to time I need a special function and then I frown. I have linked to libraries in GNU Scientific Library and Octave and a couple of times to specialized libraries. I have translated Numerical Recipes to Ada. (Thanks to Gautier for the Pascal-to-Ada converter but one can also convert it quickly yourself if you want to.) I've even cobbled together a few lines that write an Octave (Matlab) script to a text file, then call Octave to execute it, and read the results from a second file back into my Ada program. And not long ago someone on this list (sorry, forgot who, but a regular poster) put up a way to connect to Julia code--this is really promising but I haven't followed up on that.

Having a deep, readily-accessible access to numerical code has been a problem with Ada: I wish there would be a concerted effort to alleviate this deficiency.

Jerry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 23:35 ` Jerry
@ 2019-04-02  8:07   ` Dmitry A. Kazakov
  2019-04-07 23:01   ` Jerry
  1 sibling, 0 replies; 8+ messages in thread
From: Dmitry A. Kazakov @ 2019-04-02  8:07 UTC (permalink / raw)


On 2019-04-02 01:35, Jerry wrote:

> Having a deep, readily-accessible access to numerical code has been a problem with Ada: I wish there would be a concerted effort to alleviate this deficiency.

The community is too small. But I wish that too. E.g. I needed an 
implementation of elementary functions returning an interval or else an 
exact result within the machine epsilon. They were absent.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 16:28 Erfc() function in ADA leov
  2019-04-01 17:01 ` gautier_niouzes
  2019-04-01 23:35 ` Jerry
@ 2019-04-02 10:39 ` gautier_niouzes
  2019-04-03 16:01   ` leov
  2 siblings, 1 reply; 8+ messages in thread
From: gautier_niouzes @ 2019-04-02 10:39 UTC (permalink / raw)


A few random remarks...

1) For further references: there is now in Mathpaqs (rev. 153+) a separate Erf_function package.
Since Phi_function.Phi uses Erf(x) anyway, it's better to have access to Erf directly.

2) About the Numerical Recipies: be careful, some versions support only 7-8 digits (single precision), so numerical errors cumulate very quickly.

3) Some good stuff can be found in the Alglib and Cephes libraries, in C, Fortran or Pascal

4) Simple special functions (with one parameter) could well be in an official Ada.Numerics.Generic_Special_Functions (low maintenance effort for compiler vendors)

5) Don't forget to check: https://www.adaic.org/ada-resources/tools-libraries/

6) Perhaps the Alire system has some math packages ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-02 10:39 ` gautier_niouzes
@ 2019-04-03 16:01   ` leov
  0 siblings, 0 replies; 8+ messages in thread
From: leov @ 2019-04-03 16:01 UTC (permalink / raw)


On Tuesday, April 2, 2019 at 6:39:59 AM UTC-4, gautier...@hotmail.com wrote:
> A few random remarks...
> 
> 1) For further references: there is now in Mathpaqs (rev. 153+) a separate Erf_function package.
> Since Phi_function.Phi uses Erf(x) anyway, it's better to have access to Erf directly.
> 
> 2) About the Numerical Recipies: be careful, some versions support only 7-8 digits (single precision), so numerical errors cumulate very quickly.
> 
> 3) Some good stuff can be found in the Alglib and Cephes libraries, in C, Fortran or Pascal
> 
> 4) Simple special functions (with one parameter) could well be in an official Ada.Numerics.Generic_Special_Functions (low maintenance effort for compiler vendors)
> 
> 5) Don't forget to check: https://www.adaic.org/ada-resources/tools-libraries/
> 
> 6) Perhaps the Alire system has some math packages ?

Thanks for enhancing the library. I just ported my code and the Phi function is working like a charm.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Erfc() function in ADA
  2019-04-01 23:35 ` Jerry
  2019-04-02  8:07   ` Dmitry A. Kazakov
@ 2019-04-07 23:01   ` Jerry
  1 sibling, 0 replies; 8+ messages in thread
From: Jerry @ 2019-04-07 23:01 UTC (permalink / raw)


On Monday, April 1, 2019 at 4:35:32 PM UTC-7, Jerry wrote:
And not long ago someone on this list (sorry, forgot who, but a regular poster) put up a way to connect to Julia code--this is really promising but I haven't followed up on that.
> 
> Having a deep, readily-accessible access to numerical code has been a problem with Ada: I wish there would be a concerted effort to alleviate this deficiency.
> 
> Jerry

The CLA post that I mentioned recently, referring to calling both ways between Ada and Julia, is due to Dmitry's Simple Components. Sorry for being too lazy to look it up earlier. Here's the post:

https://groups.google.com/forum/#!msg/comp.lang.ada/-04_gtq6G-o/HmzxX-_jEgAJ

Simple Components is here:

http://www.dmitry-kazakov.de/ada/components.htm

Jerry


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-07 23:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 16:28 Erfc() function in ADA leov
2019-04-01 17:01 ` gautier_niouzes
2019-04-01 17:05   ` leov
2019-04-01 23:35 ` Jerry
2019-04-02  8:07   ` Dmitry A. Kazakov
2019-04-07 23:01   ` Jerry
2019-04-02 10:39 ` gautier_niouzes
2019-04-03 16:01   ` leov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox