{
"cells": [
{
"cell_type": "markdown",
"id": "d6b4d86f",
"metadata": {},
"source": [
"# ChebyshevPol\n",
"Example of Chebyshev polynomials\n",
"using TFormula pre-defined definitions of chebyshev polynomials.\n",
"\n",
"\n",
"\n",
"\n",
"**Author:** Lorenzo Moneta \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:24 PM."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "43bd8300",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:24:18.752020Z",
"iopub.status.busy": "2026-05-19T20:24:18.751847Z",
"iopub.status.idle": "2026-05-19T20:24:19.272501Z",
"shell.execute_reply": "2026-05-19T20:24:19.271619Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Info in : created default TCanvas with name c1\n"
]
}
],
"source": [
"auto legend = new TLegend(0.88,0.4,1.,1.);\n",
"\n",
"int colors[] = { kRed, kRed+3, kMagenta, kMagenta+3, kBlue, kBlue+3, kCyan+3, kGreen, kGreen+3, kYellow, kOrange };\n",
"\n",
"for (int degree=0; degree <=10; ++degree) {\n",
" auto f1 = new TF1(\"f1\",TString::Format(\"cheb%d\",degree),-1,1);\n",
" // all parameters are zero apart from the one corresponding to the degree\n",
" f1->SetParameter(degree,1);\n",
" f1->SetLineColor( colors[degree]);\n",
" f1->SetMinimum(-1.2);\n",
" f1->SetMaximum(1.2);\n",
" TString opt = (degree == 0) ? \"\" : \"same\";\n",
" //f1->Print(\"V\");\n",
" f1->SetNpx(1000);\n",
" f1->SetTitle(\"Chebyshev Polynomial\");\n",
" f1->Draw(opt);\n",
" legend->AddEntry(f1,TString::Format(\"N=%d\",degree),\"L\");\n",
"}\n",
"legend->Draw();"
]
},
{
"cell_type": "markdown",
"id": "d6556afb",
"metadata": {},
"source": [
"Draw all canvases "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e85c0794",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:24:19.274124Z",
"iopub.status.busy": "2026-05-19T20:24:19.273995Z",
"iopub.status.idle": "2026-05-19T20:24:19.591007Z",
"shell.execute_reply": "2026-05-19T20:24:19.590640Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
"
\n",
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"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
}