Skip to main content
gamedev.net
🔒 Locked

Torture Function

Started by kSquared 18 replies 3.9k views
Original Post
kSquared
kSquared
I have discovered that my Internet service provider, Adelphia, implements the Torture Function. Given a file of size L that is being downloaded over your Internet connection and a time-to-go T, the Torture Function f(t) is the value of your download speed such that your time-to-go remains constant at T at an elapsed time t. The corresponding Torture Theorem states that the probability that the Torture Function will kick in goes to one as T goes to zero. Screw you, Adelphia. That is all.
- k2 "Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ<
Salsa
Salsa
There's a really fantastic bar nearby called Adelphia's. Sorry that you got the shaft.
Kult House - Fresh Production Media
Pouya
Pouya
Not to be too picky, but it should bt either a function of L, T, and t, or a function fixed on those two: FL,T(t)
nagromo
nagromo
Quote:
Original post by AnonymousPosterChild
Huh?


He's saying that you can't have a single function f(t) that will work for any value of T and L. If you try to write f, you will determine the download speed in terms of t, T, and L.

I think the elapsed time t should be measured from the point where the torture function kicked in, and the size L should be the size remaining when the torture function kicked in.

To find the torture function, you could solve this equation:



I'm no expert at solving this sort of thing, but it looks pretty ugly.

[Edited by - nagromo on October 1, 2006 10:36:22 PM]
Endar
Endar
I don't know anywhere else where a group of people can start having a conversation about how somebody's ISP sucks, and logically transition to solving mathematical equations.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
nagromo
nagromo
Quote:
Original post by Endar
I don't know anywhere else where a group of people can start having a conversation about how somebody's ISP sucks, and logically transition to solving mathematical equations.


To be fair, he did describe the mathematical function involved in the OP.

Also, it turns out this actually isn't too tough to solve; I'll post the answer once I finish it. I'm guessing the download speed will be an exponential function of -t.
Dmytry
Dmytry
It's actually quite simple to find torture function, no need to do integrals, only differentials. And it isn't exponential, too.

Note: the elapsed time is calculated differently in different browsers/downloaders/etc. because the current download speed is estimated differently. Some browsers use average download speed since beginning. Some use average download speed over past few seconds.

I'll assume it is using average download speed since beginning, like firefox browser seems to do. Then time to go T is then calculated as follows:

T = (L-l(t)) / (l(t)/t) = (L-l(t))*t / l(t) = (L/l(t)-1)*t

Where: l(t) is downloaded length, t is elapsed time, l(t)/t is average download speed so far, L is file size.

(note: functions will depend to T and L of course)

Let's find function l(t) so that T stays constant.
T = (L/l(t)-1)*t
T/t = L/l(t)-1
l(t) = L/(T/t + 1)
So we have found l(t) that ensures constant speed.

The relationship of l and f is:
f(t) = d l(t)/dt

Differentiating (i'll write D(lalala) to denote differential)
D(L/(T/t + 1)) = L*D((T/t + 1)^-1) = L*D(T/t + 1) * -(T/t + 1)^(-2) = L * T * t^(-2) * (T/t + 1)^(-2)

so the torture function is
f(t) = L * T * t-2 * (T/t + 1)-2
simplifying
f(t) = L * T / (T + t)2
ChurchSkiz
ChurchSkiz
Quote:
Original post by Dmytry
...............stuff.................
simplifying
f(t) = L * T / (T + t)2


That proof also provides the answer to your lack of female companionship.

I call it the "Kiss Vagina Goodbye" Theorem.

Dmytry
Dmytry
Quote:
Original post by ChurchSkiz
Quote:
Original post by Dmytry
...............stuff.................
simplifying
f(t) = L * T / (T + t)2


That proof also provides the answer to your lack of female companionship.

I call it the "Kiss Vagina Goodbye" Theorem.

eh?
Guess what, most mathematicians (and physicists) had/have wifes and children. Possible moreso in average than normal internet users.

(edit: on second thought, are you confusing me with certain other gdnet member by chance? forgot his name, notable for lack-of-relationship?)
JBourrie
JBourrie
Quote:
Guess what, most mathematicians (and physicists) had/have wifes and children. Possible moreso in average than normal internet users.

Keep your kids off of the internet. Studies have shown that 95% of sexual predators regularly spend time on the internet. (There is a sarcastic comment hidden under about three layers of sarcasm in that statement, but I swear that somewhere in there it is a reply to the quoted text. I think...)

Quote:
(edit: on second thought, are you confusing me with certain other gdnet member by chance? forgot his name, notable for lack-of-relationship?)

Emodest God?
Dmytry
Dmytry
JBourrie:
lol (about children&internet).

...
If i was confused with c modest god, that's just way too funny... but i do wonder why. Names don't look even remotely similar. I don't think i ever seen him doing any math problems there or anything else complicated for this matter. I vaguely recall him bragging about his iq or something, tho.
nagromo
nagromo
Quote:
Original post by Dmytry
...

(edit: on second thought, are you confusing me with certain other gdnet member by chance? forgot his name, notable for lack-of-relationship?)


Do you mean Coldacid? He had a comic made about him.

Quote:
Original post by Dmytry
It's actually quite simple to find torture function, no need to do integrals, only differentials. And it isn't exponential, too.

Note: the elapsed time is calculated differently in different browsers/downloaders/etc. because the current download speed is estimated differently. Some browsers use average download speed since beginning. Some use average download speed over past few seconds.

I'll assume it is using average download speed since beginning, like firefox browser seems to do. Then time to go T is then calculated as follows:

...


My way actually doesn't require any actual solving of integrals, either. It's actually pretty simple, and it does come out as an exponential.

You just define a function g(t) as the anti-derivative of f(t), define an integrating factor sigma = e^(t/T), solve the (now easy) differential for g(t), and take the derivative to get f(t).



With either method, it takes infinite time to download the entire file (integral of f(t) from 0 to infinity is L), so each of ours is correct, depending on how the browser calculates the time remaining.

My way assumes the browser calculates time left as the size left divided by the current instantaneous download speed, though, which doesn't make as much sense as your assumption of the total amount downloaded divided by the time taken.
Dmytry
Dmytry
Quote:
Original post by nagromo
Quote:
Original post by Dmytry
It's actually quite simple to find torture function, no need to do integrals, only differentials. And it isn't exponential, too.

Note: the elapsed time is calculated differently in different browsers/downloaders/etc. because the current download speed is estimated differently. Some browsers use average download speed since beginning. Some use average download speed over past few seconds.

I'll assume it is using average download speed since beginning, like firefox browser seems to do. Then time to go T is then calculated as follows:

...


My way actually doesn't require any actual solving of integrals, either. It's actually pretty simple, and it does come out as an exponential.

You just define a function g(t) as the anti-derivative of f(t), define an integrating factor sigma = e^(t/T), solve the (now easy) differential for g(t), and take the derivative to get f(t).



With either method, it takes infinite time to download the entire file (integral of f(t) from 0 to infinity is L), so each of ours is correct, depending on how the browser calculates the time remaining.

My way assumes the browser calculates time left as the size left divided by the current instantaneous download speed, though, which doesn't make as much sense as your assumption of the total amount downloaded divided by the time taken.

nice.
BTW, for instaneous there's short more forum friendly way of writing the solution. Let r(t) is remaining bytes at time t [i'm deliberately avoiding integral sign when writing on forum]. Then download speed is -r'(t) and torture equation is
r(0)=L
r(t)/(-r'(t))=T
hence
r(t)=-T*r'(t)
, when derivative is proportional to value there's exponential and we get r(t)=L*exp(-t/T) and r'(T) = -(1/T)*L*exp(-t/T)
giving download speed (L/T)*exp(-t/T) same as your.
JBourrie
JBourrie
Quote:
Original post by Dmytry
JBourrie:
lol (about children&internet).

Sadly enough, I quoted that directly from a commercial I saw on TV about two years ago.

In the United States, smoking is the leading cause of statistics.
Dmytry
Dmytry
Quote:
Original post by JBourrie
Quote:
Original post by Dmytry
JBourrie:
lol (about children&internet).

Sadly enough, I quoted that directly from a commercial I saw on TV about two years ago.

In the United States, smoking is the leading cause of statistics.

that really begs for
But in Soviet Russia statistics is the leading cause of alcoholism.
edit: btw i'm still waiting for reply from ChurchSkiz on "eh?".
ChurchSkiz
ChurchSkiz
Quote:
Original post by Dmytry
Quote:
Original post by JBourrie
Quote:
Original post by Dmytry
JBourrie:
lol (about children&internet).

Sadly enough, I quoted that directly from a commercial I saw on TV about two years ago.

In the United States, smoking is the leading cause of statistics.

that really begs for
But in Soviet Russia statistics is the leading cause of alcoholism.
edit: btw i'm still waiting for reply from ChurchSkiz on "eh?".


I take it back, you are the ladies' man.
Fruny
Fruny
I myself have a quasi-religious belief in the existence of the Microsoft Second™ as the unit in which "remaining time" is expressed for lengthy operations. Its connection with the commonly understood second is tenuous at best and might be part of some nefarious Embrace, Extend and Extinguish strategy on their part, possibly related to time machines... where is John Titor when you need him.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Dmytry
Dmytry
ChurchSkiz: lol.
No, i'm just curious as if you confused me with somebody or if i just appear so over internet or what...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.