• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

Math Problems

steve_bank

Diabetic retinopathy and poor eyesight. Typos ...
Joined
Nov 9, 2017
Messages
13,743
Location
seattle
Basic Beliefs
secular-skeptic
A ways back tere was a lebgthy thread with problems. Back when there were more people.

An exponential probability density function is y(x) = k*e^(-x/u) where k and u are constants. u represents the mean. The standard deviation of the distribution equals u. y is defined x = 0 to +infinity.

For x = T what values of T and k does the arithmetic mean of y from 0 to T = u?
 
It is nifty that the mean equals the standard deviation for the exponential distribution, regardless of what that mean is.

For the discrete Poisson distribution the mean equals the variance -- also nifty (and again regardless). By the way, a uniform random variate can be converted to an exponential random variate with a "one-liner"; but I don't know how to construct a Poisson variate without some uglyish loop.

A ways back tere was a lebgthy thread with problems. Back when there were more people.

An exponential probability density function is y(x) = k*e^(-x/u) where k and u are constants. u represents the mean. The standard deviation of the distribution equals u. y is defined x = 0 to +infinity.

For x = T what values of T and k does the arithmetic mean of y from 0 to T = u?

Comments:
(1) In your pdf y(x) = k*e^(-x/u), k isn't a free parameter. It takes whatever value it needs to take to make the area under the curve y(x) equal to 1. In fact that "normalizing" value is k = 1/u ... I think.
(2) The first thing I would do with your expressions is replace all the u's with some other letter! That's because d(uv) = udv + vdu is almost all the calculus I remember so I use it a lot as is; and I don't want to get my u's mixed up! :cool:
(3) I didn't solve the problem; partly because my math is so rusty, and partly because the problem statement seems ambiguous. Does "mean of y" take the mean uniformly over (0,T)? Or does it use y also as pdf? Did you really mean "x = T" ?
 
In statistics u is the mean. In magnetics literature u means voltage. Arithmetic mean is clear. That is why I said arithmetic mean.

1/u = lamba for an exponential distribution. In reliability engineering for an exponential model it represents the mean time between failures. A distribution is frequency, time is 1/frequency.

I'll post the solution in a few days in case there is somebody who wants to work it.
 
(2) The first thing I would do with your expressions is replace all the u's with some other letter! That's because d(uv) = udv + vdu is almost all the calculus I remember so I use it a lot as is; and I don't want to get my u's mixed up! :cool:
In statistics u is the mean.... Arithmetic mean is clear. That is why I said arithmetic mean.

Don't be so defensive! My comment about changing the u's was intended to be FUNNY. (Although it also happens to be TRUE.)
Yeah, I know that very few appreciate my sense of whimsy ... or even know when I'm being whimsical. :(

But if we're nit-picking, the customary symbol for mean only LOOKS a bit like a "u": -- μ μ μ μ. These are MU's -- in fact, with my keyboard lacking a MU, I rewrote your expressions with "m."

I'll post the solution in a few days in case there is somebody who wants to work it.

No problem! Not me though; I've put this in my out-basket waiting to be spoon-fed the answers to my questions. :cool:
(3) I didn't solve the problem; partly because my math is so rusty, and partly because the problem statement seems ambiguous. Does "mean of y" take the mean uniformly over (0,T)? Or does it use y also as pdf? Did you really mean "x = T" ?
 
I looked at simulating Swamis prisoner problem.

I started a review of distributions, exponential and normal being common. How to create a distribution. My Scilab tool has functions to do that, but that is no fun.

Y = k*e^-t/u

The peak value is at t = 0 is k. With u equaling the standard deviation and 5 standard deviations being approximately 99.9% of the values then intuitively k is approximately 5*u.
So I tested it and it worked.

u = 200.
k = 5*u
n = 10000
s = 0
tl = 0
th = k
dt = (th - tl)/n
t = [tl:dt:k]

Numerical integration of the average
for i = 1:n
y(i) = k*%e^(-t(i)/u)
s = s + y(i)
end
a = s/n

Then analytically.

The average value of a function is (1/T)*ʃf(t)dt from t = 0 to T.

Integrating average value a from 0 to T, a = average value.
y = k*e^(t/u)
a (-k*u*e^(-T/u) –-k*u* e^(0/u))/T
a = -k*u*(e^(-T/u) – e^(0/u)/T

With T = k

a = -u*(e^(-T/u) – e^(0/u))
a = -u*(e^(-T/u) – 1)
As T → +inf e^(-T/u) → 0 and for T = k, a = u.
Comparing the Scilab function to what I formulated.

The numerical integration solution and the average value integral solution correlate.

Average via direct integral 99.9955 via numerical integration 100.0455

Scilab comparison.

For using 10 standard deviations in my solution as the peak value, average, median, and cumulative attribution correlate. The standard deviations do not. The problem is a small difference in the distribution between my model and the Scilab function . One curve is a little flatter in the region of the mean value, so the standard deviations are different with Scilab being correct. There is probably a model that is used to ensure the mean and standard deviation are equal. Probably on the net.

Renegades of the mean value, the standard deactivation of my model is always 2x high.

Mine mean 100.0455 std 200.1023
Scilab mean 99.9648 std 99.3087
peaks Scilab 920.8301 Mine 1000.0000
median actual Mine 69.3000 Scilab r 69.3000 calculated 69.3147


Code:
function [cumd,med] = cum_med(y,x)
    n = length(y)
    cum_sum = 0
    y_sum = 0
    flag = 0
    med = 0
    for i = 1:n cum_sum = cum_sum + y(i);end;
    for i = 1:n
        y_sum = y_sum + y(i)
        cumd(i) = 100. * y_sum/cum_sum
        if(flag == 0 && cumd(i) >= 50.) then
            flag = 1
            med = x(i)
            end
     end
endfunction

function [a,std] = mean_std(y)
    n = length(y)
    a = 0
    for i = 1:n a = a + y(i);end;
    a = a /n
    s = 0
    for i = 1:n s = s + (100. - y(i))^2;end;
    std = sqrt(s/n)
endfunction

u = 100.
T = 10. *u // inregration period
k = 10*u // peak value
ai = (-k*u)*(%e^(-T/u) - 1.)/T

n = 10000
dt = T/n
s = 0.
tsum = 0
for i = 1:n
    t(i) = tsum
    tsum = tsum + dt
    y(i) = k*%e^(-t(i)/u)
    s = s + y(i) 
end
an = s/n

[cd,med] = cum_med(y,t)
mprintf(" Average integral  %.4f  numerical  %.4f\n",ai,an)
[ay,stdy] = mean_std(y)
mprintf(" mean %.4f  std  %.4f\n",ay,stdy)
r = grand(n,1,"exp",u)
[cdr,medr] = cum_med(y,t)
[asci,stdsci] = mean_std(r)
mprintf(" mean %.4f  std  %.4f\n",asci,stdsci)
mprintf("peaks  %.4f   %.4f\n",max(r),max(y))
mprintf("median actual  %.4f  r  %.4f  calculated  %.4f\n",med,medr,log(2)*u)

r = gsort(r,"g","d")
w1 = scf(1)
clf(w1)
subplot(1,2,1)
plot2d(cd)
plot2d(cdr)
xgrid
subplot(1,2,2)
plot2d(y)
plot2d(r)
xgrid
 
Back
Top Bottom