# root_numpy.evaluate¶

`root_numpy.``evaluate`(obj, array)

Evaluate a ROOT histogram, function, graph, or spline over an array.

Parameters: obj : TH[1|2|3], TF[1|2|3], TFormula, TGraph, TSpline, or string A ROOT histogram, function, formula, graph, spline, or string. If a string is specified, a TFormula is created. array : ndarray An array containing the values to evaluate the ROOT object on. The shape must match the dimensionality of the ROOT object. y : array An array containing the values of the ROOT object evaluated at each value in the input array. TypeError If the ROOT object is not a histogram, function, graph, or spline. ValueError If the shape of the array is not compatible with the dimensionality of the ROOT object being evaluated. If the string expression does not compile to a valid TFormula expression.

Examples

```>>> from root_numpy import evaluate
>>> from ROOT import TF1, TF2
>>> func = TF1("f1", "x*x")
>>> evaluate(func, [1, 2, 3, 4])
array([  1.,   4.,   9.,  16.])
>>> func = TF2("f2", "x*y")
>>> evaluate(func, [[1, 1], [1, 2], [3, 1]])
array([ 1.,  2.,  3.])
>>> evaluate("x*y", [[1, 1], [1, 2], [3, 1]])
array([ 1.,  2.,  3.])
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.57277274,"math_prob":0.9960035,"size":1164,"snap":"2020-34-2020-40","text_gpt3_token_len":344,"char_repetition_ratio":0.15172414,"word_repetition_ratio":0.08510638,"special_character_ratio":0.33591065,"punctuation_ratio":0.26792452,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98004484,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-03T09:09:04Z\",\"WARC-Record-ID\":\"<urn:uuid:829f84bf-ed2a-4b32-9dd0-b8d12aad0d21>\",\"Content-Length\":\"13978\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8d2bb842-c7c4-4fea-bd6b-ae8a78d3c2df>\",\"WARC-Concurrent-To\":\"<urn:uuid:b76b105f-b0b2-4a21-ac43-0de184945122>\",\"WARC-IP-Address\":\"185.199.108.153\",\"WARC-Target-URI\":\"http://scikit-hep.org/root_numpy/reference/generated/root_numpy.evaluate.html\",\"WARC-Payload-Digest\":\"sha1:KI4OZ7ZGRZ7L6CVJQZNG2V7XTHN3OHRW\",\"WARC-Block-Digest\":\"sha1:SNVIVZYISPOCQ77SUSLAQKFCKXFQGRDO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439735792.85_warc_CC-MAIN-20200803083123-20200803113123-00560.warc.gz\"}"}