_ROOT Version: 6.16/00
Platform: MacOs Mojave 10.14.4
Compiler: Not Provided
I installed Root with Homebrew .
When I try to compile this macro
Double_t func1D(Double_t *x, Double_t *par){
Double_t xx=x[0];
Double_t val=TMath::Abs(par[0]*sin(par[1]*xx)/xx);
return val;
}
Double_t func2D(Double_t *x, Double_t *par){
Double_t xx=x[0];
Double_t yy=x[1];
Double_t val=par[0]*TMath::Exp(-((xx-par[1])*(xx-par[1])+(yy-par[1])*(yy-par[1])) /(2.*par[2]*par[2]));
return val;
}
void makeFunctions(){
//
//very simple TF1 and TF2 examples
//
//
TF1 *f1 = new TF1("func1D",func1D,0,10,2);
f1->SetParameters(2,1);
TCanvas *c1 = new TCanvas("c1","TF1 example",200,10,600,400);
c1->Divide(1,2); // divisioni asse x e divisoini asse y
//print out some values;
cout << "the value of f1(1.) is:" << f1->Eval(1.)<< endl;
//can get its derivative
cout << "the value of f1'(1.) is:" << f1->Derivative(1.)<< endl;
c1->cd(1);
f1->Draw();
c1->cd(2);
f1->DrawDerivative();
TF2 *f2 = new TF2("f2",func2D,-3,3,-3,3,3);
f2->SetParameters(100,0,1);
TCanvas *c2 = new TCanvas("c2","TF2 example",200,10,600,400);
cout << "the value of f2(1.,2.) is:" << f2->Eval(1.,2.) << endl;
f2->Draw("surf");
}
I get these errors :
`*** Break *** segmentation violation`
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCling.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libRint.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libRint.so] TRint::HandleTermInput() (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCore.so] TUnixSystem::CheckDescriptors() (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCore.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCore.so] TSystem::InnerLoop() (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCore.so] TSystem::Run() (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libCore.so] TApplication::Run(bool) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/lib/root/libRint.so] TRint::Run(bool) (no debug info)
[/usr/local/Cellar/root/6.16.00_1/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)
**************************************
After this just one Canvas appears with just one function . The second one doesn't even do that .
Any suggestions ? Am I missing some libraries?