Numerical differentiation and integration nodes??

Hi,

Im new to Knime and I’d like to use it in oder to process some simple XY raw data. However, I cannot find any note that does numerical integration or differentiation (+smoothening?). It would be great if someone could give me a hint.

Up until know I was using Programms like orgining but as I have to process a larger set of files I would like to automatize the process

Hi @KugelFang,

You can do differentiation using the combination of the Lag Column node, which copies column values from preceding rows into the current row (with the predefined lag and lag interval parameters) to a new column and the Math Formula node to subtract values in the columns. Please check knime://EXAMPLES/50_Applications/10_Energy_Usage/01_Energy_Usage_Time_Series_Prediction on the Examples server for more details.

For smoothing please check the Moving Average node, you also might want to check the Moving aggregation node.

However there is no any dedicated node for numeric integration in KNIME.

Best,
Anna

Hey,

I have developed a smoothing node, which currently does rectangular and triangular smoothing. See here on NodePit: https://nodepit.com/node/de.cyface.smoothing.SmoothingNodeFactory

Feel free to use it and provide feedback on whether this works or not and if not why. :wink:

As far as integration goes I believe you can just use a sum. Since KNIME does not work with functions, but only with discrete values. For this reason you are never going to need an infinite sum (which is an integral as far as I know). The same should work for differentiation. Just remember how your teacher back in school introduced you to the difference quotient before going to the limit via the differential quotient. A difference quotient should be easy to calculate via any KNIME Script Node (Python, Java, R, …).

However I am a computer scientist and no mathematician, so feel free to call bullshit. :wink:

For example I use a Java Snippet Node with the following code to build the “integral” over a double column l1:

// system imports
import org.knime.base.node.jsnippet.expression.AbstractJSnippet;
import org.knime.base.node.jsnippet.expression.Abort;
import org.knime.base.node.jsnippet.expression.Cell;
import org.knime.base.node.jsnippet.expression.ColumnException;
import org.knime.base.node.jsnippet.expression.TypeException;
import static org.knime.base.node.jsnippet.expression.Type.*;
import java.util.Date;
import java.util.Calendar;
import org.w3c.dom.Document;

// Your custom imports:

// system variables
public class JSnippet extends AbstractJSnippet {
    // Fields for input columns
    /** Input column: "l1" */
    public Double c_l1;

    // Fields for output columns
    /** Output column: "integralL1" */
    public Double out_integralL1;

    // Your custom variables:
    private static double lastSum = 0;

    // expression start
    public void snippet() throws TypeException, ColumnException, Abort {
        // Enter your code here:
        lastSum += c_l1;
        out_integralL1 = lastSum;
    }
}