Project

General

Profile

Feature #10225

[PATCH] *math.c: New method Math.normcdf

Added by gogotanaka (Kazuki Tanaka) about 5 years ago. Updated almost 2 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:64951]

Description

I know it looks kind of arbitrary or unnecessary feature ,but I believe that

to provide such a feature as official is helpful to make people we couldn't reach so far have interest in Ruby.

(Actually only this feature is not enough to do that..)

By the way I still wonder whether naming method make sense.

Debating between ...

Math::pnorm   -> R language use this
Math::phi     -> Euler's totient function is more popular as phi,
Math::ncdf
Math::guesscdf
Math::cdf_of_norm,
Math::cdf_of_guess

Finally I come to the conclusion Math::normcdf is most proper length, meaning and has no other worries.


Files

_ math.c New method Math.normcdf.PATCH (1.04 KB) _ math.c New method Math.normcdf.PATCH gogotanaka (Kazuki Tanaka), 09/11/2014 06:21 AM
_ test_math.rb Add tests for Math.normcdf.PATCH (609 Bytes) _ test_math.rb Add tests for Math.normcdf.PATCH gogotanaka (Kazuki Tanaka), 09/11/2014 06:23 AM
_ NEWS About Math.normcdf.PATCH (488 Bytes) _ NEWS About Math.normcdf.PATCH gogotanaka (Kazuki Tanaka), 09/11/2014 06:23 AM

History

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Category set to math
  • Target version set to 2.2.0

Updated by david_macmahon (David MacMahon) about 5 years ago

FWIW, the Ruby/GSL gem already provides support for this (and many other things):

 $ ruby -r gsl -e 'p GSL::Cdf::gaussian_P(1)'
 0.8413447460685429

On Sep 10, 2014, at 11:26 PM, mail@tanakakazuki.com wrote:

Issue #10225 has been reported by gogo tanaka.


Feature #10225: [PATCH] *math.c: New method Math.normcdf
https://bugs.ruby-lang.org/issues/10225

  • Author: gogo tanaka
  • Status: Open
  • Priority: Normal
  • Assignee:
  • Category:

* Target version:

I know it looks kind of arbitrary or unnecessary feature ,but I believe that

to provide such a feature as official is helpful to make people we couldn't reach so far have interest in Ruby.

(Actually only this feature is not enough to do that..)

By the way I still wonder whether naming method make sense.

Debating between ...

Math::pnorm   -> R language use this
Math::phi     -> Euler's totient function is more popular as phi,
Math::ncdf
Math::guesscdf
Math::cdf_of_norm,
Math::cdf_of_guess

Finally I come to the conclusion Math::normcdf is most proper length, meaning and has no other worries.

---Files--------------------------------
_ math.c New method Math.normcdf.PATCH (1.04 KB)
_ test_math.rb Add tests for Math.normcdf.PATCH (609 Bytes)
_ NEWS About Math.normcdf.PATCH (488 Bytes)

--
https://bugs.ruby-lang.org/

Updated by gogotanaka (Kazuki Tanaka) about 5 years ago

david (david he) MacMahon

Actually I know that gem(how nice it is!), I'm disconsolate about a few people knowing that gem.

Even if Ruby/GSL is as strong as python's one, most of people(include me) don't use it.

As for numerical analysis, stability, accuracy or reliability are most important things.

In this respect, I believe that to provide such a feature "as official" is helpful.

Anyway, thank you for telling me that!

gogo.

Updated by david_macmahon (David MacMahon) about 5 years ago

On Sep 16, 2014, at 4:14 PM, mail@tanakakazuki.com wrote:

Actually I know that gem(how nice it is!), I'm disconsolate about a few people knowing that gem.

The gsl gem has its issues (memory management and it can be kind of clunky to use sometimes), but it really does provide a great deal of numerical functionality.

Even if Ruby/GSL is as strong as python's one, most of people(include me) don't use it.

As for numerical analysis, stability, accuracy or reliability are most important things.

Is the GSL itself somehow deficient for your needs? It is also an open source project, so I'm (almost) sure patches would be welcome. Ruby/GSL is also open source, though admittedly under-maintained. :-(

In this respect, I believe that to provide such a feature "as official" is helpful.

I agree that having numerical capabilities better supported would be a great thing, but I'm not sure that the Math module is the best place to do so. There are so many things that could be added! Where would it end? :-)

Dave

Updated by gogotanaka (Kazuki Tanaka) about 5 years ago

david (david he) MacMahon

Sorry for my late. It's hard to say but.. ruby-gsl doesn't look good enough.

And I suppose we'd better to make such a library from scratch.

(Actually I start to make other library(called Numrb)

Aside from that, I believe that providing such a feature "as standard" is really important in terms of reliability.

And we can make people we couldn't reach so far have interest in Ruby.

Updated by david_macmahon (David MacMahon) about 5 years ago

On Oct 11, 2014, at 11:18 PM, mail@tanakakazuki.com wrote:

Sorry for my late. It's hard to say but.. ruby-gsl doesn't look good enough.

I agree that ruby-gsl has its shortcomings. GSL is a fairly large library that provides lots of functionality. Exposing all that functionality to Ruby is no small task. Another issue is memory management; I don't think GSL provides a way to hook into its memory allocation so that creates some issues.

And I suppose we'd better to make such a library from scratch.

(Actually I start to make other library(called Numrb)

Aside from that, I believe that providing such a feature "as standard" is really important in terms of reliability.

I think I prefer a sort of middle ground. I'd like some sort of "standard", built-in way of dealing with multidimensional numerical arrays. I do not think we need to include loads of functionality out of the box, but it would be nice to have a standard multidimensional numerical array data type that different Ruby extensions could be created around. IMHO, this would provide a nice modular approach so that things can evolve with a finer granularity. It would somewhat decouple the numerical algorithms from the underlying data structures as well as provide for better interoperability between the different extensions that use multidimensional numerical arrays.

And we can make people we couldn't reach so far have interest in Ruby.

It's always nice to broaden the appeal of Ruby!

Updated by gogotanaka (Kazuki Tanaka) about 5 years ago

david (david he) MacMahon

Thank you for your valuable comment.

I definitely agree with you. I really want 'built-in way of dealing with multidimensional numerical arrays'

Right now we have Matrix class as standard lib,(it's good!) but it has a problem with performance. (It makes object for each lattice.)
On the other hand SciRuby provide nice gem NMatrix, but we can face some troublesome when installing and updating.(It need ATLAS with CBLAS)

(NumPy does not require any external linear algebra, I like it)

So I have longed for such a built-in way of dealing with multidimensional numerical arrays better.

#9

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Target version deleted (2.2.0)

Also available in: Atom PDF