mathmodelica

How to use beta function in modelica


When I define a calculation in modelica, I need to use the beta function, but I can't find the beta function in the library.

How can I use the beta function in modelica, or implement a beta function?

Thank you very much!

It would be best if there is a library that can be called directly. If not, I hope the implementation can be simpler.


Solution

  • Such special math functions are not part of the Modelica Standard Library, but already available in the Modelica ecosystem by wrapping gsl_sf_beta of the GSL in Modelica-GNU_ScientificLibrary

    This is a minimal Modelica example

    model M
     Real B = GNU_ScientificLibrary.Functions.specfunc.beta_Bab(1, 2);
     annotation(uses(GNU_ScientificLibrary(version="1.0.0")));
    end M;