# Numerical integration

I have tried searching and have not come up with an answer to this question - but have come close in my own work (i think). Note: I want to solve this numerically, or by some formula.

I am trying to solve this problem, save I have function $$f(x)$$, the equation is not known. Its derivative, $$f'(x)$$, is known.

I want to find the value of at q, $$f(q)$$, using its derivative. I have been searching for an algorithm or formula for this and all of my results have been off topic (getting results about general integration rules, which is not what I want).

For situations similar to $$f'(x)=x^n$$, where n is a constant, the equation
$$f(q)=\int_{0}^{q}x^n$$
is accurate. And indeed, for any derivative $$f'(x)$$ where $$f(0)=0$$, this is true. And I know this since
$$\int_{a}^{b}f'(x)=f(b)-f(a)$$
However this does not work on all $$f'(x)$$, and I can not test if $$f(0)=0$$ since I do not have its equation, and am solving numerically.

After some thinking and work, I cam up with
$$f(q)=(\int_{0}^{q}x^n)+f'(0)-1$$
This works on many other equations. Such as
$$f'(x)=e^{-x^{2}}$$
&
$$f'(x)=cos(x)$$.

However it does not work over all, and believe it will fail when $$f(0)=f'(0)=0$$. As I've tested a few such as
$$f'(x)=x^3$$
which will fail under my new formula ($$f'(0)=f(0)=0$$).
$$f'(x)=atan(x)$$
will also fail, ($$f'(0)=f(0)=0$$)

However the problem remains that I can not check if $$f(0)=0$$, especially since I'm solving for f(q) in the first place! (since $$0\in\Re$$). As far as i can tell, my new formula will work so long as $$f'(0)=f(0)=0$$ is not true, which means if I could some how test for $$f(0)=0$$ I would have the problem solved (well for the most part, I dont have a proof, but would be a well tested heuristic).

I think I've fully explained what I'm trying to do - if it is unclear please ask and I will try to be more specific, and if anyone knows the solutions or has an idea please let me know! (or if this is in the wrong thread)

HallsofIvy
Homework Helper
?? I have no idea what you are doing here! You can't find f from its derivative because an infinite number of different functions have the same derivative. If you are also assuming that f(0)= 0, please say that.

But even then, you seem to be saying that $\int_0^q x^n dx+ f'(0)- 1$ will approximate n. For what n? How do you determine what n to use?

If f'(x)= cos(x), and f(0)= 0, then f(x) is -sin(x). I don't see how you can argue that $\int_0^q x^n dx$ will approximate -sin(x) over any reasonable interval for any n.

As I said, n is just some constant in that particular equation. And I am saying that equation works, when $$f(0)=0$$, and indeed you can try it.
Of course you can find f from its derivatives.... its called an integral, and I am not searching for the integral, but looking to approximate its value at $$q$$ that is why
$$\int_{a}^{b}f(x)=f(b)-f(a)$$
is useful, becasue when $$f(0)=0$$
i can do this
$$\int_{0}^{b}f(x)=f(b)-0$$
which gives me the value at $$f(b)$$ and in turn I can give it q, and find f(q).
ie: try it for the $$x^n$$ that i mentioned.

$$f(q)=\int_{0}^{q}x^n=\frac{q^{n+1}}{n+1}-\frac{0^{n+1}}{n+1}=\frac{q^{n+1}}{n+1}$$
Giving me the value of $$f(q)$$
However, I do not know when $$f(0)=0$$, which is why I am asking about a general formula, since I am trying to do this numerically, (similar to Simpson's rule).

I dont think you finished reading my post, I never said $\int_0^q x^n dx+ f(0)- 1$, I said it works for other equations, under the situations I specifed, please read my post before replying! (I even showed x^3, same as x^n, which does not work - again, please read!)

And indeed, I have discoverd a way to solve the problem using the equations I've given, but if someone knows of a formal or already well proven algorithm (or ideas for one) I would still appreciate it! (My algorithm is a heuristic, i have not proven it :( )