The partial derivative of a function that includes step functions

Click For Summary

Discussion Overview

The discussion revolves around taking the partial derivative of a function that includes unit step functions, particularly in the context of time-dependent variables. Participants explore the implications of the derivative of the Heaviside function and seek continuous approximations for the step function to facilitate differentiation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses difficulty in taking the derivative of a function that includes a unit step function, noting that the derivative of the unit step is infinite.
  • Another participant points out that the function S takes on discrete values and jumps instantaneously, leading to a time derivative that is either 0 or undefined at the jumps.
  • There is a discussion about the nature of the Heaviside function and its derivative being represented by the Dirac delta function, which is said to have an infinite value at the point of discontinuity.
  • Some participants propose using smooth approximations to the step function to make the derivative more manageable, suggesting various forms of interpolation that maintain continuity.
  • One proposed approximation involves a cubic function that transitions smoothly between 0 and 1, while another suggests using a hyperbolic tangent function as a continuous alternative.
  • A later reply questions the choice of parameters in the approximations, specifically whether the parameter related to the smoothness of the transition should correspond to the average time between measurements.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to take the derivative of the function. Multiple competing views on how to handle the discontinuities and approximations remain present throughout the discussion.

Contextual Notes

Limitations include the need for fully specified functions R_j before derivatives can be considered, as well as the unresolved nature of the mathematical steps involved in transitioning from discrete to continuous models.

Who May Find This Useful

This discussion may be of interest to those studying mathematical modeling, particularly in contexts involving discontinuous functions and their derivatives, as well as practitioners looking for methods to approximate step functions in their analyses.

fahraynk
Messages
185
Reaction score
5
TL;DR
a function which includes step functions, but the step function changes with time
I have this function, and I want to take the derivative. It includes a unit step function where the input changes with time. I am having a hard time taking the derivative because the derivative of the unit step is infinity. Can anyone help me?

##S(t) = \sum_{j=1}^N I(R_j(t)) a_j\\
I(R_j) = \begin{array}{cc}
\{ &
\begin{array}{cc}
0 & R_j < 7 \\
1 & R_j \geq 7
\end{array}
\end{array} \\
a_j \text{ is some known constant}
##
##R_j(t) : t \rightarrow Z## (##R_j## is an integer ##\in [1,10]## which decays over time)

##R_j## starts at ##10## and decays over time, and I can approximate its derivative as : ##\frac{dR_j}{dt}= \frac{R_j(t_2) - R_j(t_1)}{t_2-t_1}##

I would like to take the derivative of ##S##

##\frac{\partial S}{\partial t} = \sum_{j=1}^n (\frac{\partial I_j}{\partial R_j} \frac{\partial R_j}{\partial t})a_j##

But, I read that the derivative of a shifted Heaviside function ##H(x-7)## is the dirac delta function ##\delta(x-7)##. But, this dirac delta function, as I am aware, has an infinite value at ##x=7##.

But, the change in ##S## is definitely finite because ##R## decays linearlly with time, so how can ##S## be infinite? How can I get the derivative of ##S##? I want to show how ##S## changes as a function of ##R##

I think the unit step is just by nature not continuous... is there an approximation I can use for this function that would be continuous?
 
Last edited:
Physics news on Phys.org
You have not specified the functions ##R_1,...,R_N##. They need to be fully specified before we can consider taking derivatives.
 
S is a function which takes on discrete values, and jumps instantaneously between those values. The time derivative is either 0 (between jumps) or doesn't exist (at jumps).

fahraynk said:
But, I read that the derivative of a shifted Heaviside function H(x−7) is the dirac delta function δ(x−7).

Yes, in physics we do that. It's not exactly rigorous but makes a certain kind of sense. The Heaviside function has a vertical line in it. The slope of a vertical line is infinite.

The usual approach to make a statement like the above semi-rigorous is to make a smooth approximation, for instance a function which makes the jump in finite time. And then take the limit as that finite time gets smaller and smaller.

fahraynk said:
But, this dirac delta function, as I am aware, has an infinite value at x=7.

But, the change in S is definitely finite because R decays linearlly with time, so how can S be infinite?

Sure, S is finite. But its rate of change, being a finite change divided by a time interval of 0, is infinite. Again, the slope of a vertical line is infinite.

fahraynk said:
I think the unit step is just by nature not continuous... is there an approximation I can use for this function that would be continuous?

Sure. It's just a question of what approximation would be most convenient to work with. First thing that occurs to me is something like this:
$$\hat I(R_j) = \begin{cases}0, & R_j \lt 7 \\
\frac{R_j-7}{a}, & 7 \leq R_j \lt 7 + a \\
1, & R_j \geq 7+a
\end{cases}$$

That interpolates from 0 to 1 over an interval of width ##a##, with a line of slope ##1/a##. This makes ##\hat I## continuous (I'm using a "hat" to indicate that this is a modified version of your indicator function). But its derivative is still not continuous. ##\hat I## is not differentiable at ##7## or ##7+a##.

So my next thing to try for the interpolation is a cubic, a function of the form ##f(R-7) = a_0 + a_1(R-7) + a_2(R-7)^2 + a_3(R-7)^3## with the conditions that it is 0 and 1 at the two endpoints and has derivative 0 at those two endpoints. With a little bit of algebra that leads me to this:

$$\hat I(R_j) = \begin{cases}0, & R_j \lt 7 \\
\frac{3}{a^2}(R_j - 7)^2 - \frac{2}{a^3}(R_j-7)^3, & 7 \leq R_j \lt 7 + a \\
1, & R_j \geq 7+a
\end{cases}$$

This version goes smoothly from 0 to 1 over the interval and is differentiable everywhere. But the piecewise nature might still cause you some headaches. So the other suggestion I have is to use something like ##\hat I(R_j) = \frac{1}{2} \left [1 + \tanh \left ( \frac {R_j - 7}{a} \right ) \right ]##, which becomes the step function in the limit.

In all cases, you would take the limit as ##a \rightarrow 0##.
 
  • Like
  • Love
Likes   Reactions: DEvens and fahraynk
Thanks @RPinPA ! Great answer. If I use that hyperbolic function, its derivative is something like ##\frac{1}{2\alpha} (1 -tanh^2(\frac{R_j - 7}{\alpha} ))##

Which is a function of ##\alpha##.

If ##R_j## is a measurement, would it make sense to set ##\alpha## to be the average time between measurements?
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K