Package parasol :: Module Goal :: Class Goal
[hide private]
[frames] | no frames]

Class Goal

source code


Find the value of X in the range minX to maxX that returns goalVal from funcOfX.

This CLASS version of goal finder allows nested Goal loops, (unlike FORTRAN version via f2py)

Based on the world's best root finder by Jack Crenshaw, http://www.embedded.com/story/OEG20030508S0030, turned into object-oriented world's best "goal-value" finder by Charlie Taylor

returns (X, ierror): the value of X and an error flag

Instance Methods [hide private]
 
__call__(self, xval=0.0) source code
 
__init__(self, goalVal=0.0, minX=0.0, maxX=1000.0, funcOfX=None, tolerance=0.0001, maxLoops=40, failValue=None)
Find the value of X in the range minX to maxX that returns goalVal from funcOfX.
source code
 
cren_goal(self, goal, x0, x2, f, eps, imax) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, goalVal=0.0, minX=0.0, maxX=1000.0, funcOfX=None, tolerance=0.0001, maxLoops=40, failValue=None)
(Constructor)

source code 

Find the value of X in the range minX to maxX that returns goalVal from funcOfX.

Parameters:
  • goalVal - goal value (float)
  • minX - minimum value of X considered (float)
  • maxX - maximum value of X considered (float)
  • funcOfX - function of x (callable), expects a float input, returns a float.
  • tolerance - accuracy termination criteria (float), in same units as goalVal
  • maxLoops - maximum number of search loops (int)
  • failValue - value returned in case of error (float or None)
Overrides: object.__init__