Hi,
I’ve started using PyROOT (because python rocks!). I was wondering if anyone knew how to do the following in python:
#include <stdio.h>
#include <TMath.h>
int main()
{
int x[12] = {8,2,4,2,4,2,4,4,1,5,6,3};
double mean = TMath::Mean(12, x);
double median = TMath::Median(12, x);
printf("%lf %lf\n", mean, median);
}
//---------------------------------
here’s my best attempt but it the numbers for mean and median are wrong:
#!/usr/bin/python
from ROOT import TMath
from array import array
x=array(‘i’, [8,2,4,2,4,2,4,4,1,5,6,3])
mean=TMath.Mean(12, x)
median=TMath.Median(12, x)
print mean, median
###################
The problem I’m having is with TMath, I think.
I’m using ROOT 4.02/00 pro
Regards,
Karol.