{ "cells": [ { "cell_type": "markdown", "id": "80b288f7", "metadata": {}, "source": [ "# Integration\n", "Numerical integration using R passing the function from ROOT\n", "\n", "\n", "\n", "\n", "**Author:** \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:27 PM." ] }, { "cell_type": "code", "execution_count": null, "id": "20737f8a", "metadata": { "collapsed": false }, "outputs": [], "source": [ "%%cpp -d\n", "#include\n", "#include\n", "#include\n", "#include" ] }, { "cell_type": "markdown", "id": "179382de", "metadata": {}, "source": [ " To integrate using R the function must be vectorized\n", "The idea is just to receive a vector like an argument,to evaluate\n", "every element saving the result in another vector\n", "and return the resultant vector.\n", " " ] }, { "cell_type": "code", "execution_count": null, "id": "41e4cfe8", "metadata": { "collapsed": false }, "outputs": [], "source": [ "%%cpp -d\n", "std::vector BreitWignerVectorized(std::vector xx)\n", "{\n", " std::vector result(xx.size());\n", " for(Int_t i=0;i wf(BreitWignerWrap);\n", "ROOT::Math::Integrator i(wf);\n", "value=i.Integral(-2,2);\n", "std::cout<<\"Integral of the BreitWigner Function in the interval [-2, 2] MathMore = \"<