Limits and While Loops
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Question: Consider the following program. Does $f(1)=0$?
beginalign*
f(i):=&|textwhile frac1i>0\
&||ileftarrow i+1\
&|i
endalign*
I would say that $f(1)=0$ is a true statement. The program does not terminate, but one could consider the sequence of points $x_i_iin mathbbN$ given by $x_i:=frac1i$, so that $x_i_iin mathbbN$ converges to the limit $0$ which makes $underbracefrac1i_=0>0$ false which means $f(1)=0$. However, I could be wrong.
limits programming
add a comment |Â
up vote
1
down vote
favorite
Question: Consider the following program. Does $f(1)=0$?
beginalign*
f(i):=&|textwhile frac1i>0\
&||ileftarrow i+1\
&|i
endalign*
I would say that $f(1)=0$ is a true statement. The program does not terminate, but one could consider the sequence of points $x_i_iin mathbbN$ given by $x_i:=frac1i$, so that $x_i_iin mathbbN$ converges to the limit $0$ which makes $underbracefrac1i_=0>0$ false which means $f(1)=0$. However, I could be wrong.
limits programming
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
1
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Question: Consider the following program. Does $f(1)=0$?
beginalign*
f(i):=&|textwhile frac1i>0\
&||ileftarrow i+1\
&|i
endalign*
I would say that $f(1)=0$ is a true statement. The program does not terminate, but one could consider the sequence of points $x_i_iin mathbbN$ given by $x_i:=frac1i$, so that $x_i_iin mathbbN$ converges to the limit $0$ which makes $underbracefrac1i_=0>0$ false which means $f(1)=0$. However, I could be wrong.
limits programming
Question: Consider the following program. Does $f(1)=0$?
beginalign*
f(i):=&|textwhile frac1i>0\
&||ileftarrow i+1\
&|i
endalign*
I would say that $f(1)=0$ is a true statement. The program does not terminate, but one could consider the sequence of points $x_i_iin mathbbN$ given by $x_i:=frac1i$, so that $x_i_iin mathbbN$ converges to the limit $0$ which makes $underbracefrac1i_=0>0$ false which means $f(1)=0$. However, I could be wrong.
limits programming
limits programming
edited 24 mins ago
lioness99a
3,6382527
3,6382527
asked 33 mins ago
W. G.
5131416
5131416
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
1
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago
add a comment |Â
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
1
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
1
1
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
2
down vote
The only thing we can say here is that $f(1)$ is not defined, or that the program does not terminate for the input $1$.
We cannot say that $f(1)=0$.
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
add a comment |Â
up vote
1
down vote
It's a bit of a funny question. Looks like the best answer is "no." The number $1$ is not in the domain of $f$, because the program doesn't terminate.
It's true that as a human we can see that the in-memory value of $1/i$ is headed toward $0$, but $f$ was never going to return $1/i$, it was going to return $i$, which is headed off to $infty$. Even if it were going to return $1/i$, the answer still shouldn't be $0$, because the program doesn't terminate and there's no notion of a limiting operation made explicit here.
add a comment |Â
up vote
0
down vote
The function is undefined at $i=1$ since $not exists b$ such that $b=f(1)$.
For a fromal proof, indicating with $i_k$ the value assumed by $i$ at the $k^th$ loop, we can show by induction that $forall k$
- $i_kge 1 implies frac 1i_k>0$
therefore the loop will never end.
More in general $f(i)$ is undefined for any $i>0$ and $f(i)=i$ for any $i< 0$.
For $i=0$ it depends on how the "while" command returns to the operation $1/0$.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
The only thing we can say here is that $f(1)$ is not defined, or that the program does not terminate for the input $1$.
We cannot say that $f(1)=0$.
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
add a comment |Â
up vote
2
down vote
The only thing we can say here is that $f(1)$ is not defined, or that the program does not terminate for the input $1$.
We cannot say that $f(1)=0$.
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
The only thing we can say here is that $f(1)$ is not defined, or that the program does not terminate for the input $1$.
We cannot say that $f(1)=0$.
The only thing we can say here is that $f(1)$ is not defined, or that the program does not terminate for the input $1$.
We cannot say that $f(1)=0$.
answered 27 mins ago
5xum
83.4k384148
83.4k384148
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
add a comment |Â
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
If I understand this correctly, the term "total correctness" of the program requires the program to terminate which is often considered in proofs. However, why is that $f(1)$ is not defined in the mathematical sense? Is it required to finite?
– W. G.
16 mins ago
1
1
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
@W.G. $f(1)$ is not defined because $f$ does not terminate for the input $1$. It's as simple as that.
– 5xum
11 mins ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
I am not trying to rock the boat here or anything, but I agree that the program does not terminate. Any computer would say that $f(1)$ makes no sense . However, we know that the loop continues on forever. Every iteration, can be proved inductively to show that $frac1i$ is false. Thus, the loop must go on forever. If the loop was finite, the program clearly would not exist as $frac1i>0$ would be false. As the loop goes on to infinity, why can't we assume $i$ goes to infinity?
– W. G.
40 secs ago
add a comment |Â
up vote
1
down vote
It's a bit of a funny question. Looks like the best answer is "no." The number $1$ is not in the domain of $f$, because the program doesn't terminate.
It's true that as a human we can see that the in-memory value of $1/i$ is headed toward $0$, but $f$ was never going to return $1/i$, it was going to return $i$, which is headed off to $infty$. Even if it were going to return $1/i$, the answer still shouldn't be $0$, because the program doesn't terminate and there's no notion of a limiting operation made explicit here.
add a comment |Â
up vote
1
down vote
It's a bit of a funny question. Looks like the best answer is "no." The number $1$ is not in the domain of $f$, because the program doesn't terminate.
It's true that as a human we can see that the in-memory value of $1/i$ is headed toward $0$, but $f$ was never going to return $1/i$, it was going to return $i$, which is headed off to $infty$. Even if it were going to return $1/i$, the answer still shouldn't be $0$, because the program doesn't terminate and there's no notion of a limiting operation made explicit here.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
It's a bit of a funny question. Looks like the best answer is "no." The number $1$ is not in the domain of $f$, because the program doesn't terminate.
It's true that as a human we can see that the in-memory value of $1/i$ is headed toward $0$, but $f$ was never going to return $1/i$, it was going to return $i$, which is headed off to $infty$. Even if it were going to return $1/i$, the answer still shouldn't be $0$, because the program doesn't terminate and there's no notion of a limiting operation made explicit here.
It's a bit of a funny question. Looks like the best answer is "no." The number $1$ is not in the domain of $f$, because the program doesn't terminate.
It's true that as a human we can see that the in-memory value of $1/i$ is headed toward $0$, but $f$ was never going to return $1/i$, it was going to return $i$, which is headed off to $infty$. Even if it were going to return $1/i$, the answer still shouldn't be $0$, because the program doesn't terminate and there's no notion of a limiting operation made explicit here.
answered 27 mins ago
hunter
13.3k22337
13.3k22337
add a comment |Â
add a comment |Â
up vote
0
down vote
The function is undefined at $i=1$ since $not exists b$ such that $b=f(1)$.
For a fromal proof, indicating with $i_k$ the value assumed by $i$ at the $k^th$ loop, we can show by induction that $forall k$
- $i_kge 1 implies frac 1i_k>0$
therefore the loop will never end.
More in general $f(i)$ is undefined for any $i>0$ and $f(i)=i$ for any $i< 0$.
For $i=0$ it depends on how the "while" command returns to the operation $1/0$.
add a comment |Â
up vote
0
down vote
The function is undefined at $i=1$ since $not exists b$ such that $b=f(1)$.
For a fromal proof, indicating with $i_k$ the value assumed by $i$ at the $k^th$ loop, we can show by induction that $forall k$
- $i_kge 1 implies frac 1i_k>0$
therefore the loop will never end.
More in general $f(i)$ is undefined for any $i>0$ and $f(i)=i$ for any $i< 0$.
For $i=0$ it depends on how the "while" command returns to the operation $1/0$.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The function is undefined at $i=1$ since $not exists b$ such that $b=f(1)$.
For a fromal proof, indicating with $i_k$ the value assumed by $i$ at the $k^th$ loop, we can show by induction that $forall k$
- $i_kge 1 implies frac 1i_k>0$
therefore the loop will never end.
More in general $f(i)$ is undefined for any $i>0$ and $f(i)=i$ for any $i< 0$.
For $i=0$ it depends on how the "while" command returns to the operation $1/0$.
The function is undefined at $i=1$ since $not exists b$ such that $b=f(1)$.
For a fromal proof, indicating with $i_k$ the value assumed by $i$ at the $k^th$ loop, we can show by induction that $forall k$
- $i_kge 1 implies frac 1i_k>0$
therefore the loop will never end.
More in general $f(i)$ is undefined for any $i>0$ and $f(i)=i$ for any $i< 0$.
For $i=0$ it depends on how the "while" command returns to the operation $1/0$.
edited 10 mins ago
answered 22 mins ago
gimusi
74.7k73889
74.7k73889
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2928866%2flimits-and-while-loops%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
The line $||ileftarrow i+1$ add 1 to the original variable $i$?
– gimusi
27 mins ago
1
Yes, that is exactly what that means. So, $frac11>0$ is true in the beginning so then we add $1$ to $i$ which looking at the precondition we know $frac12>0$ is true. This loop continues over and over until the statement is false.
– W. G.
24 mins ago