The partial derivative of a function that includes step functions

In summary, the conversation discusses a function S(t) and the difficulty in taking its derivative due to the presence of a unit step function. Various approximations are suggested to make the unit step function continuous, such as using a smooth interpolation or a hyperbolic function. The conversation also touches upon the concept of the derivative of a shifted Heaviside function and its relationship to the Dirac delta function.
  • #1
fahraynk
186
6
TL;DR Summary
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
  • #2
You have not specified the functions ##R_1,...,R_N##. They need to be fully specified before we can consider taking derivatives.
 
  • #3
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 DEvens and fahraynk
  • #4
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?
 

1. What is a step function?

A step function is a mathematical function that changes abruptly from one constant value to another at specific points, known as steps. These steps can be represented graphically as vertical lines.

2. How do you take the partial derivative of a function that includes step functions?

To take the partial derivative of a function that includes step functions, you first need to identify the step points and the constant values before and after each step. Then, you can use the standard rules of differentiation to find the partial derivatives of the function on either side of the step points. Finally, you can combine these partial derivatives to get the overall partial derivative of the function.

3. Can you give an example of a function that includes step functions?

One example of a function that includes step functions is the Heaviside step function, also known as the unit step function. It is defined as H(x) = 0 for x < 0 and H(x) = 1 for x ≥ 0. This function is commonly used in physics and engineering to represent a sudden change or "jump" in a system.

4. What is the significance of the partial derivative of a function that includes step functions?

The partial derivative of a function that includes step functions can help us understand how the function changes at specific points. It allows us to analyze the behavior of the function and make predictions about its values at different points. This information is useful in many fields, such as economics, physics, and engineering.

5. Are there any special rules for taking the partial derivative of a function with step functions?

Yes, there are some special rules that need to be followed when taking the partial derivative of a function that includes step functions. These rules involve considering the behavior of the function at the step points and using the chain rule to combine the partial derivatives on either side of the step points. It is important to carefully identify and handle these step points to accurately find the partial derivative of the function.

Similar threads

Replies
6
Views
2K
  • Calculus
Replies
2
Views
2K
Replies
4
Views
2K
Replies
5
Views
1K
Replies
3
Views
1K
Replies
1
Views
1K
  • Calculus
Replies
2
Views
2K
Replies
6
Views
911
  • Calculus and Beyond Homework Help
Replies
10
Views
922
Replies
6
Views
1K
Back
Top