Average relative distance between 2 functions

Click For Summary

Discussion Overview

The discussion revolves around calculating the average relative distance between two smooth functions, f(x) and g(x), defined on a closed interval [a, b]. Participants explore various methods for this calculation, including integration and statistical analogies, while addressing the complexities involved in transitioning from discrete to continuous values.

Discussion Character

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

Main Points Raised

  • Anna initially proposes a method for calculating average relative distance using discrete values, expressing confusion about extending this to continuous functions.
  • Some participants suggest using integrals to find the average relative distance, with Anna proposing an integral of ([f(x)-g(x)]/g(x))dx divided by (b-a) as a potential solution.
  • Another participant suggests calculating the average values of f(x) and g(x) separately before finding their average, seeking a formula for this approach.
  • Several participants introduce different definitions of "distance" between functions, including uniform, L1, and L2 norms, and discuss their implications for calculating average distances.
  • One participant clarifies that the average distance may be interpreted as the average value of |f(x)-g(x)| over the interval, leading to a formula involving an integral of |f(t)-g(t)|.
  • Anna expresses interest in the average relative distance specifically relative to g(x), indicating a need for clarification on the formulas discussed.

Areas of Agreement / Disagreement

Participants do not reach a consensus on a single method for calculating the average relative distance. Multiple competing views and approaches remain, with ongoing clarification and refinement of ideas.

Contextual Notes

Participants mention the need for assumptions about the functions being continuous and defined on a closed interval. There are also references to statistical concepts that may complicate the understanding of the average in this context.

Anna Kaladze
Messages
34
Reaction score
0
Hi All,

Sorry perhaps for a stupid question, but I am pretty confused by this one...
Suppose I have two different smooth functions, f(x) and g(x) both defined on a closed interval [a,b]. How do I calculate the average relative distance between the all values of these functions (say relative to g(x))? (I do not care about +/- signs). If I had not had functions and only say, 2 discrete values, say, z1=10, y1=8 and z2=20, y2=18, then it would be easy I guess: (1/2)*[(10-8)/8+(20-18)/18]. But for the continuous functions? I assume I need to do some integrations, but my formulas ended up not making sense to me...Please help.

Regards,

Anna.
 
Last edited:
Physics news on Phys.org
P.S. I originally thought that the answer to my question is simply an integral from a to b of
([f(x)-g(x)]/g(x))dx all divided by (b-a) by I am not sure this is correct or not...
 
How about first calculating the avreage value of f(x) then calculating the avreage value of g(x)? Now you have those two, all you need is the avreage of those two.
 
Thanks for your reply. I wonder if you can please tell me what would be a formula for that using the integral? And also if the one I have posted myself as a possible solution is right or not. Thanks.
 
Anna Kaladze said:
Hi All,

Sorry perhaps for a stupid question, but I am pretty confused by this one...
Suppose I have two different smooth functions, f(x) and g(x) both defined on a closed interval [a,b]. How do I calculate the average relative distance between the all values of these functions (say relative to g(x))? (I do not care about +/- signs). If I had not had functions and only say, 2 discrete values, say, z1=10, y1=8 and z2=20, y2=18, then it would be easy I guess: (1/2)*[(10-8)/8+(20-18)/18]. But for the continuous functions? I assume I need to do some integrations, but my formulas ended up not making sense to me...Please help.

Regards,

Anna.

I'm guessing this won't help, but thinking statistically, if you can find the distribution of how values occur over your interval then you can use continuous expectation definition.

This however is probably more work than you need to do and might make your life more complex, but I'm just going from first principles using statistics.

I think the above definition of finding the integral and then dividing by the length of the interval should give the right answer and here is my reason:

Suppose you choose an interval that is purely decreasing or increasing: the probability of each value in the interval is the same (and you can picture this by drawing horizontal lines through the function). Now in a uniform distribution the pdf is (wait for it) 1/length of interval. So you can take the 1/(b-a) out of the integral and you are simply integrating your function.

Using additive properties of integrals you can calculate your required measures for any function.
 
Dear Chiro,
Thanks for reply. I forgot to mention that my functions are simple deterministic functions, and a and b are real numbers. The functions are continuous, like x^2 and x+2 defined over the interval [1,4] (just an example). I wonder if the formula I had still is correct. thanks
 
There are, in fact, many different ways of defining "distance" between two functions:
d(f, g)= max |f(x)- g(x)| if f and g are continuous functions on some closed and bounded interval [a, b] so we can be sure that maximum exists.
(The "uniform norm")

[tex]d(f, g)= \int_a^b |f(x)- g(x)|dx[/tex]
provided that integral exists. (The "L1" norm)

[tex]d(f,g)= \sqrt{\int_a^b (f(x)- g(x))^2 dx}[/tex]
provided that integral exists. (The "L2" norm)

or generally,
[tex]d(f,g)= \sqrt[n]{\int_a^b (f(x)- g(x))^n dx}[/tex]
provided that integral exists. (The "Ln" norm)
 
Thanks a lot, Sir, for your clarifications.
Suppose I am interested in the uniform way, as your 1st formula. How do I compute the average relative distance on a closed interval [a,b]?
Thanks a lot.
 
Anna Kaladze said:
Thanks a lot, Sir, for your clarifications.
Suppose I am interested in the uniform way, as your 1st formula. How do I compute the average relative distance on a closed interval [a,b]?
Thanks a lot.

Well, if you have functions f and g on [a,b], then you just need to calculate the maximum value of |f-g| to know the distance between f and g.

For example, consider f(x)=x2 and g(x)=x on [0,1]. Then we need to know the maximum value of [itex]|x^2-x|[/itex]. A little calculus yields that the derivative of [itex]x^2-x[/itex] is 2x-1. And thus the maximum value occurs at 1/2. Thus

[tex]\max_{x\in [0,1]}{|x^2-x|}=|(1/2)^2-1/2|=1/4[/tex]




However, judging from your posts, it seems that you're actually interesting in something else.
If x is fixed, then the distance between f and g at x is |f(x)-g(x)|. If you're looking for the average distance between f and g in [a,b], then it seems to me that you're actually looking for the average value of |f(x)-g(x)| in [a,b].

Now, for every function h in [a,b], we can calculate the average value as

[tex]\frac{1}{b-a}\int_a^b{h(t)dt}[/tex]

So what you're interested in, is actually

[tex]\frac{1}{b-a}\int_a^b{|f(t)-g(t)|dt}[/tex]

With our example of f(x)=x2 and g(x)=x in [0,1], the average distance becomes

[tex]\frac{1}{1-0}\int_0^1{|t^2-t|dt}=\int_0^1{(t-t^2)dt}=\frac{1}{2}-\frac{1}{3}[/tex]

So the average distance is 1/6.
 
  • #10
Dear micromass,
Thank you for your thorough reply.
Yes, my question involving the distance was a bit confused as I mixed up the terminology a bit. But you are right, in a nutshell this is what I ws interested in.
However, I am interested in the average relative distance relative to g(x), for example. I think your formula is for the average only, yes?
Thanks a lot.
Anna.
 
  • #11
Anna Kaladze said:
Dear Chiro,
Thanks for reply. I forgot to mention that my functions are simple deterministic functions, and a and b are real numbers. The functions are continuous, like x^2 and x+2 defined over the interval [1,4] (just an example). I wonder if the formula I had still is correct. thanks

I was trying to point out how you could think of the analogy between expectation in the statistical sense and average in your case.

What you want to do is find the average of a continuous function and it seems you are having trouble finding it for the continuous case. All I was doing was to show you one analogy through the expectation formula of a continuous random variable.

I know your function is deterministic. It's probably not obvious what I am saying and for that I apologize. Maybe if your interested you can read the above post again.

The bottom line is that your intuition of taking the integral and dividing by the length of the integral is correct.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 36 ·
2
Replies
36
Views
7K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K