Usage of TMath in Pyroot

_ROOT Version: 6.12
_Platform: centos 7
_Compiler: g++ --version 4.8.5

Hello, I am looking for a translation of some cpp code :

double b_I0(double k, double L_n, double r){
return TMath::BesselI0(2kr/L_n);

to pyroot code.

I want to use short methods as b_I0 to keep the code easy to understand, short and easy to alter.

Thanks for your answers!

Hi @iMi,

Do you have any particular issue with translating this code?

Please propose a Python implementation and I will be happy to point out if there is any issue.



Hi @etejedor,

yes I do have a very simple one:

def b_I0(k, L_n, r):
return TMath::BesselI0(2kr/L_n)

Hi @iMi,
That should work, besides the TMath::Bessel part which should be TMath.Bessel in Python, plus a previous from ROOT import TMath

Hi @etejedor,

this worked. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.