Using a function for the Apache Commons Math Newton Solver
              in 
             Contributed Library Questions 
              •  
              2 years ago    
            
 
           
             Hi Processing Community,
            
            
this is probably a no-brainer to some of you more experienced folks but its driving me crazy.....
            
I want to use the Root finding algorithms from the Apache Commons Math Library (which is working fine otherwise)....
            
How do I have to define the function??? The below code doesn't work....Lets say I want to find the zero of cosine, between 1 and 5.....
            
 
           
 
            
           this is probably a no-brainer to some of you more experienced folks but its driving me crazy.....
I want to use the Root finding algorithms from the Apache Commons Math Library (which is working fine otherwise)....
How do I have to define the function??? The below code doesn't work....Lets say I want to find the zero of cosine, between 1 and 5.....
 UnivariateRealFunction function =cos();
 
 final double relativeAccuracy = 1.0e-12;
 final double absoluteAccuracy = 1.0e-8;
 
 UnivariateRealSolver solver = new PegasusSolver(relativeAccuracy, absoluteAccuracy);
 double c = solver.solve(100, function, 1.0, 5.0, AllowedSolutions.LEFT_SIDE);
 
              
              1  
            
 
            
 
 
           
 
            