Dataset Viewer
Auto-converted to Parquet Duplicate
url
string
fetch_time
int64
content_mime_type
string
warc_filename
string
warc_record_offset
int32
warc_record_length
int32
text
string
token_count
int32
char_count
int32
metadata
string
score
float64
int_score
int64
crawl
string
snapshot_type
string
language
string
language_score
float64
prefix
string
target
string
https://math.stackexchange.com/questions/1834472/approximate-greatest-common-divisor
1,708,939,357,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00250.warc.gz
387,870,564
37,416
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal. This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate. With a perfect signal I would have gcd(400, 700, 100, 900, 400, 100, 400) = 100 • What is the average gcd? 397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it. Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers? In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$. Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial. Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval. Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well. This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd. Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer. It is guaranteed that one $$d_{a,b}$$ is equal to $$p$$. Thus, to check which one is the correct one, just compute the "centered modular reduction" $$r_i' := x_i \bmod d_{a,b} \in [-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$ for $$i \ge 3$$. If $$d_{a,b} = p$$, then each $$r_i'$$ equals $$r_i$$, therefore, all the values $$r_i'$$ that you get are small (e.g., smaller than 50). Otherwise, the values $$r_i'$$ will look randomly distributed in $$[-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$.
1,424
4,823
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-10
latest
en
0.89591
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal.
This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate.
https://math.stackexchange.com/questions/1834472/approximate-greatest-common-divisor
1,708,939,357,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00250.warc.gz
387,870,564
37,416
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal. This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate. With a perfect signal I would have gcd(400, 700, 100, 900, 400, 100, 400) = 100 • What is the average gcd? 397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it. Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers? In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$. Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial. Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval. Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well. This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd. Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer. It is guaranteed that one $$d_{a,b}$$ is equal to $$p$$. Thus, to check which one is the correct one, just compute the "centered modular reduction" $$r_i' := x_i \bmod d_{a,b} \in [-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$ for $$i \ge 3$$. If $$d_{a,b} = p$$, then each $$r_i'$$ equals $$r_i$$, therefore, all the values $$r_i'$$ that you get are small (e.g., smaller than 50). Otherwise, the values $$r_i'$$ will look randomly distributed in $$[-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$.
1,424
4,823
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-10
latest
en
0.89591
397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it.
Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers?
https://math.stackexchange.com/questions/1834472/approximate-greatest-common-divisor
1,708,939,357,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00250.warc.gz
387,870,564
37,416
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal. This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate. With a perfect signal I would have gcd(400, 700, 100, 900, 400, 100, 400) = 100 • What is the average gcd? 397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it. Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers? In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$. Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial. Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval. Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well. This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd. Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer. It is guaranteed that one $$d_{a,b}$$ is equal to $$p$$. Thus, to check which one is the correct one, just compute the "centered modular reduction" $$r_i' := x_i \bmod d_{a,b} \in [-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$ for $$i \ge 3$$. If $$d_{a,b} = p$$, then each $$r_i'$$ equals $$r_i$$, therefore, all the values $$r_i'$$ that you get are small (e.g., smaller than 50). Otherwise, the values $$r_i'$$ will look randomly distributed in $$[-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$.
1,424
4,823
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-10
latest
en
0.89591
In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$.
Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial.
https://math.stackexchange.com/questions/1834472/approximate-greatest-common-divisor
1,708,939,357,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00250.warc.gz
387,870,564
37,416
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal. This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate. With a perfect signal I would have gcd(400, 700, 100, 900, 400, 100, 400) = 100 • What is the average gcd? 397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it. Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers? In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$. Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial. Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval. Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well. This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd. Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer. It is guaranteed that one $$d_{a,b}$$ is equal to $$p$$. Thus, to check which one is the correct one, just compute the "centered modular reduction" $$r_i' := x_i \bmod d_{a,b} \in [-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$ for $$i \ge 3$$. If $$d_{a,b} = p$$, then each $$r_i'$$ equals $$r_i$$, therefore, all the values $$r_i'$$ that you get are small (e.g., smaller than 50). Otherwise, the values $$r_i'$$ will look randomly distributed in $$[-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$.
1,424
4,823
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-10
latest
en
0.89591
Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval.
Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well.
https://math.stackexchange.com/questions/1834472/approximate-greatest-common-divisor
1,708,939,357,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947474653.81/warc/CC-MAIN-20240226062606-20240226092606-00250.warc.gz
387,870,564
37,416
# approximate greatest common divisor I try, without success, to create an algorithm that can compute the average greatest common divisor of a series of integers. For example, I have the following numbers: 399, 710, 105, 891, 402, 102, 397, ... As you can see, the average gcd is approximately 100, but how to compute it ? more details: I try to find the carrier signal length of a HF signal. This signal is an alternation of high levels and low levels. eg. ----__------____------__-- ... I have the duration of each level, but this time is not accurate. My aim is to find as quick as possible the base time of the signal. My first idea was to compute the gcd of the first times I get, to find the carrier of the signal. But I cannot use the classical gcd because the values are not very accurate. With a perfect signal I would have gcd(400, 700, 100, 900, 400, 100, 400) = 100 • What is the average gcd? 397 is a prime, so its gcd with any of the other numbers in the series is 1. Jun 21, 2016 at 13:24 • Does computing all gcds then taking the average not work..? Jun 21, 2016 at 13:25 • @MattSamuel, all gcds give very low values, eg. (399, 710) => 1, etc..., then the average will be far of the expected value Jun 21, 2016 at 13:28 • @Soubok: No matter which word you use, it looks like you will have to describe what it is you want, with greater detail and specificity than just choosing a word to use for it. Jun 21, 2016 at 13:46 • Try to reformulate then, it might be an interesting problem. You'll need some kind of norm or measure, like the maximum of $\gcd(a_1+e_1,\dots,a_n+e_n)$ where $e_1+\cdots e_n<N$... – Lehs Jun 21, 2016 at 14:25 I made a similar question here, where I propose a partial solution. How to find the approximate basic frequency or GCD of a list of numbers? In summary, I came with this • being $v$ the list $\{v_1, v_2, \ldots, v_n\}$, • $\operatorname{mean}_{\sin}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\sin(2\pi v_i/x)$ • $\operatorname{mean}_{\cos}(v, x)$ $= \frac{1}{n}\sum_{i=1}^n\cos(2\pi v_i/x)$ • $\operatorname{gcd}_{appeal}(v, x)$ = $1 - \frac{1}{2}\sqrt{\operatorname{mean}_{\sin}(v, x)^2 + (\operatorname{mean}_{\cos}(v, x) - 1)^2}$ And the goal is to find the $x$ which maximizes the $\operatorname{gcd}_{appeal}$. Using the formulas and code described there, using CoCalc/Sage you can experiment with them and, in the case of your example, find that the optimum GCD is ~100.18867794375123: testSeq = [399, 710, 105, 891, 402, 102, 397] gcd = calculateGCDAppeal(x, testSeq) find_local_maximum(gcd,90,110) plot(gcd,(x, 10, 200), scale = "semilogx") One approach: take the minimum of all your numbers, here $102$ as the first trial. Divide it into all your other numbers, choosing the quotient that gives the remainder of smallest absolute value. For your example, this would give $-9,2,3,-27,-6,0,-11$ The fact that your remainders are generally negative says your divisor is too large, so try a number a little smaller. Keep going until the remainders get positive and larger. Depending on how the errors accumulate, you might also add up all the numbers and assume the sum is a multiple of the minimum interval. Here your numbers add to $3006$, so you might think this is $30$ periods of $100.2$ Are your periods constrained to integers? If you have a stubbornly large remainder, you can think that the smallest number is not one interval but two. You might have a number around $150$, so the fundamental period is $50$, not $100$. The challenge will be that if $100$ fits, any factor will fit as well. This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd. Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer. It is guaranteed that one $$d_{a,b}$$ is equal to $$p$$. Thus, to check which one is the correct one, just compute the "centered modular reduction" $$r_i' := x_i \bmod d_{a,b} \in [-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$ for $$i \ge 3$$. If $$d_{a,b} = p$$, then each $$r_i'$$ equals $$r_i$$, therefore, all the values $$r_i'$$ that you get are small (e.g., smaller than 50). Otherwise, the values $$r_i'$$ will look randomly distributed in $$[-d_{a,b}/2,~ d_{a,b}/2]\cap\mathbb{Z}$$.
1,424
4,823
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-10
latest
en
0.89591
This problem is actually not new. It is usually called the ACD problem (approximate common divisor problem) or the AGCD problem (approximate greatest common divisor) and there exist several algorithms to solve it. Although no algorithm is efficient in general, in your case, since the integers are tiny, you can simply try to eliminate the noise and compute the gcd.
Namely, you want to recover $$p$$ given many values of the form $$x_i = pq_i + r_i$$ where $$|r_i|$$ is very small, say, smaller than $$50$$. Then, you can take two of those values, say, $$x_1$$ and $$x_2$$, and compute $$d_{a, b} = \gcd(x_1 - a, x_2 - b)$$ for all $$a, b \in [-50, 50]\cap\mathbb{Z}$$. Notice that this step costs only $$50^2$$ gcds computations, which is very cheap for any computer.
https://math.stackexchange.com/questions/4591726/fracab4-fracbc4-fraccd4-fracde4-fracea4
1,721,677,653,000,000,000
text/html
crawl-data/CC-MAIN-2024-30/segments/1720763517915.15/warc/CC-MAIN-20240722190551-20240722220551-00176.warc.gz
318,427,534
37,511
# $(\frac{a}{b})^4+(\frac{b}{c})^4+(\frac{c}{d})^4+(\frac{d}{e})^4+(\frac{e}{a})^4\ge\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{e}{d}+\frac{a}{e}$ How exactly do I solve this problem? (Source: 1984 British Math Olympiad #3 part II) $$\begin{equation*} \bigl(\frac{a}{b}\bigr)^4 + \bigl(\frac{b}{c}\bigr)^4 + \bigl(\frac{c}{d}\bigr)^4 + \bigl(\frac{d}{e}\bigr)^4 + \bigl(\frac{e}{a}\bigr)^4 \ge \frac{b}{a} + \frac{c}{b} + \frac{d}{c} + \frac{e}{d} + \frac{a}{e} \end{equation*}$$ There's not really a clear-cut way to use AM-GM on this problem. I've been thinking of maybe using the Power Mean Inequality, but I don't exactly see a way to do that. Maybe we could use harmonic mean for the RHS? • someone please explain why this is closed. I think I have adequately explained some strategies that I've tried. I believe I've provided enough context. Commented Dec 10, 2022 at 19:54 • I'm kinda new around here, but I was also surprised to see it closed. Also I found the accepted solution to be very nice. Commented Dec 10, 2022 at 21:48 Applying the AM-GM $$LHS - \bigl(\frac{e}{a}\bigr)^4 = \bigl(\frac{a}{b}\bigr)^4 + \bigl(\frac{b}{c}\bigr)^4 + \bigl(\frac{c}{d}\bigr)^4 + \bigl(\frac{d}{e}\bigr)^4 \ge4 \cdot \frac{a}{b} \cdot \frac{b}{c} \cdot \frac{c}{d} \cdot\frac{d}{e} = 4\cdot\frac{a}{e}$$ Do the same thing for these 4 others terms, and make the sum $$5 LHS - LHS \ge 4 RHS$$ $$\Longleftrightarrow LHS \ge RHS$$ The equality occurs when $$a=b=c=d=e$$ • I think in the end you should have $5LHS-LHS\geq 4RHS$, since you repeat the procedure 5 times, not 4. Then everything works. :) Commented Dec 5, 2022 at 9:33 • @Freshman'sDream You're right, I just corrected this typo. Thanks! – NN2 Commented Dec 5, 2022 at 9:34 • ohhhhh ok thanks! Commented Dec 9, 2022 at 23:08 NN2 gave a simple and very elegamt proof. I tried another way. What is the minumum of the function $$f(x_1,x_2,x_3,x_4,x_5)=\sum_{i=1}^{5}(x_i^4-x_i^{-1})$$ with domain $$\Bbb{R}^{5+}$$, subject to the constraint equation $$x_1x_2x_3x_4x_5=1$$? The system of a Lagrange multplier $$\lambda$$ gives the equations $$4x_i^3+x_i^{-2}=\lambda x_i^{-1}$$ for all $$i=1,2,3,4,5$$. From these equations we have $$4x_ix_j(x_i^4-x_j^4)=x_i-x_j$$ for all $$i,j.$$ I am stuck. Any ideas?
874
2,261
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 13, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.90625
4
CC-MAIN-2024-30
latest
en
0.820644
(Source: 1984 British Math Olympiad #3 part II) $$\begin{equation*} \bigl(\frac{a}{b}\bigr)^4 + \bigl(\frac{b}{c}\bigr)^4 + \bigl(\frac{c}{d}\bigr)^4 + \bigl(\frac{d}{e}\bigr)^4 + \bigl(\frac{e}{a}\bigr)^4 \ge \frac{b}{a} + \frac{c}{b} + \frac{d}{c} + \frac{e}{d} + \frac{a}{e} \end{equation*}$$ There's not really a clear-cut way to use AM-GM on this problem.
I've been thinking of maybe using the Power Mean Inequality, but I don't exactly see a way to do that. Maybe we could use harmonic mean for the RHS? • someone please explain why this is closed. I think I have adequately explained some strategies that I've tried. I believe I've provided enough context. Commented Dec 10, 2022 at 19:54 • I'm kinda new around here, but I was also surprised to see it closed.
https://math.stackexchange.com/questions/767888/math-for-future-value-of-growing-annuity
1,597,311,740,000,000,000
text/html
crawl-data/CC-MAIN-2020-34/segments/1596439738964.20/warc/CC-MAIN-20200813073451-20200813103451-00073.warc.gz
395,301,204
34,016
Math for Future Value of Growing Annuity Am I working this out correctly? I need to verify that my code is correct... $$1000 \cdot \left(\frac{(1 + 0.1 / 12)^{40 * 12} - (1 + 0.06 / 12)^{40 * 12}}{(0.1 / 12) - (0.06 / 12)}\right)$$ Something like this: 53.700663174244 - 10.957453671655 ( = 42.7432095026 ) / 0.0083333333333333 - 0.005 ( = 0.00333333333 ) * 1000 = 12822 962.8636 ps. could someone please help me with the tag selection * blush* EDIT: Sorry I know this is a mouthful, but if the math don't add up the code can't add up plus I'm actually a designer... not equal to programmer or mathematician. I'm a creative logician :) Below is part A which must be added (summed) to part B (original question). A: $$Future Value (FV) of Lumpsum = PV \cdot (1+i/12)^{b*12}$$ B: $$FV of Growing Annuity = R1 \cdot \left(\frac{(1 + i / 12)^{b * 12} - (1 + g / 12)^{b * 12}}{(i / 12) - (g / 12)}\right)$$ • Current savings for retirement (Rands) = PV • Rate of return = i/100 • Retirement age (years) – Current age (years) = b • Current monthly contribution towards retirement (Rands) = R1 • 6/100 (Annual Growth rate of annuities) = g This is all I have to offer except for the more complicated formula to work out the rest of "Savings for Retirement", but if my example B is correct then the B they gave me is wrong and it's driving me nuts because I'm also having trouble with: C: $$PV of an Growing Annuity = \left(\frac{R2 \cdot(1 + g / 12)^{b * 12}}{(i / 12) - (g / 12)}\right) \cdot \left(1- \left( \frac{(1 + g / 12)^{b * 12}}{(1 + i / 12)^{n * 12}}\right)\right)$$ • Rate of return = i/100 • Retirement age (years) – Current age (years) = b • 95 (Assumed age of death) - Retirement age (years) = n • Monthly income need at retirement (Rands) = R2 • 6/100 (Annual Growth rate of annuities) = g Which then must be: $$C-(A+B)$$ And finally, let me just give it all... D: $$FV of Growing Annuity = R3 \cdot \left(\frac{((1 + i / 12)^{b * 12} - (1 + g / 12)^{b * 12} )}{(i / 12) - (g / 12)}\right)$$ • Answer of C-(A + B) = FV of Growing Annuity • Rate of return = i/100 • Retirement age (years) – Current age (years) = b • 6/100 (Annual Growth rate of annuities) = g • You should state what problem you are trying to solve. It appears you are starting with a deposit of 1000 that draws some amount of interest for some time, but what the subtractions mean I can't guess. I think the first term is $10\%$ annual interest compounded monthly for 40 years. Then you should write it mathematically-we don't necessarily know what the arguments for Math.Pow are. – Ross Millikan Apr 24 '14 at 21:05 • To elaborate on what @RossMillikan meant, you gave a series of numbers and asked "Is this correct?" without specifying what those numbers mean and the goal of the calculation. For instance, $1000(1+0.1/12)^{40*12}$ gives your total money with an initial investment of \$1000, a rate of 10%, monthly compounding and 40 years of time. Why are you then subtracting the same calculation but with a 6% rate? Why are you dividing by the difference of these rates? We can't know if what you're doing is correct if we don't know what you're trying to do. – RandomUser Apr 24 '14 at 21:27
1,030
3,194
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.0625
4
CC-MAIN-2020-34
latest
en
0.778724
It appears you are starting with a deposit of 1000 that draws some amount of interest for some time, but what the subtractions mean I can't guess. I think the first term is $10\%$ annual interest compounded monthly for 40 years. Then you should write it mathematically-we don't necessarily know what the arguments for Math.Pow are. – Ross Millikan Apr 24 '14 at 21:05 • To elaborate on what @RossMillikan meant, you gave a series of numbers and asked "Is this correct?"
without specifying what those numbers mean and the goal of the calculation. For instance, $1000(1+0.1/12)^{40*12}$ gives your total money with an initial investment of \$1000, a rate of 10%, monthly compounding and 40 years of time. Why are you then subtracting the same calculation but with a 6% rate? Why are you dividing by the difference of these rates?
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving.
The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1.
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$.
The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$.
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$.
The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$.
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later.
We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d).
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance).
Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible.
https://math.stackexchange.com/questions/1921033/how-do-i-plot-a-field-of-view-in-2d-space-and-find-if-a-certain-point-lies-wit
1,558,754,853,000,000,000
text/html
crawl-data/CC-MAIN-2019-22/segments/1558232257847.56/warc/CC-MAIN-20190525024710-20190525050710-00467.warc.gz
566,787,162
35,780
# How do I plot a 'field of view' in 2D space and find if a certain point lies within the space? I am trying to model a robot arm (in 2D) that's supposed to have a camera at the end that moves with the arm. Given the field of view of the camera, I need to find whether a certain target is visible in this field of view as the endpoint of the arm starts moving. The horizontal of the camera is aligned with the last link of the robot arm, so the 'triangle' moves up and down, forwards and backwards etc. While this intuitively makes sense, I'm having trouble coming up with a formula for this. Also, as it's a camera field of view, the rays are technically infinitely long. The data I have are: (example image below) 1. Cartesian coordinates of the last two 'points' of the robot arm (x3, y3) and (x4, y4) 2. Theta angle of the field of view 3. Coordinates of the point of interest (this never changes) Any suggestions? Maybe something simple like this would work? Assume you have been able to compute your coordinates $P_3 = (x_3, y_3)$ and $P_4 = (x_4, y_4)$ and you know the position of the point you want to see with the camera $Q = (a, b)$. Form the vectors $\overrightarrow{P_3P_4} = (x_4 - x_3, \, y_4 - y_3)$ and $\overrightarrow{P_4Q} = (a - x_4, \, b - y_4)$. The dot product between the two vectors has the following meaning $$\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big) = \|\overrightarrow{P_3P_4}\| \, \|\overrightarrow{P_4Q} \| \cos{\theta} = \|P_4 - P_3\|\, \|Q - P_4\| \cos{\theta}$$ where $\theta$ is the angle between the oriented line $P_4Q$ and the oriented horizontal of the camera, which is defined by the line $P_3P_4$. If $\theta \in \left(-\frac{\pi}{6}, \frac{\pi}{6}\right)$ then your object is visible. In terms of cosine of the angle, this translates into the condition $\cos{\theta} \in \left(\frac{\sqrt{3}}{2}, 1\right)$. If $\cos{\theta}$ is not in the interval $\left(\frac{\sqrt{3}}{2}, 1\right)$, then your point is not visible. Form the above formula \begin{align}\cos{\theta} &= \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } = \frac{\Big(\, \overrightarrow{P_3P_4} \cdot \overrightarrow{P_4Q} \, \Big)}{\|P_4 - P_3\|\, \|Q - P_4\| } \end{align} so if we plug in the coordinates we obtain the expression \begin{align} \cos{\theta} = f(x_3,y_3,x_4,y_4,a,b) = \frac{ (x_4 - x_3)(a- x_4) + (y_4 - y_3)(b- y_4)}{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2} \,\,\, \sqrt{ (a- x_4)^2 + (b- y_4)^2}} \end{align} If $\,\, f(x_3,y_3,x_4,y_4,a,b) \,\in \, \left(\frac{\sqrt{3}}{2}, 1\right) \,\,$ then the point with coordinates $(a,b)$ is visible. Otherwise, it is not. Make sure I haven't made a mistake in the condition and the proper orientation of the angle. I have changed them three times already :) Comment: Regarding the bounds of $\cos{\theta}$, I will try to explain this as follows. The camera horizontal is the directed line $P_3P_4$, directed from $P_3$ to $P_4$. Since the directed line $P_4Q$, oriented from $P_4$ to $Q$, determines of the angle of the point $Q$ with respect to the camera horizontal $P_3P_4$, by definition the visibility occurs when the angle $\theta$ between $P_3P_4$ and $P_4Q$ (measured counterclockwise from $P_4Q$ to $P_3P_4$) changes from $-30^{\circ}$ to $30^{\circ}$. The cosine $\cos{\theta}$ is related to the orthogonal projection of $P_4Q$ onto the directed horizontal $P_3P_4$. Let us rotate $P_4Q$ around $P_4$ and see how $\theta$ changes. At first when $\theta = -30^{\circ}$ then $\cos{(-30^{\circ})} = \sqrt{3}/2$. As the direction $P_4Q$ gets more and more aligned with $P_3P_4$, the angle $\theta$ grows from $-30^{\circ}$ to $0$ and thus the cosine grows from $\sqrt{3}/2$ to $1$. After the alignment, when $\theta=0$ and $\cos{0} = 1$, the cosine $\cos{\theta}$ starts to decrease (while the angle $\theta$ keeps growing from $0$ to $30^{\circ}$) until the direction $P_4Q$ reaches $30^{\circ}$ with $P_3P_4$ and the cosine becomes $\cos{\theta} = \sqrt{3}/2$ again. • Thanks for the detailed explanation! That approach worked. – HighVoltage Sep 10 '16 at 6:12 Here’s an approach that anticipates doing more with the camera view later. We’ll be working in two dimensions, but the same technique applies in three. We will assume that the camera view is a perspective projection as illustrated here: This will necessitate working in homogeneous coordinates. The first thing to do is to switch to the camera’s coordinate system. The origin of this coordinate system is at the camera’s position and by convention, the camera sights along the negative $y'$ direction (negative $z'$ in 3-d). The world to camera transformation is thus a translation to the camera’s position followed by a rotation. The matrix of this translation is easy to produce. It’s simply $$T=\pmatrix{1&0&-x_4\\0&1&-y_4\\0&0&1}.$$ For the angle $\phi$ that the camera’s line of sight makes with the world $x$-axis, we have $$\cos\phi = {x_4-x_3\over\|P_4-P_3\|}\\\sin\phi = {y_4-y_3\over\|P_4-P_3\|}.$$ To get aligned with the camera’s line of sight, we start by rotating clockwise through this angle, but we also need to rotate clockwise by an additional 90 degrees to get it to point down the camera’s negative $y'$-axis. Putting those two rotations together produces the rotation matrix $$R=\pmatrix{-\sin\phi&\cos\phi&0\\-\cos\phi&-\sin\phi&0\\0&0&1},$$ with $\cos\phi$ and $\sin\phi$ as above. Combining these two matrices, we have $$RT = \pmatrix{-\sin\phi&\cos\phi&x_4\sin\phi-y_4\cos\phi\\-\cos\phi&-\sin\phi&x_4\cos\phi+y_4\sin\phi\\0&0&1},$$ i.e., \begin{align}x'&=-(x-x_4)\sin\phi+(y-y_4)\cos\phi\\y'&=-(x-x_4)\cos\phi-(y-y_4)\sin\phi.\end{align} The line labeled “i” in the above diagram is the image plane, which is perpendicular to the camera’s line of sight and at a distance $f$ from the camera (the focal distance). Note that, since the camera is looking down the negative $y'$-axis, $f<0$. The perspective projection $M$ maps a point in the $x$-$y$ plane onto the intersection of the image plane with the ray emanating from the camera and passing through the point. If we take $f=-1$, then the bounds of the visible region in the image plane are $\pm\tan\theta$, so if the $x'$-coordinate of the projection of a point is in this range, then it’s visible. In the camera coordinate system, a projection matrix is very simple: $$P=\pmatrix{1&0&0\\0&1&0\\0&\frac1f&0}.$$ Putting this all together, given a point $Q=(x,y)$, we compute $$M(Q)=PRT\pmatrix{x\\y\\1}$$ and recover the projected $x'$-coordinate by dividing the first component of the resulting vector by the third. We can save ourselves a bit of work, though, by taking advantage of $P$’s simple form. Note that $$\pmatrix{1&0&0\\0&1&0\\0&-1&0}\pmatrix{x'\\y'\\1}=\pmatrix{x'\\y'\\-y'},$$ so we really only need to transform the target point into camera coordinates, after which we can just check that $-\tan\theta\le-x'/y'\le\tan\theta$. We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection. You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices. The rotation matrix will be a bit more complicated, but the translation will still be straightforward. Taking $f=-1$ again, the projection will result in $(x',y',z',-z')$. Assuming that the field of view is a circular cone, the test for visibility will then be $$x'^2+y'^2\le z'^2\tan^2\theta.$$ Postscript: This is, of course, overkill when the field of view is a right circular cone, whether in two dimensions or three. Checking that $(Q-P_4)\cdot(P_4-P_3)\ge\|Q-P_4\|\,\|P_4-P_3\|\cos\theta$ is much simpler and more efficient. However, the procedure that I’ve outlined here applies generally to any size and shape aperture, which becomes much more interesting when you move to three dimensions.
2,593
8,421
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 3, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2019-22
latest
en
0.861014
We might have $y'=0$, however, so let’s rewrite this as $|x'|\le|y'|\tan\theta$ to avoid dividing by zero. You might object that the projection also maps points behind the camera onto the image plane, but that’s easily dealt with: check the sign of the camera-relative $y'$-coordinate. If it’s positive, the point is behind the camera, so there’s no need to compute its projection.
You can eliminate the $y'=0$ case at the same time. If this seems backwards to you, you can always have the camera point in the positive $y'$ direction instead so that visible points have a positive $y'$-coordinate, but you’ll have to modify $R$ and $P$ accordingly. As I mentioned above, the same approach works in 3-d, except that you’ll be working with $4\times4$ matrices.
https://mathematica.stackexchange.com/questions/216293/phase-portrait-for-ode-with-ivp?noredirect=1
1,696,284,912,000,000,000
text/html
crawl-data/CC-MAIN-2023-40/segments/1695233511021.4/warc/CC-MAIN-20231002200740-20231002230740-00732.warc.gz
414,570,837
42,266
# Phase Portrait for ODE with IVP I'm trying to make a phase portrait for the ODE x'' + 16x = 0, with initial conditions x[0]=-1 & x'[0]=0. I know how to solve the ODE and find the integration constants; the solution comes out to be x(t) = -cos(4t) and x'(t) = 4sin(4t). But I don't know how to make a phase portrait out of it. I've looked at this link Plotting a Phase Portrait but I couldn't replicate mine based off of it. Phase portrait for any second order autonomous ODE can be found as follows. Convert the ODE to state space. This results in 2 first order ODE's. Then call StreamPlot with these 2 equations. Let the state variables be $$x_1=x,x_2=x'(t)$$, then taking derivatives w.r.t time gives $$x'{_1}=x_2,x'{_2}=x''(t)=-16 x_1$$. Now, using StreamPlot gives StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -2, 2}] To see the line that passes through the initial conditions $$x_1(0)=1,x_2(0)=0.1$$, add the option StreamPoints StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] To verify the above is the correct phase plot, you can do ClearAll[x, t] ode = x''[t] + 16 x[t] == 0; ic = {x[0] == 1, x'[0] == 1/10}; sol = x[t] /. First@(DSolve[{ode, ic}, x[t], t]); ParametricPlot[Evaluate[{sol, D[sol, t]}], {t, 0, 3}, PlotStyle -> Red] The advatage of phase plot, is that one does not have to solve the ODE first (so it works for nonlinear hard to solve ODE's). All what you have to do is convert the ODE to state space and use function like StreamPlot If you want to automate the part of converting the ODE to state space, you can also use Mathematica for that. Simply use StateSpaceModel and just read of the equations. eq = x''[t] + 16 x[t] == 0; ss = StateSpaceModel[{eq}, {{x[t], 0}, {x'[t], 0}}, {}, {x[t]}, t] The above shows the A matrix in $$x'=Ax$$. So first row reads $$x_1'(t)=x_2$$ and second row reads $$x'_2(t)=-16 x_1$$ The following can be done to automate plotting StreamPlot directly from the state space ss result A = First@Normal[ss]; vars = {x1, x2}; (*state space variables*) eqs = A . vars; StreamPlot[eqs, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] • Can you method plot y''[x]+2 y'[x]+3 y[x]==2 x? – yode Mar 27, 2022 at 8:59 • @yode Phase portrait are used for homogeneous ode's. Systems of the form $x'=A x$ and not $x'=A x + u$. Since it shows the behaviour of the system itself, independent of any forcing functions (the stuff on the RHS). This behavior is given by phase portrait diagram. The reason is, it is only the $A$ matrix eigenvalues and eigenvectors that determines this behaviour, and $A$ depends only on the system itself, without any external input being there. Mar 27, 2022 at 14:08 • Can we plot your ss in MMA directly? – yode Mar 29, 2022 at 10:59 • @yoda Yes. I've updated the above with what I think you are asking for. Hope this helps. Mar 29, 2022 at 15:23 EquationTrekker works for me, but if you are not interested in looking at a range of solutions, it might be easier to just do it with ParametricPlot x[t_] := -Cos[4 t] ParametricPlot[{x[t], x'[t]} // Evaluate, {t, 0, 2 π}, Axes -> False, PlotLabel -> PhaseTrajectory, Frame -> True, FrameLabel -> {x[t], x'[t]}, GridLines -> Automatic] • What version is this on, Bill? Someone in the QA that OP links to says EquationTrekker is broken for them on v11.0 Mar 15, 2020 at 6:04 • This plot is from ParametricPlot, not EquationTrekker, but in v12.0 EquationTrekker gives me plots, although I do get PropertyValue errors. Mar 15, 2020 at 7:40
1,140
3,557
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 6, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.65625
4
CC-MAIN-2023-40
longest
en
0.844324
But I don't know how to make a phase portrait out of it. I've looked at this link Plotting a Phase Portrait but I couldn't replicate mine based off of it. Phase portrait for any second order autonomous ODE can be found as follows. Convert the ODE to state space. This results in 2 first order ODE's. Then call StreamPlot with these 2 equations. Let the state variables be $$x_1=x,x_2=x'(t)$$, then taking derivatives w.r.t time gives $$x'{_1}=x_2,x'{_2}=x''(t)=-16 x_1$$.
Now, using StreamPlot gives StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -2, 2}] To see the line that passes through the initial conditions $$x_1(0)=1,x_2(0)=0.1$$, add the option StreamPoints StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] To verify the above is the correct phase plot, you can do ClearAll[x, t] ode = x''[t] + 16 x[t] == 0; ic = {x[0] == 1, x'[0] == 1/10}; sol = x[t] /.
https://mathematica.stackexchange.com/questions/216293/phase-portrait-for-ode-with-ivp?noredirect=1
1,696,284,912,000,000,000
text/html
crawl-data/CC-MAIN-2023-40/segments/1695233511021.4/warc/CC-MAIN-20231002200740-20231002230740-00732.warc.gz
414,570,837
42,266
# Phase Portrait for ODE with IVP I'm trying to make a phase portrait for the ODE x'' + 16x = 0, with initial conditions x[0]=-1 & x'[0]=0. I know how to solve the ODE and find the integration constants; the solution comes out to be x(t) = -cos(4t) and x'(t) = 4sin(4t). But I don't know how to make a phase portrait out of it. I've looked at this link Plotting a Phase Portrait but I couldn't replicate mine based off of it. Phase portrait for any second order autonomous ODE can be found as follows. Convert the ODE to state space. This results in 2 first order ODE's. Then call StreamPlot with these 2 equations. Let the state variables be $$x_1=x,x_2=x'(t)$$, then taking derivatives w.r.t time gives $$x'{_1}=x_2,x'{_2}=x''(t)=-16 x_1$$. Now, using StreamPlot gives StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -2, 2}] To see the line that passes through the initial conditions $$x_1(0)=1,x_2(0)=0.1$$, add the option StreamPoints StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] To verify the above is the correct phase plot, you can do ClearAll[x, t] ode = x''[t] + 16 x[t] == 0; ic = {x[0] == 1, x'[0] == 1/10}; sol = x[t] /. First@(DSolve[{ode, ic}, x[t], t]); ParametricPlot[Evaluate[{sol, D[sol, t]}], {t, 0, 3}, PlotStyle -> Red] The advatage of phase plot, is that one does not have to solve the ODE first (so it works for nonlinear hard to solve ODE's). All what you have to do is convert the ODE to state space and use function like StreamPlot If you want to automate the part of converting the ODE to state space, you can also use Mathematica for that. Simply use StateSpaceModel and just read of the equations. eq = x''[t] + 16 x[t] == 0; ss = StateSpaceModel[{eq}, {{x[t], 0}, {x'[t], 0}}, {}, {x[t]}, t] The above shows the A matrix in $$x'=Ax$$. So first row reads $$x_1'(t)=x_2$$ and second row reads $$x'_2(t)=-16 x_1$$ The following can be done to automate plotting StreamPlot directly from the state space ss result A = First@Normal[ss]; vars = {x1, x2}; (*state space variables*) eqs = A . vars; StreamPlot[eqs, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] • Can you method plot y''[x]+2 y'[x]+3 y[x]==2 x? – yode Mar 27, 2022 at 8:59 • @yode Phase portrait are used for homogeneous ode's. Systems of the form $x'=A x$ and not $x'=A x + u$. Since it shows the behaviour of the system itself, independent of any forcing functions (the stuff on the RHS). This behavior is given by phase portrait diagram. The reason is, it is only the $A$ matrix eigenvalues and eigenvectors that determines this behaviour, and $A$ depends only on the system itself, without any external input being there. Mar 27, 2022 at 14:08 • Can we plot your ss in MMA directly? – yode Mar 29, 2022 at 10:59 • @yoda Yes. I've updated the above with what I think you are asking for. Hope this helps. Mar 29, 2022 at 15:23 EquationTrekker works for me, but if you are not interested in looking at a range of solutions, it might be easier to just do it with ParametricPlot x[t_] := -Cos[4 t] ParametricPlot[{x[t], x'[t]} // Evaluate, {t, 0, 2 π}, Axes -> False, PlotLabel -> PhaseTrajectory, Frame -> True, FrameLabel -> {x[t], x'[t]}, GridLines -> Automatic] • What version is this on, Bill? Someone in the QA that OP links to says EquationTrekker is broken for them on v11.0 Mar 15, 2020 at 6:04 • This plot is from ParametricPlot, not EquationTrekker, but in v12.0 EquationTrekker gives me plots, although I do get PropertyValue errors. Mar 15, 2020 at 7:40
1,140
3,557
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 6, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.65625
4
CC-MAIN-2023-40
longest
en
0.844324
First@(DSolve[{ode, ic}, x[t], t]); ParametricPlot[Evaluate[{sol, D[sol, t]}], {t, 0, 3}, PlotStyle -> Red] The advatage of phase plot, is that one does not have to solve the ODE first (so it works for nonlinear hard to solve ODE's). All what you have to do is convert the ODE to state space and use function like StreamPlot If you want to automate the part of converting the ODE to state space, you can also use Mathematica for that.
Simply use StateSpaceModel and just read of the equations. eq = x''[t] + 16 x[t] == 0; ss = StateSpaceModel[{eq}, {{x[t], 0}, {x'[t], 0}}, {}, {x[t]}, t] The above shows the A matrix in $$x'=Ax$$. So first row reads $$x_1'(t)=x_2$$ and second row reads $$x'_2(t)=-16 x_1$$ The following can be done to automate plotting StreamPlot directly from the state space ss result A = First@Normal[ss]; vars = {x1, x2}; (*state space variables*) eqs = A .
https://mathematica.stackexchange.com/questions/216293/phase-portrait-for-ode-with-ivp?noredirect=1
1,696,284,912,000,000,000
text/html
crawl-data/CC-MAIN-2023-40/segments/1695233511021.4/warc/CC-MAIN-20231002200740-20231002230740-00732.warc.gz
414,570,837
42,266
# Phase Portrait for ODE with IVP I'm trying to make a phase portrait for the ODE x'' + 16x = 0, with initial conditions x[0]=-1 & x'[0]=0. I know how to solve the ODE and find the integration constants; the solution comes out to be x(t) = -cos(4t) and x'(t) = 4sin(4t). But I don't know how to make a phase portrait out of it. I've looked at this link Plotting a Phase Portrait but I couldn't replicate mine based off of it. Phase portrait for any second order autonomous ODE can be found as follows. Convert the ODE to state space. This results in 2 first order ODE's. Then call StreamPlot with these 2 equations. Let the state variables be $$x_1=x,x_2=x'(t)$$, then taking derivatives w.r.t time gives $$x'{_1}=x_2,x'{_2}=x''(t)=-16 x_1$$. Now, using StreamPlot gives StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -2, 2}] To see the line that passes through the initial conditions $$x_1(0)=1,x_2(0)=0.1$$, add the option StreamPoints StreamPlot[{x2, -16 x1}, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] To verify the above is the correct phase plot, you can do ClearAll[x, t] ode = x''[t] + 16 x[t] == 0; ic = {x[0] == 1, x'[0] == 1/10}; sol = x[t] /. First@(DSolve[{ode, ic}, x[t], t]); ParametricPlot[Evaluate[{sol, D[sol, t]}], {t, 0, 3}, PlotStyle -> Red] The advatage of phase plot, is that one does not have to solve the ODE first (so it works for nonlinear hard to solve ODE's). All what you have to do is convert the ODE to state space and use function like StreamPlot If you want to automate the part of converting the ODE to state space, you can also use Mathematica for that. Simply use StateSpaceModel and just read of the equations. eq = x''[t] + 16 x[t] == 0; ss = StateSpaceModel[{eq}, {{x[t], 0}, {x'[t], 0}}, {}, {x[t]}, t] The above shows the A matrix in $$x'=Ax$$. So first row reads $$x_1'(t)=x_2$$ and second row reads $$x'_2(t)=-16 x_1$$ The following can be done to automate plotting StreamPlot directly from the state space ss result A = First@Normal[ss]; vars = {x1, x2}; (*state space variables*) eqs = A . vars; StreamPlot[eqs, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] • Can you method plot y''[x]+2 y'[x]+3 y[x]==2 x? – yode Mar 27, 2022 at 8:59 • @yode Phase portrait are used for homogeneous ode's. Systems of the form $x'=A x$ and not $x'=A x + u$. Since it shows the behaviour of the system itself, independent of any forcing functions (the stuff on the RHS). This behavior is given by phase portrait diagram. The reason is, it is only the $A$ matrix eigenvalues and eigenvectors that determines this behaviour, and $A$ depends only on the system itself, without any external input being there. Mar 27, 2022 at 14:08 • Can we plot your ss in MMA directly? – yode Mar 29, 2022 at 10:59 • @yoda Yes. I've updated the above with what I think you are asking for. Hope this helps. Mar 29, 2022 at 15:23 EquationTrekker works for me, but if you are not interested in looking at a range of solutions, it might be easier to just do it with ParametricPlot x[t_] := -Cos[4 t] ParametricPlot[{x[t], x'[t]} // Evaluate, {t, 0, 2 π}, Axes -> False, PlotLabel -> PhaseTrajectory, Frame -> True, FrameLabel -> {x[t], x'[t]}, GridLines -> Automatic] • What version is this on, Bill? Someone in the QA that OP links to says EquationTrekker is broken for them on v11.0 Mar 15, 2020 at 6:04 • This plot is from ParametricPlot, not EquationTrekker, but in v12.0 EquationTrekker gives me plots, although I do get PropertyValue errors. Mar 15, 2020 at 7:40
1,140
3,557
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 6, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.65625
4
CC-MAIN-2023-40
longest
en
0.844324
vars; StreamPlot[eqs, {x1, -2, 2}, {x2, -5, 5}, StreamPoints -> {{{{1, .1}, Red}, Automatic}}] • Can you method plot y''[x]+2 y'[x]+3 y[x]==2 x? – yode Mar 27, 2022 at 8:59 • @yode Phase portrait are used for homogeneous ode's. Systems of the form $x'=A x$ and not $x'=A x + u$. Since it shows the behaviour of the system itself, independent of any forcing functions (the stuff on the RHS).
This behavior is given by phase portrait diagram. The reason is, it is only the $A$ matrix eigenvalues and eigenvectors that determines this behaviour, and $A$ depends only on the system itself, without any external input being there. Mar 27, 2022 at 14:08 • Can we plot your ss in MMA directly? – yode Mar 29, 2022 at 10:59 • @yoda Yes. I've updated the above with what I think you are asking for.
http://math.stackexchange.com/questions/tagged/vector-spaces+vector-analysis
1,398,348,055,000,000,000
text/html
crawl-data/CC-MAIN-2014-15/segments/1398223206147.1/warc/CC-MAIN-20140423032006-00167-ip-10-147-4-33.ec2.internal.warc.gz
210,644,211
24,883
# Tagged Questions 23 views ### Why should we expect the divergence operator to be invariant under transformations? A lot of the time with vector calculus identities, something that seems magical at first ends up having a nice and unique proof. For the divergence operator, one can prove that it's invariant under a ... 3 views ### Gentle introduction to discrete vector field [closed] I am looking for a gentle introduction to discrete vector field. Thanks in advance. 26 views ### Vectors and Planes Let there be 2 planes: $x-y+z=2, 2x-y-z=1$ Find the equation of the line of the intersection of the two planes, as well as that of another plane which goes through that line. Attempt to solve: the ... 25 views 63 views ### Extrema of a vector norm under two inner-product constraints. If $\langle\vec{A},\vec{V}\rangle=1\; ,\; \langle\vec{B},\vec{V}\rangle=c$, then: \begin{align} max\left \| \vec{V} \right \|_{1}=?\;\;\;min\left \| \vec{V} \right \|_{1}=? \end{align} Consider the ... 129 views ### How to rotate two vectors (2d), where their angle is larger than 180. The rotation matrix $$\begin{bmatrix} \cos\theta & -\sin \theta\\ \sin\theta & \cos\theta \end{bmatrix}$$ cannot process the case that the angle between two vectors is larger than $180$ ... 53 views ### Is this statement about vectors true? If vectors $A$ and $B$ are parallel, then, $|A-B| = |A| - |B|$ Is the above statement true? 822 views ### Collinearity of three points of vectors Show that the three vectors $$A\_ = 2i + j - 3k , B\_ = i - 4k , C\_ = 4i + 3j -k$$ are linearly dependent. Determine a relation between them and hence show that the terminal points are collinear. ... 92 views 135 views ### Vectors transformation Give a necessary and sufficient condition ("if and only if") for when three vectors $a, b, c, \in \mathbb{R^2}$ can be transformed to unit length vectors by a single affine transformation. This is ... 56 views ### To show the inequality $\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$ Let $A\in$ $\mathbb{C}^{p\times q}$ with column $u_1,\ldots,u_q$ and rows $\vec{v_1},\ldots,\vec{v_p}$. show that $$\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$$ and ... 160 views ### Find the necessary and sufficient conditions on $A$ such that $\|T(\vec{x})\|=|\det A|\cdot\|\vec{x}\|$ for all $\vec{x}$. Consider the mapping $T:\mathbb{R}^n\mapsto\mathbb{R}^n$ defined by $T(\vec{x})=A\vec{x}$ where $A$ is a $n\times n$ matrix. Find the necessary and sufficient conditions on $A$ such that ... 58 views ### Dot products of three or more vectors Can't we construct a mapping from $V^3(R^1)$ to $R$ such that $a.b.c = a_{x}b_{x}c_{x}+a_{y}b_{y}c_{y}+a_{z}b_{z}c_{z}$ (a,b,c are vectors in $V^3(R^1)$ ) and more generally $a^n$ , $a.b.c.d.e...$ ... 365 views 50 views
900
2,846
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0}
3.84375
4
CC-MAIN-2014-15
longest
en
0.833623
# Tagged Questions 23 views ### Why should we expect the divergence operator to be invariant under transformations? A lot of the time with vector calculus identities, something that seems magical at first ends up having a nice and unique proof. For the divergence operator, one can prove that it's invariant under a ... 3 views ### Gentle introduction to discrete vector field [closed] I am looking for a gentle introduction to discrete vector field.
Thanks in advance. 26 views ### Vectors and Planes Let there be 2 planes: $x-y+z=2, 2x-y-z=1$ Find the equation of the line of the intersection of the two planes, as well as that of another plane which goes through that line. Attempt to solve: the ... 25 views 63 views ### Extrema of a vector norm under two inner-product constraints. If $\langle\vec{A},\vec{V}\rangle=1\; ,\; \langle\vec{B},\vec{V}\rangle=c$, then: \begin{align} max\left \| \vec{V} \right \|_{1}=?\;\;\;min\left \| \vec{V} \right \|_{1}=?
http://math.stackexchange.com/questions/tagged/vector-spaces+vector-analysis
1,398,348,055,000,000,000
text/html
crawl-data/CC-MAIN-2014-15/segments/1398223206147.1/warc/CC-MAIN-20140423032006-00167-ip-10-147-4-33.ec2.internal.warc.gz
210,644,211
24,883
# Tagged Questions 23 views ### Why should we expect the divergence operator to be invariant under transformations? A lot of the time with vector calculus identities, something that seems magical at first ends up having a nice and unique proof. For the divergence operator, one can prove that it's invariant under a ... 3 views ### Gentle introduction to discrete vector field [closed] I am looking for a gentle introduction to discrete vector field. Thanks in advance. 26 views ### Vectors and Planes Let there be 2 planes: $x-y+z=2, 2x-y-z=1$ Find the equation of the line of the intersection of the two planes, as well as that of another plane which goes through that line. Attempt to solve: the ... 25 views 63 views ### Extrema of a vector norm under two inner-product constraints. If $\langle\vec{A},\vec{V}\rangle=1\; ,\; \langle\vec{B},\vec{V}\rangle=c$, then: \begin{align} max\left \| \vec{V} \right \|_{1}=?\;\;\;min\left \| \vec{V} \right \|_{1}=? \end{align} Consider the ... 129 views ### How to rotate two vectors (2d), where their angle is larger than 180. The rotation matrix $$\begin{bmatrix} \cos\theta & -\sin \theta\\ \sin\theta & \cos\theta \end{bmatrix}$$ cannot process the case that the angle between two vectors is larger than $180$ ... 53 views ### Is this statement about vectors true? If vectors $A$ and $B$ are parallel, then, $|A-B| = |A| - |B|$ Is the above statement true? 822 views ### Collinearity of three points of vectors Show that the three vectors $$A\_ = 2i + j - 3k , B\_ = i - 4k , C\_ = 4i + 3j -k$$ are linearly dependent. Determine a relation between them and hence show that the terminal points are collinear. ... 92 views 135 views ### Vectors transformation Give a necessary and sufficient condition ("if and only if") for when three vectors $a, b, c, \in \mathbb{R^2}$ can be transformed to unit length vectors by a single affine transformation. This is ... 56 views ### To show the inequality $\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$ Let $A\in$ $\mathbb{C}^{p\times q}$ with column $u_1,\ldots,u_q$ and rows $\vec{v_1},\ldots,\vec{v_p}$. show that $$\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$$ and ... 160 views ### Find the necessary and sufficient conditions on $A$ such that $\|T(\vec{x})\|=|\det A|\cdot\|\vec{x}\|$ for all $\vec{x}$. Consider the mapping $T:\mathbb{R}^n\mapsto\mathbb{R}^n$ defined by $T(\vec{x})=A\vec{x}$ where $A$ is a $n\times n$ matrix. Find the necessary and sufficient conditions on $A$ such that ... 58 views ### Dot products of three or more vectors Can't we construct a mapping from $V^3(R^1)$ to $R$ such that $a.b.c = a_{x}b_{x}c_{x}+a_{y}b_{y}c_{y}+a_{z}b_{z}c_{z}$ (a,b,c are vectors in $V^3(R^1)$ ) and more generally $a^n$ , $a.b.c.d.e...$ ... 365 views 50 views
900
2,846
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0}
3.84375
4
CC-MAIN-2014-15
longest
en
0.833623
822 views ### Collinearity of three points of vectors Show that the three vectors $$A\_ = 2i + j - 3k , B\_ = i - 4k , C\_ = 4i + 3j -k$$ are linearly dependent. Determine a relation between them and hence show that the terminal points are collinear. ... 92 views 135 views ### Vectors transformation Give a necessary and sufficient condition ("if and only if") for when three vectors $a, b, c, \in \mathbb{R^2}$ can be transformed to unit length vectors by a single affine transformation.
This is ... 56 views ### To show the inequality $\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$ Let $A\in$ $\mathbb{C}^{p\times q}$ with column $u_1,\ldots,u_q$ and rows $\vec{v_1},\ldots,\vec{v_p}$. show that $$\|A\|\geq\max\{\|u_1\|,\ldots,\|u_q\|,\|\vec{v_1}\|,\ldots,\|\vec{v_q}\|\}$$ and ... 160 views ### Find the necessary and sufficient conditions on $A$ such that $\|T(\vec{x})\|=|\det A|\cdot\|\vec{x}\|$ for all $\vec{x}$.
https://quant.stackexchange.com/questions/68635/characteristics-of-factor-portfolios/68646
1,713,245,452,000,000,000
text/html
crawl-data/CC-MAIN-2024-18/segments/1712296817043.36/warc/CC-MAIN-20240416031446-20240416061446-00402.warc.gz
439,703,907
40,053
# characteristics of factor portfolios In the paper Characteristics of Factor Portfolios (https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1601414), when it discusses pure factor portfolios, it says that simple style factor portfolios have zero exposure to all other style, country, and industry factors. Could someone help me understand the math for why the style factor portfolios have zero exposure to all other style, country, and industry factors? So, for example, if we are interested in the return of a P/E factor and a P/B factor, we would gather the P/E and P/B for all of our stocks into a matrix of loadings $$B$$. $$B$$ would have two columns – one containing P/E and one containing P/B for all assets. We then regress $$R$$ (a vector containing the returns of all assets) on $$B$$. OLS regression gives us $$f= (B’B)^{-1} B’R$$ = the returns of the style factors for this particular period. The rows of $$(B’B)^{-1} B’$$ are considered to be the factor portfolios. So, let’s go one step further and look at the loadings of the portfolio on the individual styles by multiplying the factor portfolios with the matrix of loadings. This gives $$(B’B)^{-1} B’B = I$$ - an identity matrix. Hence, the loadings of each factor portfolio are 1 against the particular style and 0 against any other style.
312
1,312
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 7, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.59375
4
CC-MAIN-2024-18
latest
en
0.874208
# characteristics of factor portfolios In the paper Characteristics of Factor Portfolios (https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1601414), when it discusses pure factor portfolios, it says that simple style factor portfolios have zero exposure to all other style, country, and industry factors. Could someone help me understand the math for why the style factor portfolios have zero exposure to all other style, country, and industry factors?
So, for example, if we are interested in the return of a P/E factor and a P/B factor, we would gather the P/E and P/B for all of our stocks into a matrix of loadings $$B$$. $$B$$ would have two columns – one containing P/E and one containing P/B for all assets. We then regress $$R$$ (a vector containing the returns of all assets) on $$B$$. OLS regression gives us $$f= (B’B)^{-1} B’R$$ = the returns of the style factors for this particular period.
http://math.stackexchange.com/questions/52974/what-is-the-last-digit-of-pi?answertab=votes
1,461,905,621,000,000,000
text/html
crawl-data/CC-MAIN-2016-18/segments/1461860110372.12/warc/CC-MAIN-20160428161510-00036-ip-10-239-7-51.ec2.internal.warc.gz
126,954,852
20,812
# What is the last digit of $\pi$? I want to know: what is the last digit of $\pi$? Some people say there are no such thing, but they fail to mention why. - Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented. To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$. If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious. I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion. All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus. The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$. More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational . Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$. As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$. So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof. - ## protected by Qiaochu YuanJul 21 '11 at 22:17 Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
1,256
4,508
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2016-18
latest
en
0.930496
- Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented.
To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$.
http://math.stackexchange.com/questions/52974/what-is-the-last-digit-of-pi?answertab=votes
1,461,905,621,000,000,000
text/html
crawl-data/CC-MAIN-2016-18/segments/1461860110372.12/warc/CC-MAIN-20160428161510-00036-ip-10-239-7-51.ec2.internal.warc.gz
126,954,852
20,812
# What is the last digit of $\pi$? I want to know: what is the last digit of $\pi$? Some people say there are no such thing, but they fail to mention why. - Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented. To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$. If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious. I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion. All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus. The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$. More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational . Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$. As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$. So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof. - ## protected by Qiaochu YuanJul 21 '11 at 22:17 Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
1,256
4,508
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2016-18
latest
en
0.930496
If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious.
I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion.
http://math.stackexchange.com/questions/52974/what-is-the-last-digit-of-pi?answertab=votes
1,461,905,621,000,000,000
text/html
crawl-data/CC-MAIN-2016-18/segments/1461860110372.12/warc/CC-MAIN-20160428161510-00036-ip-10-239-7-51.ec2.internal.warc.gz
126,954,852
20,812
# What is the last digit of $\pi$? I want to know: what is the last digit of $\pi$? Some people say there are no such thing, but they fail to mention why. - Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented. To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$. If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious. I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion. All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus. The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$. More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational . Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$. As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$. So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof. - ## protected by Qiaochu YuanJul 21 '11 at 22:17 Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
1,256
4,508
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2016-18
latest
en
0.930496
All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus.
The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$.
http://math.stackexchange.com/questions/52974/what-is-the-last-digit-of-pi?answertab=votes
1,461,905,621,000,000,000
text/html
crawl-data/CC-MAIN-2016-18/segments/1461860110372.12/warc/CC-MAIN-20160428161510-00036-ip-10-239-7-51.ec2.internal.warc.gz
126,954,852
20,812
# What is the last digit of $\pi$? I want to know: what is the last digit of $\pi$? Some people say there are no such thing, but they fail to mention why. - Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented. To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$. If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious. I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion. All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus. The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$. More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational . Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$. As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$. So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof. - ## protected by Qiaochu YuanJul 21 '11 at 22:17 Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
1,256
4,508
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2016-18
latest
en
0.930496
More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational .
Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$.
http://math.stackexchange.com/questions/52974/what-is-the-last-digit-of-pi?answertab=votes
1,461,905,621,000,000,000
text/html
crawl-data/CC-MAIN-2016-18/segments/1461860110372.12/warc/CC-MAIN-20160428161510-00036-ip-10-239-7-51.ec2.internal.warc.gz
126,954,852
20,812
# What is the last digit of $\pi$? I want to know: what is the last digit of $\pi$? Some people say there are no such thing, but they fail to mention why. - Sometimes even rational numbers don't have a "last digit", think of 1/3=0.33333... – Vhailor Jul 21 '11 at 22:12 Nice Poem. ${}$ – jspecter Jul 21 '11 at 22:13 If $\pi$ has a last digit, then $0.999\ldots\neq 1$. – Asaf Karagila Jul 21 '11 at 22:13 This question should specify "base 10". The "no last digit" phenomenon depends on how $\pi$ is represented. To take a contrived setting, base-$\pi$ numbers, then $\pi$ is written as $1$. I'm not trying to be pedantic here: representation is a fundamental part of this question. – Fixee Jul 22 '11 at 6:09 @jspecter: A slightly enhanced version: $$\text{I desperately want to know}\\ \text{The last digit of \pi}\\ \text{Some people say there's no such thing}\\ \text{They fail to mention why}$$ – joriki Dec 22 '12 at 3:49 There is no "last" digit of $\pi$. If there was a last digit, then there could only be finitely many digits in front so that $\pi$ would be a rational number. However $\pi$ was shown to be irrational in the 18th century by Lambert. (This Meta.StackExchange post is a joke based on the impossibility of finding such a last digit) - Thanks for the link to the Meta.StackExchange post: hilarious. I've got my laughs in for the day. We all need a good dose of humor now and then! – amWhy Jul 21 '11 at 22:16 Since you may have never seen the topics in my colleagues' answers, I'll try to explain them in some detail. Suppose for the sake of argument that when $\pi$ is written as a decimal expansion ($3.1415 \dots$) it does have a final digit. This would clearly imply that there is a finite number of terms in the expansion. All real numbers with finite decimal expansions can be written in the form $\frac{a}{b}$ where $a$ and $b$ are integers (whole numbers). By this reasoning we conclude that $\pi = \frac{a}{b}$ for some positive integers $a$ and $b$, i.e., that $\pi$ is rational. This is the starting point for this short proof given by I. Niven in 1946, which is especially easy to follow if you've had a little trigonometry and even less differential calculus. The proof concludes with an absurdity like the existence of an integer between $0$ and $1$, which implies that $a$ and $b$ do not exist and $\pi$ is irrational (and has an infinite decimal expansion). It should be noted that the irrationality of $\pi$ was first established by Lambert in 1761 by studying the continued fraction expansion of the tangent function and using the identity $\tan \frac{\pi}{4} = 1$. More generally, he proved that if $x$ is rational, then $\tan x$ is irrational. In short, there is no final digit in the decimal expansion of $\pi$ because it is irrational. - Ok, try it now. – user02138 Jul 22 '11 at 5:25 Proving that $\pi$ is irrational is more difficult than proving that $e$ or $\sqrt{2}$ or $\log_2 3$ is irrational. See http://en.wikipedia.org/wiki/Proof_that_pi_is_irrational . Proving that an irrational number has no last digit is easier than that: http://en.wikipedia.org/wiki/Irrational_number - Even rational numbers usually have no "last digit": what is the last digit of $$0.1313131\dots = 0.\overline{13} = \frac{13}{99} ?$$ So what sort of numbers have a last digit? One, numbers with a terminating decimal expansion: numbers like $\displaystyle 2.23627 = \frac{223627}{100000}$. As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$. So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof. - ## protected by Qiaochu YuanJul 21 '11 at 22:17 Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
1,256
4,508
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2016-18
latest
en
0.930496
As you can see, all such numbers can be written as a fraction with denominator being a power of $10$. Two, depending on your definition of "last digit", numbers like $0.4677777\dots = \frac1{100}46.77777$ = $\displaystyle \frac1{100}\left(46 + \frac79\right) = \frac1{100}\frac{421}{9}$. These numbers can be written as $\displaystyle \frac1{10^k} \frac{n}9$ for some integers $k$ and $n$.
So a number $x$ has a "last digit" if and only if $(9\cdot 10^k)x$ is an integer for some $k$. Only very special numbers are of this form, and it should be no surprise that $\pi$ is not. (Admittedly, I don't actually see how to prove this without invoking $\pi$'s irrationality, but it's a much weaker property.) - HINT $\rm\ \pi = 3.1415\ \Rightarrow\ 10^4\: \pi = 31415\ \Rightarrow\ \pi = 31415/10^4\$ is rational, contra Lambert's proof.
https://physics.stackexchange.com/questions/533659/kinetic-energy-operator-in-momentum-basis
1,721,559,139,000,000,000
text/html
crawl-data/CC-MAIN-2024-30/segments/1720763517663.24/warc/CC-MAIN-20240721091006-20240721121006-00813.warc.gz
387,512,308
40,354
# Kinetic Energy Operator in Momentum Basis I'm having a little trouble with something that's 'easy to check' according to the script I'm using. I consider the kinetic energy operator $$\hat T = \frac{p^2}{2m} = -\frac{\hbar^2}{2m} \frac{d^2}{dx^2}$$ and the wave function in momentum space, which is obtained using the Fourier transform $$\tilde \psi(k) = \mathcal{F}[\psi(x)] = \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{+\infty} \psi(x) e^{-ikx} dx \ .$$ According to the script it's easy to see that $$\hat T \tilde \psi(k) = \frac{\hbar^2 k^2}{2m} \tilde \psi(k)\ ,$$ i.e. that $$\tilde \psi(k)$$ is an eigenstate of the kinetic energy operator. I don't manage to replicate that result. In particular, using integration by parts a few times I get \begin{align} \hat T \tilde \psi(k) &= -\frac{\hbar^2}{2m} \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{+\infty} \frac{d^2}{dx^2} ( \psi(x) e^{-ikx} ) dx \\ &= … \\ &= -\frac{\hbar^2}{2m} \tilde \psi(k) (-k^2 + 2k^2 - k^2) \\ &= 0 \end{align} I see that $$\mathcal{F}[\hat T \psi(x)] = \frac{\hbar^2 k^2}{2m} \mathcal{F}[\psi(x)]$$ but $$\mathcal{F}[\hat T \psi(x)] \neq \hat T \tilde \psi(k)$$, right? So I'm confused ... Can anybody show me where I go wrong? • If you are doing derivatives with respect to $x$ for the momentum operator, then you are in the position basis, not the momentum basis. Commented Feb 28, 2020 at 20:08 • The momentum operator takes different form. In position basis, momentum is a derivative. In momentum basis, momentum is just multiplying by p. Commented Feb 28, 2020 at 20:14 • oh I see, we use de Broglie's relation $p = \hbar k$ so $\hat T = \frac{p^2}{2m} = \frac{\hbar^2 k^2}{2m}$ and we just multiply by it, that's great, thanks to both of you! – mpr Commented Feb 28, 2020 at 20:35 First, the expression $$\hat T\bar\psi (k)=\frac{\hbar^2k^2}{2m}\bar\psi(k)$$ does not mean $$\bar\psi(k)$$ is an eigenvalue of $$\hat T$$ because $$\hbar^2k^2/2m$$ is not a constant ($$k$$ is a variable now). Second, $$\hat T\bar\psi(k)$$ is not an expression that makes much sense. I think you actually mean $$\langle k|\hat T|\psi\rangle$$. To be more formal, you are starting with $$\bar\psi(k)=\langle k|\psi\rangle=\int_{-\infty}^\infty\langle k|x\rangle\langle x|\psi\rangle\,\text dx=\int_{-\infty}^\infty\frac{1}{\sqrt{2\pi}}e^{-ikx}\psi(x)\,\text dx$$ But you cannot "operate" $$\hat T$$ on $$\langle k|\psi\rangle$$, since this is technically just a number for some value of $$k$$. This is why I think you actually mean $$\langle k|\hat T|\psi\rangle$$ because we can compute this in the momentum basis $$\langle k|\hat T|\psi\rangle=\int_{-\infty}^\infty\langle k|\hat T|k'\rangle\langle k'|\psi\rangle \,\text dk'=\int_{-\infty}^\infty\frac{\hbar^2k^2}{2m}\delta(k-k')\bar\psi(k') \,\text dk'=\frac{\hbar^2k^2}{2m}\bar\psi(k)$$ This also reveals why $$\bar\psi(k)$$ is not, in general, an eigenfunction of $$\hat T$$. Note that really what we want is the basis-independent statement $$\hat T|\psi\rangle=c|\psi\rangle$$ to be true for $$|\psi\rangle$$ to be an eigenstate of $$\hat T$$. Now, at first glance this seems to be the case here, but the issue is that we needed to move into the $$k$$-basis in order to get this expression. In other words, $$\frac{\hbar^2k^2}{2m}$$ isn't an eigenvalue, it is just what is multiplied by $$\bar\psi(k)$$ when looking at $$\hat T$$ being applied to $$|\psi\rangle$$ specifically in the $$k$$-basis. In other other words, the reason that we get $$\frac{\hbar^2k^2}{2m}$$ is because of the operator and the chosen basis, not because of $$|\psi\rangle$$. • Thanks Aaron, that's what I was looking for, I'd think in the script they meant $\langle k \vert \hat{T} \vert \psi \rangle$. Just one question, you say because $k$ is a variable it can't be an eigenvalue. Why not? What's in the definition of eigenvectors/eigenvalues that prohibits that? – mpr Commented Mar 5, 2020 at 23:06 • @mpr Yeah I agree I was being pretty unclear on that first part. When I have time I'll edit it to be more clear, and I'll let you know when I do that. Commented Mar 6, 2020 at 0:19 • @mpr I added a part at the end. Commented Mar 6, 2020 at 9:59 • that clarifies it well, thank you very much! – mpr Commented Mar 6, 2020 at 10:29
1,442
4,242
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 33, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0}
3.71875
4
CC-MAIN-2024-30
latest
en
0.808276
Commented Feb 28, 2020 at 20:08 • The momentum operator takes different form. In position basis, momentum is a derivative. In momentum basis, momentum is just multiplying by p. Commented Feb 28, 2020 at 20:14 • oh I see, we use de Broglie's relation $p = \hbar k$ so $\hat T = \frac{p^2}{2m} = \frac{\hbar^2 k^2}{2m}$ and we just multiply by it, that's great, thanks to both of you!
– mpr Commented Feb 28, 2020 at 20:35 First, the expression $$\hat T\bar\psi (k)=\frac{\hbar^2k^2}{2m}\bar\psi(k)$$ does not mean $$\bar\psi(k)$$ is an eigenvalue of $$\hat T$$ because $$\hbar^2k^2/2m$$ is not a constant ($$k$$ is a variable now). Second, $$\hat T\bar\psi(k)$$ is not an expression that makes much sense. I think you actually mean $$\langle k|\hat T|\psi\rangle$$.
https://physics.stackexchange.com/questions/533659/kinetic-energy-operator-in-momentum-basis
1,721,559,139,000,000,000
text/html
crawl-data/CC-MAIN-2024-30/segments/1720763517663.24/warc/CC-MAIN-20240721091006-20240721121006-00813.warc.gz
387,512,308
40,354
# Kinetic Energy Operator in Momentum Basis I'm having a little trouble with something that's 'easy to check' according to the script I'm using. I consider the kinetic energy operator $$\hat T = \frac{p^2}{2m} = -\frac{\hbar^2}{2m} \frac{d^2}{dx^2}$$ and the wave function in momentum space, which is obtained using the Fourier transform $$\tilde \psi(k) = \mathcal{F}[\psi(x)] = \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{+\infty} \psi(x) e^{-ikx} dx \ .$$ According to the script it's easy to see that $$\hat T \tilde \psi(k) = \frac{\hbar^2 k^2}{2m} \tilde \psi(k)\ ,$$ i.e. that $$\tilde \psi(k)$$ is an eigenstate of the kinetic energy operator. I don't manage to replicate that result. In particular, using integration by parts a few times I get \begin{align} \hat T \tilde \psi(k) &= -\frac{\hbar^2}{2m} \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{+\infty} \frac{d^2}{dx^2} ( \psi(x) e^{-ikx} ) dx \\ &= … \\ &= -\frac{\hbar^2}{2m} \tilde \psi(k) (-k^2 + 2k^2 - k^2) \\ &= 0 \end{align} I see that $$\mathcal{F}[\hat T \psi(x)] = \frac{\hbar^2 k^2}{2m} \mathcal{F}[\psi(x)]$$ but $$\mathcal{F}[\hat T \psi(x)] \neq \hat T \tilde \psi(k)$$, right? So I'm confused ... Can anybody show me where I go wrong? • If you are doing derivatives with respect to $x$ for the momentum operator, then you are in the position basis, not the momentum basis. Commented Feb 28, 2020 at 20:08 • The momentum operator takes different form. In position basis, momentum is a derivative. In momentum basis, momentum is just multiplying by p. Commented Feb 28, 2020 at 20:14 • oh I see, we use de Broglie's relation $p = \hbar k$ so $\hat T = \frac{p^2}{2m} = \frac{\hbar^2 k^2}{2m}$ and we just multiply by it, that's great, thanks to both of you! – mpr Commented Feb 28, 2020 at 20:35 First, the expression $$\hat T\bar\psi (k)=\frac{\hbar^2k^2}{2m}\bar\psi(k)$$ does not mean $$\bar\psi(k)$$ is an eigenvalue of $$\hat T$$ because $$\hbar^2k^2/2m$$ is not a constant ($$k$$ is a variable now). Second, $$\hat T\bar\psi(k)$$ is not an expression that makes much sense. I think you actually mean $$\langle k|\hat T|\psi\rangle$$. To be more formal, you are starting with $$\bar\psi(k)=\langle k|\psi\rangle=\int_{-\infty}^\infty\langle k|x\rangle\langle x|\psi\rangle\,\text dx=\int_{-\infty}^\infty\frac{1}{\sqrt{2\pi}}e^{-ikx}\psi(x)\,\text dx$$ But you cannot "operate" $$\hat T$$ on $$\langle k|\psi\rangle$$, since this is technically just a number for some value of $$k$$. This is why I think you actually mean $$\langle k|\hat T|\psi\rangle$$ because we can compute this in the momentum basis $$\langle k|\hat T|\psi\rangle=\int_{-\infty}^\infty\langle k|\hat T|k'\rangle\langle k'|\psi\rangle \,\text dk'=\int_{-\infty}^\infty\frac{\hbar^2k^2}{2m}\delta(k-k')\bar\psi(k') \,\text dk'=\frac{\hbar^2k^2}{2m}\bar\psi(k)$$ This also reveals why $$\bar\psi(k)$$ is not, in general, an eigenfunction of $$\hat T$$. Note that really what we want is the basis-independent statement $$\hat T|\psi\rangle=c|\psi\rangle$$ to be true for $$|\psi\rangle$$ to be an eigenstate of $$\hat T$$. Now, at first glance this seems to be the case here, but the issue is that we needed to move into the $$k$$-basis in order to get this expression. In other words, $$\frac{\hbar^2k^2}{2m}$$ isn't an eigenvalue, it is just what is multiplied by $$\bar\psi(k)$$ when looking at $$\hat T$$ being applied to $$|\psi\rangle$$ specifically in the $$k$$-basis. In other other words, the reason that we get $$\frac{\hbar^2k^2}{2m}$$ is because of the operator and the chosen basis, not because of $$|\psi\rangle$$. • Thanks Aaron, that's what I was looking for, I'd think in the script they meant $\langle k \vert \hat{T} \vert \psi \rangle$. Just one question, you say because $k$ is a variable it can't be an eigenvalue. Why not? What's in the definition of eigenvectors/eigenvalues that prohibits that? – mpr Commented Mar 5, 2020 at 23:06 • @mpr Yeah I agree I was being pretty unclear on that first part. When I have time I'll edit it to be more clear, and I'll let you know when I do that. Commented Mar 6, 2020 at 0:19 • @mpr I added a part at the end. Commented Mar 6, 2020 at 9:59 • that clarifies it well, thank you very much! – mpr Commented Mar 6, 2020 at 10:29
1,442
4,242
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 33, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0}
3.71875
4
CC-MAIN-2024-30
latest
en
0.808276
Now, at first glance this seems to be the case here, but the issue is that we needed to move into the $$k$$-basis in order to get this expression. In other words, $$\frac{\hbar^2k^2}{2m}$$ isn't an eigenvalue, it is just what is multiplied by $$\bar\psi(k)$$ when looking at $$\hat T$$ being applied to $$|\psi\rangle$$ specifically in the $$k$$-basis.
In other other words, the reason that we get $$\frac{\hbar^2k^2}{2m}$$ is because of the operator and the chosen basis, not because of $$|\psi\rangle$$. • Thanks Aaron, that's what I was looking for, I'd think in the script they meant $\langle k \vert \hat{T} \vert \psi \rangle$. Just one question, you say because $k$ is a variable it can't be an eigenvalue.
https://math.stackexchange.com/questions/851072/theorem-on-giuga-number/851114
1,561,549,511,000,000,000
text/html
crawl-data/CC-MAIN-2019-26/segments/1560628000306.84/warc/CC-MAIN-20190626114215-20190626140215-00312.warc.gz
522,635,721
34,745
# Theorem on Giuga number Giuga number : $n$ is a Giuga number $\iff$ For every prime factor $p$ of $n$ , $p | (\frac{n}{p}-1)$ How to prove the following theorem on Giuga numbers $n$ is a giuga number $\iff$ $\sum_{i=1}^{n-1} i^{\phi(n)} \equiv -1 \mod {n}$ ## 1 Answer The $\Rightarrow$ part. For first, a giuga number must be squarefree, since, by assuming $p^2\mid n$, we have that $p$ divides two consecutive numbers, $\frac{n}{p}$ and $\frac{n}{p}-1$, that is clearly impossible. So we have: $$n = \prod_{i=1}^{k} p_i$$ that implies: $$\phi(n) = \prod_{i=1}^{k} (p_i-1).$$ By considering the sum $$\sum_{i=0}^{n-1}i^{\phi(n)}$$ $\pmod{p_i}$ we have that all the terms contribute with a $1$, except the multiples of $p_i$ that contribute with a zero. This gives: $$\sum_{i=0}^{n-1}i^{\phi(n)}\equiv n-\frac{n}{p_i}\equiv (n-1)\pmod{p_i}\tag{1}$$ that holds for any $i\in[1,k]$. The chinese theorem now give: $$\sum_{i=0}^{n-1}i^{\phi(n)}\equiv n-1\pmod{\prod_{i=1}^{k}p_i}$$ that is just: $$\sum_{i=0}^{n-1}i^{\phi(n)}\equiv -1\pmod{n}$$ as claimed. For the $\Leftarrow$ part, we have that the congruence $\!\!\!\pmod{n}$ implies the congruence $\!\!\!\pmod{p_i}$, hence $(1)$ must hold, so we must have: $$\frac{n}{p_i}\equiv 1\pmod{p_i}$$ that is equivalent to $p_i\mid\left(\frac{n}{p_i}-1\right).$
504
1,311
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.15625
4
CC-MAIN-2019-26
latest
en
0.746232
# Theorem on Giuga number Giuga number : $n$ is a Giuga number $\iff$ For every prime factor $p$ of $n$ , $p | (\frac{n}{p}-1)$ How to prove the following theorem on Giuga numbers $n$ is a giuga number $\iff$ $\sum_{i=1}^{n-1} i^{\phi(n)} \equiv -1 \mod {n}$ ## 1 Answer The $\Rightarrow$ part. For first, a giuga number must be squarefree, since, by assuming $p^2\mid n$, we have that $p$ divides two consecutive numbers, $\frac{n}{p}$ and $\frac{n}{p}-1$, that is clearly impossible.
So we have: $$n = \prod_{i=1}^{k} p_i$$ that implies: $$\phi(n) = \prod_{i=1}^{k} (p_i-1).$$ By considering the sum $$\sum_{i=0}^{n-1}i^{\phi(n)}$$ $\pmod{p_i}$ we have that all the terms contribute with a $1$, except the multiples of $p_i$ that contribute with a zero. This gives: $$\sum_{i=0}^{n-1}i^{\phi(n)}\equiv n-\frac{n}{p_i}\equiv (n-1)\pmod{p_i}\tag{1}$$ that holds for any $i\in[1,k]$.
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
44