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:

func : callable

function to integrate, must take single parameter

value : float

desired final value of the integral

start : float (optional)

value at which to start integration, default -Infinity

stop : float (optional)

value at which to stop integration, default +Infinity

maxit : integer

maximum number of iterations

Returns:

out : float

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.