Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

How can I import previously created math functions?

by bladx (Chaplain)
on Sep 04, 2001 at 01:20 UTC ( #109945=categorized question: print w/replies, xml ) Need Help??
Contributed by bladx on Sep 04, 2001 at 01:20 UTC
Q&A  > math


Are there other modules other than the basic MATH module(s) that contain libraries of common equations, as to alleviate writing out each individual equation?

Answer: How can I import previously created math functions?
contributed by Zaxo

PDL is an extension which gives high speed matrix operations, and more. It has been used a lot for graphics and for scientific computing.

Gsl is a yet-incomplete extension which uses the Gnu Scientific Library (GSL). It is a wip, only in version 0.03. So far it has bindings for calculating special functions. I was unable to install it due to hardcoded paths which disagreed with my gsl tree.

Answer: How can I import previously created math functions?
contributed by ariels

The amazing Inline module offers help here, too. Not all <math.h> functions are available in Perl (even if you use POSIX;).

Here's how to print some erf() values, for instance (a function almost certainly available in your maths library):

perl -le 'use Inline C => q{ double erf(double); }, ENABLE => "AUTOWRA +P"; print "$_ ",erf($_) for (0..5)'

You can of course write it into your modules, and use it to access you own libraries.

Other C wrapping options are XS (of course) and Swig.

Answer: How can I import previously created math functions?
contributed by randyk

The Math::Cephes module contains an interface to math functions of Stephen Moshier's cephes math library. Interfaces are also included to handle some common polynomial, matrix, fraction, and complex number operations.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (6)
    As of 2021-03-02 18:12 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (57 votes). Check out past polls.