{ "cells": [ { "cell_type": "markdown", "id": "29cf68fe", "metadata": {}, "source": [ "# formula1\n", "\n", "\n", "\n", "\n", "**Author:** Rene Brun \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:37 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "5a86346e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:05.249292Z", "iopub.status.busy": "2026-05-19T20:37:05.249079Z", "iopub.status.idle": "2026-05-19T20:37:05.633821Z", "shell.execute_reply": "2026-05-19T20:37:05.612511Z" } }, "outputs": [], "source": [ "TCanvas *c1 = new TCanvas(\"c1\", \"Example with Formula\", 200, 10, 700, 500);" ] }, { "cell_type": "markdown", "id": "083cfc9e", "metadata": {}, "source": [ "We create a formula object and compute the value of this formula\n", "for two different values of the x variable." ] }, { "cell_type": "code", "execution_count": 2, "id": "f5c3b42b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:05.648455Z", "iopub.status.busy": "2026-05-19T20:37:05.648309Z", "iopub.status.idle": "2026-05-19T20:37:05.857959Z", "shell.execute_reply": "2026-05-19T20:37:05.857558Z" } }, "outputs": [], "source": [ "auto form1 = new TFormula(\"form1\", \"sqrt(abs(x))\");\n", "form1->Eval(2);\n", "form1->Eval(-45);" ] }, { "cell_type": "markdown", "id": "51787b05", "metadata": {}, "source": [ "Create a one dimensional function and draw it" ] }, { "cell_type": "code", "execution_count": 3, "id": "daa96c4b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:05.865402Z", "iopub.status.busy": "2026-05-19T20:37:05.865274Z", "iopub.status.idle": "2026-05-19T20:37:06.092247Z", "shell.execute_reply": "2026-05-19T20:37:06.091658Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "auto fun1 = new TF1(\"fun1\", \"abs(sin(x)/x)\", 0, 10);\n", "c1->SetGridx();\n", "c1->SetGridy();\n", "fun1->Draw();\n", "c1->Update();" ] }, { "cell_type": "markdown", "id": "2ac78b16", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "e3c21fee", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:06.093616Z", "iopub.status.busy": "2026-05-19T20:37:06.093483Z", "iopub.status.idle": "2026-05-19T20:37:06.339048Z", "shell.execute_reply": "2026-05-19T20:37:06.328658Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%jsroot on\n", "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }