 # Piped operations and calculus

Does anyone know of work which talks about the relationship between programmatic functions and functions in calculus? Specifically, I'm curious about function composition and the pipe, `%>%` operator. I'm a bush league mathematician, but it strikes me that perhaps that's something to do with the fact that I think pipes are easy, but nested functions are hard.

So, this:

h(x) = (f \circ g)(x) = f(g(x))

is equivalent to this:

``````h <- function(x) {
f(g(x))
}
``````

is equivalent to this:

``````x %>%
g() %>%
h()
``````

There is (so far as I'm aware) no mathematical operator equivalent to the pipe, but I see no reason why there couldn't be. If there were, how would it be used to describe things like the chain rule for differentiation?

Anyhoo. Curious what's out there.

2 Likes

I would say that the main reason for not having a mathematical operator for pipes is because pipes are not mathematical operators, but programming operators. Pipes were created to connect processes (first process output is used as input by the second process).
cheers

I see the use of the pipe in R more like the equivalent to a mathematical notation instead of an operator, like Reverse Polish Notation (RPN) for example, in which operators follow their operands.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.