Finding derivative by first principle
$$
f'(x) = \lim_{x \to 0}\frac{f(x + h) - f(h)}{h}
$$

I wrote a program that calculate any derivative for any function as long as it's with respect to x, although in the first principle, the h is dismissed as a result, however, the executable string can only contains one variable, it's x, so I have to get rid of h, the most convenient method that works is to let it to be one ,by using $f'(x) = f(x + 1) - f(x)$, I did the following:
$$ \text{for: } f(x) = 2x^3 + x^{-1} $$
- replace the
xto(x + 1)in that string to get $f(x + 1)$,2 * (x + 1) ** 3 + (x + 1) ** -1 - subtract with $f(x)$,
(2 * (x + 1) ** 3 + (x + 1) ** -1) - (2 * x ** 3 + x ** -1)
It's pretty simple, and works fine. However, I find it impractical for integration. which with knowing the expression, it's hard to work out the integral (I am trying to get an equation, not an area value)
refer to this post.
@Simply Beautiful Art, suggested that
By letting $x = t^2$ and applying PFD over complex numbers, you'll get integrals of the form $\int{\frac{sin(t^2)}{t-a}}dt$, from there, replace sine with its complex exponential definition and use incomplete gamma functions.
I cannot relate this context to computation.
here is the question, if we know an expression, which has one variable x, such as:
# these are executable strings which I can pass in a numeric value as x and get y as output
'2 * x ** 3 + x ** -1'
'3.1415926 * sin(x) * ln(x) * 2'
Is there a way I can compute an integral for the function?
Hope I have stated it clear, sorry if I confused you.

his dismissed as a result, however, the executable string can only contains one variable, it'sx, so I have to get rid ofh, the most convenient method that works is to let it to be one – Weilory May 20 '21 at 14:32xand varies operators) I can not work out the integral (I am trying to get an equation, not an area value)" This paragraph is a bit confusing , I suggest you edit it – tryst with freedom May 20 '21 at 15:23