{ "cells": [ { "cell_type": "markdown", "id": "17ef629d", "metadata": {}, "source": [ "# pdf001_Normal\n", "Tutorial illustrating the new statistical distributions functions (pdf, cdf and quantile)\n", "\n", "\n", "\n", "\n", "**Author:** Anna Kreshuk \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:26 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "3f4d55fa", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:25.668869Z", "iopub.status.busy": "2026-05-19T20:26:25.668755Z", "iopub.status.idle": "2026-05-19T20:26:26.149317Z", "shell.execute_reply": "2026-05-19T20:26:26.148733Z" } }, "outputs": [], "source": [ "TF1 *pdfunc = new TF1(\"pdf\",\"ROOT::Math::normal_pdf(x, [0],[1])\",-5,5);\n", "TF1 *cdfunc = new TF1(\"cdf\",\"ROOT::Math::normal_cdf(x, [0],[1])\",-5,5);\n", "TF1 *ccdfunc = new TF1(\"cdf_c\",\"ROOT::Math::normal_cdf_c(x, [0])\",-5,5);\n", "TF1 *qfunc = new TF1(\"quantile\",\"ROOT::Math::normal_quantile(x, [0])\",0,1);\n", "TF1 *cqfunc = new TF1(\"quantile_c\",\"ROOT::Math::normal_quantile_c(x, [0])\",0,1);\n", "\n", "pdfunc->SetParameters(1.0,0.0); // set sigma to 1 and mean to zero\n", "pdfunc->SetTitle(\"\");\n", "pdfunc->SetLineColor(kBlue);\n", "\n", "pdfunc->GetXaxis()->SetLabelSize(0.06);\n", "pdfunc->GetXaxis()->SetTitle(\"x\");\n", "pdfunc->GetXaxis()->SetTitleSize(0.07);\n", "pdfunc->GetXaxis()->SetTitleOffset(0.55);\n", "pdfunc->GetYaxis()->SetLabelSize(0.06);\n", "\n", "cdfunc->SetParameters(1.0,0.0); // set sigma to 1 and mean to zero\n", "cdfunc->SetTitle(\"\");\n", "cdfunc->SetLineColor(kRed);\n", "\n", "cdfunc->GetXaxis()->SetLabelSize(0.06);\n", "cdfunc->GetXaxis()->SetTitle(\"x\");\n", "cdfunc->GetXaxis()->SetTitleSize(0.07);\n", "cdfunc->GetXaxis()->SetTitleOffset(0.55);\n", "\n", "cdfunc->GetYaxis()->SetLabelSize(0.06);\n", "cdfunc->GetYaxis()->SetTitle(\"p\");\n", "cdfunc->GetYaxis()->SetTitleSize(0.07);\n", "cdfunc->GetYaxis()->SetTitleOffset(0.55);\n", "\n", "ccdfunc->SetParameters(1.0,0.0); // set sigma to 1 and mean to zero\n", "ccdfunc->SetTitle(\"\");\n", "ccdfunc->SetLineColor(kGreen);\n", "\n", "qfunc->SetParameter(0, 1.0); // set sigma to 1\n", "qfunc->SetTitle(\"\");\n", "qfunc->SetLineColor(kRed);\n", "qfunc->SetNpx(1000); // to get more precision for p close to 0 or 1\n", "\n", "qfunc->GetXaxis()->SetLabelSize(0.06);\n", "qfunc->GetXaxis()->SetTitle(\"p\");\n", "qfunc->GetYaxis()->SetLabelSize(0.06);\n", "qfunc->GetXaxis()->SetTitleSize(0.07);\n", "qfunc->GetXaxis()->SetTitleOffset(0.55);\n", "qfunc->GetYaxis()->SetTitle(\"x\");\n", "qfunc->GetYaxis()->SetTitleSize(0.07);\n", "qfunc->GetYaxis()->SetTitleOffset(0.55);\n", "\n", "cqfunc->SetParameter(0, 1.0); // set sigma to 1\n", "cqfunc->SetTitle(\"\");\n", "cqfunc->SetLineColor(kGreen);\n", "cqfunc->SetNpx(1000);\n", "\n", "TCanvas * c1 = new TCanvas(\"c1\",\"Normal Distributions\",100,10,600,800);\n", "\n", "c1->Divide(1,3);\n", "c1->cd(1);\n", "\n", "pdfunc->Draw();\n", "TLegend *legend1 = new TLegend(0.583893,0.601973,0.885221,0.854151);\n", "legend1->AddEntry(pdfunc,\"normal_pdf\",\"l\");\n", "legend1->Draw();\n", "\n", "c1->cd(2);\n", "cdfunc->Draw();\n", "ccdfunc->Draw(\"same\");\n", "TLegend *legend2 = new TLegend(0.585605,0.462794,0.886933,0.710837);\n", "legend2->AddEntry(cdfunc,\"normal_cdf\",\"l\");\n", "legend2->AddEntry(ccdfunc,\"normal_cdf_c\",\"l\");\n", "legend2->Draw();\n", "\n", "c1->cd(3);\n", "qfunc->Draw();\n", "cqfunc->Draw(\"same\");\n", "TLegend *legend3 = new TLegend(0.315094,0.633668,0.695179,0.881711);\n", "legend3->AddEntry(qfunc,\"normal_quantile\",\"l\");\n", "legend3->AddEntry(cqfunc,\"normal_quantile_c\",\"l\");\n", "legend3->Draw();" ] }, { "cell_type": "markdown", "id": "fc9a2700", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "53deca94", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:26.151506Z", "iopub.status.busy": "2026-05-19T20:26:26.151382Z", "iopub.status.idle": "2026-05-19T20:26:26.488252Z", "shell.execute_reply": "2026-05-19T20:26:26.487687Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "