Hi
I am trying to define a function that calculates the error of assuming linearity in a region of another function.
My function must do the following:
- Accept 3 inputs, the nonlinear function (preferably just a function name defined elsewhere, f(x)), the center of the region (xi) and the half-width of the region being investigated (delta).
- Generate slope and intercept of the asymptote linear function in xi, Lin(x).
- Generate an error function err(x) = Lin(x) - f(x), err(xi) = 0 by definition.
- Integrate err(x), from xi-delta to xi+delta, and divide by 2*delta, to find the mean error in the region.
- Use the mean error to calculate the standard deviation of the error in the region (also involves integration)
In trying to do this I run into three problems:
- How do I get the Function-function in jsl to accept another function as input?
- How do i get the Derivative-function to differentiate a function argument, supplied by function name, e.g. Derivative(f(x),x)?
- How do I get jsl to integrate a function in certain region? I can't find a built-in function to do this.
I hope some can help.