Learn R Programming

nnR (version 0.1.0)

Etr: Etr

Description

The function that returns the \(\mathsf{Etr}\) networks.

Usage

Etr(n, h)

Value

An approximation for value of the integral of a function. Must be instantiated with a list of \(n+1\) reals

Arguments

n

number of trapezoids to make. Note this will result in a set of trapezoids. A natural number.

h

width of trapezoids. A positive real number.

Note: Upon instantiation with any continuous function this neural network must be fed with \(n+1\) real numbers representing the values of the function being approximated at the \(n+1\) meshpoints which are the legs of the \(n\) trapezoids as stipulated in the input parameter \(n\)..

References

Definition 2.33. Rafi S., Padgett, J.L., Nakarmi, U. (2024) Towards an Algebraic Framework For Approximating Functions Using Neural Network Polynomials https://arxiv.org/abs/2402.01058

Examples

Run this code
Etr(5, 0.1)
seq(0, pi, length.out = 1000) |> sin() -> samples
Etr(1000 - 1, pi / 1000) |> inst(ReLU, samples)

seq(0, 2, length.out = 1000)^2 -> samples
Etr(1000 - 1, 2 / 1000) |> inst(Tanh, samples)

Run the code above in your browser using DataLab