I need help implementing a derivative block for my custom type “function” in my Math Blocks “library”.
I tried using the prime derivative formula, my secant block, and my limit block, but it didn’t work. It kept reporting 0.
My project is here.
I need help implementing a derivative block for my custom type “function” in my Math Blocks “library”.
I tried using the prime derivative formula, my secant block, and my limit block, but it didn’t work. It kept reporting 0.
My project is here.
I have a detail point and a big point to make about this.
The detail: The usual way to compute a derivative numerically is to use your secant block with a tiny step size, such as 10^(-200), and just chop off a few digits of the result. That’ll generally be close, unless you’re at a pole of the function.
The big point: You seem to be combining two different approaches, numeric and symbolic. If your function is a polynomial, which it seems mostly to be, then you know how to get the derivative symbolically; it’s nx^(n-1) for each term. The way a math package such as Mathematica does derivatives is to extend the same approach to non-polynomial functions; it knows about derivatives of trig functions; it knows about derivatives of exponentials; and so on. So any function that has a closed (symbolic) form can be differentiated termwise.
I already did symbolic derivatives for gp’s, and I tried a small step size already for my function adt derivative (i want to take derivatives of generalized polynomials symbolically, and derivatives of other functions numerically)
If you learned calculus, you should think of the formula [1] of the formula list which I mentioned below. If you put an extremely small value, you get the more accurate result. For example, I substituted h=1\times 10^{-8} into the formula [1], and got the formula [2] and it was more accurate.
Snap! implementation:
The OP already tried that.
What is the specific example that didn’t work? There were a lot of blocks lying around in your scripting area and I wasn’t sure which to look at.
Do you need a solution without using limits?
The derivative block was in the ‘functions’ subsection of the Math Blocks category in the palette
I just want any solution that works
That’s not a specific example. I want to know what to click on to see the wrong answer you get, with the specific inputs you used.
WHO is Sunghyun ![]()
Why are you roleplaying on the forums?