Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
_tf1.pyzdoc
Go to the documentation of this file.
2
5
8
9\code{.py}
10def func(x: numpy.ndarray, pars: numpy.ndarray) -> float:
11 return pars[0] * x[0] * x[0] + x[1] * pars[0]
12
13my_func = ROOT.TF1("my_func", func, -10, 10, npar=2, ndim=2)
15
17arrays.
18
19dataset:
20
21\code{.py}
22import ROOT
23import math
24import numpy as np
25
27 return p[1] * x[0] * x[1] / (p[0]**2) * math.exp(-p[2] / p[0])
28
29rtf1_coulomb = ROOT.TF1("my_func", pyf_tf1_coulomb, -10, 10, ndims = 2, npars = 3)
30
31# charges
32x = np.array([
33 [1.0, 10, 2.0],
34 [1.5, 10, 2.5],
35 [2.0, 10, 3.0],
36 [2.5, 10, 3.5],
37 [3.0, 10, 4.0]
38])
39
40params = np.array([
41 [1.0], # Distance between charges r
42 [8.99e9], # Coulomb constant k (in N·m²/)
43 [0.1] # Additional factor for modulation
44])
45
46# Slice to avoid the dummy column of 10's
47res = rtf1_coulomb.EvalPar(x[:, ::2], params)
49
51\code{.py}
52import numpy as np
53
55myFunction = ROOT.TF1("myExampleFunction", "[0] + [1] * x + [2]*sin([3] * x) + [4]*cos([5] * x)", -5, 5)
56
57# declare the parameters as a numpy.array or array.array
58myParams = np.array([0.04, 0.4, 3.0, 3.14, 1.5, 3.14])
59
60# note: the following line would also work by setting all six parameters equal to 3.0
61# myParams = np.array([3.0] * 6)
62
65
#define a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
static Roo_reg_AGKInteg1D instance
void SetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Restore the parameters from pars into the function.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
1-Dim function class
Definition TF1.h:234
A 2-Dim function with parameters.
Definition TF2.h:29
A 3-Dim function with parameters.
Definition TF3.h:28
TLine * line
pythonization(class_name, ns="::", is_prefix=False)
Decorator that allows to pythonize C++ classes.
Definition __init__.py:24
Double_t x[n]
Definition legend1.C:17
for(Int_t i=0;i< n;i++)
Definition legend1.C:18
T Slice(const T &histo, std::vector< Int_t > &args)
Creates a sliced copy of the given histogram.
Definition TH1.h:74
AxisAngle::Scalar Distance(const AxisAngle &r1, const R &r2)
Distance between two rotations.
Definition AxisAngle.h:321
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition RExports.h:167
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TString as(SEXP s)
Definition RExports.h:86
void evaluate(typename Architecture_t::Tensor_t &A, EActivationFunction f)
Apply the given activation function to each value in the given tensor A.
Definition Functions.h:98
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)