spacepy.toolbox.intsolve

spacepy.toolbox.intsolve(func, value, start=None, stop=None, maxit=1000)[source]

Find the function input such that definite integral is desired value.

Given a function, integrate from an (optional) start point until the integral reached a desired value, and return the end point of the integration.

Parameters:
funccallable

function to integrate, must take single parameter

valuefloat

desired final value of the integral

startfloat (optional)

value at which to start integration, default -Infinity

stopfloat (optional)

value at which to stop integration, default +Infinity

maxitinteger

maximum number of iterations

Returns:
outfloat

x such that the integral of L{func} from L{start} to x is L{value}

Note: Assumes func is everywhere positive, otherwise solution may

be multi-valued.