text:
## Section3.4Computing Limits: Algebraically

### Subsection3.4.1Properties of limits

We begin by deriving a handful of theorems to give us the tools to compute many limits without explicitly working with the precise definition of a limit.

Roughly speaking, these rules say that to compute the limit of an algebraic expression, it is enough to compute the limits of the “innermost bits” and then combine these limits. This often means that it is possible to simply plug in a value for the variable, since $\ds \lim_{x\to a} x =a\text{.}$

###### Example3.10. Limit Properties.

Compute $\ds\lim_{x\to 1}{x^2-3x+5\over x-2}\text{.}$

Solution

If we apply the theorem in all its gory detail, we get

\begin{equation*} \begin{split} \lim_{x\to 1}{x^2-3x+5\over x-2} = \amp{\ds\lim_{x\to 1}(x^2-3x+5)\over \ds\lim_{x\to1}(x-2)}\\ =\amp {(\ds\lim_{x\to 1}x^2)-(\ds\lim_{x\to1}3x)+(\ds\lim_{x\to1}5)\over (\ds\lim_{x\to1}x)-(\ds\lim_{x\to1}2)}\\ =\amp {(\ds\lim_{x\to 1}x)^2-3(\ds\lim_{x\to1}x)+5\over (\ds\lim_{x\to1}x)-2}\\ =\amp {1^2-3\cdot1+5\over 1-2}\\ =\amp {1-3+5\over -1} = -3 \end{split} \end{equation*}

It is worth commenting on the trivial limit $\ds \lim\limits_{x\to1}5\text{.}$ From one point of view this might seem meaningless, as the number 5 can't “approach” any value, since it is simply a fixed number. However, 5 can, and should, be interpreted here as the function that has value 5 everywhere, $f(x)=5\text{,}$ with graph a horizontal line. From this point of view it makes sense to ask what happens to the values of the function (height of the graph) as $x$ approaches 1.

We're primarily interested in limits that aren't so easy, namely, limits in which a denominator approaches zero. There are a handful of algebraic tricks that work on many of these limits.

We first look at two cases when the limit of the quotient $\dfrac{f(x)}{g(x)}$ as $x$ approaches $a$ takes on the indeterminate form $\dfrac{0}{0}\text{.}$

###### Example3.11. Zero Denominator.

Compute $\ds\lim_{x\to1}{x^2+2x-3\over x-1}\text{.}$

Solution

We can't simply plug in $x=1$ because that makes the denominator zero. However:

\begin{equation*} \begin{split} \lim_{x\to1}{x^2+2x-3\over x-1} =\amp \lim_{x\to1}{(x-1)(x+3)\over x-1}\\ =\amp \lim_{x\to1}(x+3)=4 \end{split} \end{equation*}

The technique used to solve the previous example can be referred to as factor and cancel. Its validity comes from the fact that we are allowed to cancel $x-1$ from the numerator and denominator. Remember in Calculus that we have to make sure we don't cancel zeros, so we require $x-1\neq 0$ in order to cancel it. But looking back at the definition of a limit using $x\to 1\text{,}$ the key point for this example is that we are taking values of $x$ close to $1$ but not equal to $1\text{.}$ This is exactly what we wanted ($x\neq 1$) in order to cancel this common factor.

###### Example3.12. Another Zero Denominator.

Compute

\begin{equation*} \lim_{x \to 0} \dfrac{x}{x^{3}} \end{equation*}
Solution

We can't simply plug in $x = 0$ because that makes the denominator zero. Let's simplify algebraically first to get

\begin{equation*} \lim_{x \to 0} \dfrac{x}{x^{3}} = \lim_{x \to 0} \dfrac{1}{x^{2}}\text{.} \end{equation*}

As $x$ approaches zero from either the left or right side, the value of $x^{2}$ approaches zero and so $\dfrac{1}{x^{2}}$ approaches infinity. In other words, $\lim_{x \to 0} \dfrac{x}{x^{3}}$ does not exist since it does not approach a real number.

The last two examples show that limits of indeterminate form $\dfrac{0}{0}$ either exist or do not, which is why this type of limit is called indeterminate.

While Theorem 3.9 is very helpful, we need a bit more to work easily with limits. Since the theorem applies when some limits are already known, we need to know the behavior of some functions that cannot themselves be constructed from the simple arithmetic operations of the theorem, such as $\ds\sqrt{x}\text{.}$ Also, there is one other extraordinarily useful way to put functions together: composition. If $f(x)$ and $g(x)$ are functions, we can form two functions by composition: $f(g(x))$ and $g(f(x))\text{.}$ For example, if $\ds f(x)=\sqrt{x}$ and $\ds \ds g(x)=x^2+5\text{,}$ then $\ds f(g(x))=\sqrt{x^2+5}$ and $\ds g(f(x))=(\sqrt{x})^2+5=x+5\text{.}$ Here is a companion to Theorem 3.9 for composition:

Note the special form of the condition on $f\text{:}$ it is not enough to know that $\ds\lim_{x\to L}f(x) = M\text{,}$ though it is a bit tricky to see why. We have included an example in the exercise section to illustrate this tricky point for those who are interested. Many of the most familiar functions do have this property, and this theorem can therefore be applied. For example:

This theorem is not too difficult to prove from the definition of limit.

Another of the most common algebraic tricks is called rationalization. Rationalizing makes use of the difference of squares formula $(a-b)(a+b)=a^2-b^2\text{.}$ Here is an example.

###### Example3.15. Rationalizing.

Compute $\ds\lim_{x\to-1} {\sqrt{x+5}-2\over x+1}\text{.}$

Solution
\begin{equation*} \begin{split} \lim_{x\to-1} {\sqrt{x+5}-2\over x+1} =\amp \lim_{x\to-1} {\sqrt{x+5}-2\over x+1}\cdot{\sqrt{x+5}+2\over \sqrt{x+5}+2}\\ =\amp \lim_{x\to-1} {x+5-4\over (x+1)(\sqrt{x+5}+2)}\\ =\amp \lim_{x\to-1} {x+1\over (x+1)(\sqrt{x+5}+2)}\\ =\amp \lim_{x\to-1} {1\over \sqrt{x+5}+2}={1\over4} \end{split} \end{equation*}

At the very last step we have used Theorems 3.13 and 3.14.

###### Example3.16. Left and Right Limit.

Evaluate $\ds\lim_{x\to 0^+}{x\over|x|}\text{.}$

Solution

The function $f(x)=x/|x|$ is undefined at 0; when $x>0\text{,}$ $|x|=x$ and so $f(x)=1\text{;}$ when $x\lt 0\text{,}$ $|x|=-x$ and $f(x)=-1\text{.}$ Thus

\begin{equation*} \ds \lim_{x\to 0^-}{x\over|x|}=\lim_{x\to 0^-}-1=-1 \end{equation*}

while

\begin{equation*} \ds \lim_{x\to 0^+}{x\over|x|}=\lim_{x\to 0^+}1=1\text{.} \end{equation*}

The limit of $f(x)$ must be equal to both the left and right limits; since they are different, the limit $\ds \lim_{x\to 0}{x\over|x|}$ does not exist.

###### Example3.17. Limit of Piecewise-defined Function.

Let

\begin{equation*} g(x) = \begin{cases} x + 3 \amp \text{ if } x \neq 1 \\ 2 \amp \text{ if } x = 1 \end{cases} \end{equation*}

Evaluate $\lim\limits_{x \to 1} g(x)\text{.}$

Solution

The domain of $g$ is the set of all real numbers. From the graph shown below, we see that $g(x)$ can be made as close to $4$ as we please by taking $x$ sufficiently close to $1\text{.}$ Therefore,

\begin{equation*} \lim_{x \to 1} g(x) = \lim_{x \to 1} (x+3) = 4 \end{equation*}

Observe that $g(1) = 2\text{,}$ which does not equal the value of the limit of the function $g$ as $x$ approaches $1\text{.}$ The value of $g(x)$ at $x = 1$ has no bearing on the existence or value of the limit as $g$ approaches $1\text{.}$

##### Exercises for Section 3.4.

Compute the limits. If a limit does not exist, explain why.

1. $\ds \lim_{x\to 3}{x^2+x-12\over x-3}$

$\lim\limits_{x \to 3} \dfrac{x^{2} + x - 12}{x - 3} = \lim\limits_{x \to 3} \dfrac{(x-3)(x+4)}{x-3} = \lim\limits_{x \to 3} x + 4 = 7\text{.}$
2. $\ds \lim_{x\to 1}{x^2+x-12\over x-3}$

$\lim\limits_{x \to 1} \dfrac{x^{2} + x - 12}{x - 3} = \lim\limits_{x \to 1} x + 4 = 5\text{.}$
3. $\ds \lim_{x\to -4}{x^2+x-12\over x-3}$

$\lim\limits_{x \to -4} \dfrac{x^{2} + x - 12}{x - 3} = \lim\limits_{x \to -4} x + 4 = 0\text{.}$
4. $\ds \lim_{x\to 2} {x^2+x-12\over x-2}$

$\lim\limits_{x \to 2^{+}} \dfrac{x^{2} + x - 12}{x - 2} = \dfrac{-6}{+0} = - \infty\text{.}$ $\lim\limits_{x \to 2^{-}} \dfrac{x^{2} + x - 12}{x - 2} = \dfrac{-6}{-0} = + \infty\text{.}$ Therefore, $\lim\limits_{x \to 2} \dfrac{x^{2} + x - 12}{x - 2}$ DNE.

5. $\ds \lim_{x\to 1} {\sqrt{x+8}-3\over x-1}$

$\lim\limits_{x\to 1} \frac{\sqrt{x+8}-3}{x-1} = \lim\limits_{x\to 1} \frac{\sqrt{x+8}-3}{x-1} \cdot \frac{\sqrt{x+8}+3}{\sqrt{x+8}+3} = \lim\limits_{x\to 1} \frac{(x-1)}{(x-1)(\sqrt{x+8}_3)} = \frac{1}{6}$
6. $\ds \lim_{x\to 0^+} \sqrt{{1\over x}+2} - \sqrt{1\over x}$

$\lim\limits_{x\to 0^+} \sqrt{\frac{1}{x}+2}-\sqrt{\frac{1}{x}} = \lim\limits_{x\to 0^+} \frac{2}{\sqrt{\frac{1}{x}+2}+\sqrt{\frac{1}{x}}} = \lim\limits_{x\to 0^+} \frac{2\sqrt{x}}{\sqrt{1+2x}+1} = \frac{0}{2} = 0$
7. $\ds\lim _{x\to 2} 3$

$\lim\limits_{x\to 2} 3 = 3$
8. $\ds\lim _{x\to 4 } 3x^3 - 5x$

$\lim\limits_{x\to 4}(3x^3-5x) = 3(4^3)-5(4) = 172$
9. $\ds \lim _{x\to 0 } {4x - 5x^2\over x-1}$

$\lim\limits_{x\to 0} \frac{4x-5x^2}{x-1} = \frac{0}{-1} = 0$
10. $\ds\lim _{x\to 1 } {x^2 -1 \over x-1 }$

$\lim\limits_{x\to 1}\dfrac{x^2-1}{x-1} = \lim\limits_{x\to 1}\dfrac{(x-1)(x+1)}{x-1} = \lim\limits_{x\to 1} (x+1) = 2$
11. $\ds\lim _{x\to 0^ + } {\sqrt{2-x^2 }\over x}$

$\lim\limits_{x\to 0^+} \dfrac{\sqrt{2-x^2}}{x} = \lim\limits_{x\to 0^+}\dfrac{\frac{\sqrt{2-x^2}}{x}}{\frac{x}{x}} = \lim\limits_{x\to 0^+} \dfrac{\sqrt{\frac{2-x^2}{x^2}}}{\frac{x}{x}} = \lim\limits_{x\to 0^+}\sqrt{\frac{2}{x^2}-1} = \infty\text{.}$
12. $\ds\lim _{x\to 0^ + } {\sqrt{2-x^2}\over x+1}$

$\lim\limits_{x\to 0^+} \frac{\sqrt{2-x^2}}{x+1} = \frac{\sqrt{2-0}}{1} = \sqrt{2}$
13. $\ds\lim _{x\to a } {x^3 -a^3\over x-a}$

$\lim\limits_{x\to a} \dfrac{x^3-a^3}{x-a} = \lim\limits_{x \to a} \dfrac{(x-a)(a^2+ax+x^2)}{x-a} = 3a^2$
14. $\ds\lim _{x\to 2 } (x^2 +4)^3$

$\lim\limits_{x\to 2} (x^2+1)^3 = 5^3$

Let $f(x)=\left\{ \begin{array}{cc} 1 \amp \text{ if } x\neq 0 \\ 0 \amp \text{ if } x=0 \end{array} \right.$ and $g(x)=0\text{.}$ What are the values of $L=\lim\limits_{x\to 0}g(x)$ and $M=\lim\limits_{x\to L}f(x)\text{?}$ Is it true that $\lim\limits_{x\to 0}f(g(x))=M\text{?}$ What are some noteworthy differences between this example and Theorem 3.13?

$L=0$ and $M=1\text{.}$ No.
Solution

Graphically, we see that $g(x)$ is the line which lies along the $x$-axis, and $f(x)$ is the piecewise-defined function shown below.

Therefore, we find:

\begin{equation*} L = \lim_{x\to 0} g(x) = 0\text{,} \end{equation*}

and so

\begin{equation*} M = \lim_{x\to L} f(x) = \lim_{x\to 0} f(x) = 1\text{.} \end{equation*}

But,

\begin{equation*} \lim_{x\to 0} f(g(x)) = \lim_{x\to 0} f(0) = 0\text{.} \end{equation*}

The difference between this example and Theorem 3.13 is that we do not have $\lim\limits_{x\to 0} f(x) = f(0)\text{.}$

Sketch the graph of the given function $f$ and evaluate $\lim\limits_{x \to a} f(x)\text{,}$ if it exists, for the given values of $a\text{.}$

1. \begin{equation*} f(x) = \begin{cases} x + 1 \amp \text{ if } x \leq 0 \\ 1 \amp \text{ if } x > 0 \end{cases} ,\ a = 0 \end{equation*}
\begin{equation*} \begin{split} \amp \lim_{x \to 0^{+}} f(x) = \lim_{x \to 0^{+}} (x + 1) = 1 \amp \lim_{x \to 0^{-}} f(x) = \lim_{x \to 0^{-}} (1) = 1 \end{split} \end{equation*}

Therefore $\lim\limits_{x \to 0} f(x)= 1\text{.}$

2. \begin{equation*} f(x) = \begin{cases} x \amp \text{ if } x \lt 1 \\ -1 \amp \text{ if } x = 1 \\ -x + 2 \amp \text{ if } x > 1 \end{cases} , \ a = 1 \end{equation*}
\begin{equation*} \begin{split} \amp \lim_{x \to 1^{+}} f(x) = \lim_{x \to 1^{+}} (-x+2) = 1 \amp \lim_{x \to 1^{-}} f(x) = \lim_{x \to 1^{-}} x = 1 \end{split} \end{equation*}

Therefore $\lim\limits_{x \to 1} f(x)= 1\text{.}$

3. \begin{equation*} f(x) = \begin{cases} \lvert x \lvert \amp \text{ if } x \neq 0 \\ 2 \amp \text{ if } x = 0 \end{cases} ,\ a = 0 \end{equation*}
\begin{equation*} \begin{split} \amp \lim_{x \to 0^{+}} f(x) = \lim_{x \to 0^{+}} x = 0 \amp \lim_{x \to 0^{-}} f(x) = \lim_{x \to 0^{-}} (-x) = 0 \end{split} \end{equation*}

Therefore $\lim\limits_{x \to 0} f(x)= 0\text{.}$

Find the indicated limit given that

\begin{equation*} \lim_{x \to a} p(x) = 3 \ \ \text{ and } \ \ \lim_{x \to a} q(x) = 4\text{.} \end{equation*}
1. $\lim\limits_{x \to a} \left[p(x) - q(x) \right]$

$\lim\limits_{x \to a} [ p(x) -q(x)] = \lim\limits_{x \to a} p(x) - \lim\limits_{x \to a} q(x) = 3-4=-1$
2. $\lim\limits_{x \to a} \sqrt{q(x)}$

$\lim\limits_{x \to a} \sqrt{q(x)} = \sqrt{\lim\limits_{x \to a} q(x)} = \sqrt{4} = 2$
3. $\lim\limits_{x \to a} \left[\dfrac{2p(x) - q(x)}{p(x)q(x)} \right]$

$\lim\limits_{x \to a} \left[ \dfrac{2p(x)-q(x)}{p(x)q(x)} \right] = \dfrac{2\lim\limits_{x \to a} p(x) - \lim\limits_{x \to a} q(x)}{ \lim\limits_{x \to a} p(x) \cdot \lim\limits_{x \to a} q(x)} = \dfrac{2(3)-4}{3 \cdot 4} = \dfrac{2}{12} = \dfrac{1}{6}$

Find the indicated limit, if it exists.

1. $\lim\limits_{x \to 0} \dfrac{x^{3}-x^2}{x^2}$

$\lim\limits_{x\to 0} \dfrac{x^3-x^2}{x^2} = \lim\limits_{x\to 0} (x-1) = -1$
2. $\lim\limits_{x \to 1} \dfrac{x^2}{x(x-1)}$

$\lim\limits_{x\to 1} \dfrac{x^2}{x(x-1)} = \lim\limits_{x\to 1} \dfrac{x}{(x-1)} = \lim\limits_{x\to 1} \dfrac{1}{1-\frac{1}{x}}$ DNE
3. $\lim\limits_{x \to 1} \dfrac{x-1}{\sqrt{x}-1}$

$\lim\limits_{x\to 1} \dfrac{x-1}{\sqrt{x}-1} = \lim\limits_{x\to 1} \dfrac{x-1}{\sqrt{x}-1} \cdot \dfrac{\sqrt{x}+1}{\sqrt{x}+1} = \lim\limits_{x\to 1}\dfrac{(x-1)(\sqrt{x}+1)}{x-1} = \lim\limits_{x\to 1}\left(\sqrt{x}+1\right) = 2$
4. $\lim\limits_{x \to -1} \dfrac{x+1}{x^{3}+1}$

$\lim\limits_{x\to -1} \dfrac{x+1}{x^3+1} = \lim\limits_{x\to -1} \dfrac{x+1}{(x+1)(x^2-x+1)} = \lim\limits_{x\to -1} \dfrac{1}{x^2-x+1} = \dfrac{1}{3}$
5. $\lim\limits_{x \to 1} \dfrac{x^{3}-3x+2}{x^{3}-x^{2}-x+1}$

$\lim\limits_{x\to 1} \dfrac{x^3-3x+2}{x^3-x^2-x+1} = \lim\limits_{x\to 1}\dfrac{(x-1)^2(x+2)}{(x-1)^2(x+1)} = \lim\limits_{x\to 1} \dfrac{x+2}{x+1} = \dfrac{3}{2}$
6. $\lim\limits_{x \to 0} \dfrac{x}{\sqrt{x+1}-1}$

\begin{equation*} \begin{split} \lim\limits_{x\to 0} \dfrac{x}{\sqrt{x+1}-1} \amp= \lim\limits_{x\to 0} \dfrac{x}{\sqrt{x+1}-1} \cdot \dfrac{\sqrt{x+1}+1}{\sqrt{x+1}+1} \\ \amp= \lim\limits_{x\to 0} \dfrac{x(\sqrt{x+1}+1)}{x} = \lim\limits_{x\to 0} \left(\sqrt{x+1}+1\right) = 2\end{split} \end{equation*}

Find the indicated one-sided limit, if it exists.

1. $\lim\limits_{x \to 1^{-}} \left(2x + 4\right)$

$\lim\limits_{x\to 1^-} (2x+4) = 2(1)+4 = 6$
2. $\lim\limits_{x \to 2^{+}} \dfrac{x-3}{x+2}$

$\lim\limits_{x\to 2^+} \dfrac{x-3}{x+2} = \dfrac{(2-3)}{(2+2)} = \dfrac{-1}{4}$
3. $\lim\limits_{x \to 0^{-}} \dfrac{1}{x}$

$\lim\limits_{x\to 0^-} \dfrac{1}{x} = -\infty\text{.}$ We refer to the graph of $\dfrac{1}{x}\text{:}$
4. $\lim\limits_{x \to 0^{-}} \dfrac{x-1}{x^{2}+1}$

$\lim\limits_{x\to 0^-} \dfrac{x-1}{x^2+1} = \dfrac{0-1}{0+1} = -1$
5. $\lim\limits_{x \to 1^{+}} \dfrac{1+x}{1-x}$

Since $\lim\limits_{x\to 1^+} (1+x) = 2$ and $\lim\limits_{x\to 1^+} \dfrac{1}{(1-x)} = -\infty\text{,}$ we have $\lim\limits_{x\to 1^+} \dfrac{1+x}{1-x} = -\infty$
6. $\lim\limits_{x \to 0^{+}} f(x)$ and $\lim\limits_{x \to 0^{-}} f(x)$ where
$\lim\limits_{x\to 0^+} f(x) = \lim\limits_{x\to 0^+} 2x = 0\text{,}$ and $\lim\limits_{x\to 0^-} f(x) = \lim\limits_{x\to 0^-} x^2 = 0$
7. $\lim\limits_{x \to 0^{+}} f(x)$ and $\lim\limits_{x \to 0^{-}} f(x)$ where
$\lim\limits_{x\to 0^+} f(x) = \lim\limits_{x\to 0^+} (-x+1)=1$$\lim\limits_{x\to 0^-} f(x) = \lim\limits_{x\to 0^-} (2x+3)=3$

format: plain


text:
# Convert Valve KV into JSON

Valve's KV file format is as follows (in pseudo-EBNF):

<pair> ::= <text> <value>
<value> ::= <text> | <block>
<text> ::= "\"" <char>* "\""
<block> ::= "{" <pair>* "}"

The parsing starts on <pair> state. Whitespace is allowed anywhere, but is only required between two consecutive <text> tokens ("a""b" is invalid, but "a" "b" is valid, and so is "a"{}).

And since I'm lazy, <char> is any character, except ", unless preceded by \.

You can also see KV as JSON without commas and colons, and with only strings and objects as possible types.

Your task is to write a program or function that converts a input string (stdin, file or argument) in KV to a output string in JSON. You can output anywhere (stdout, file or return value), as long as it's a valid json string.

It isn't necessary to preserve whitespace in the output, as long as quoted text doesn't change.

Standard loopholes apply, of course.

## Bonus

You get a -20 byte bonus if the output is pretty-printed, regardless of input. Pretty printed means indenting each level of blocks with 4 spaces, separating colons from values by 1 space and have one pair per line. Closing braces should stand on their own line.

## Test cases

Input:

"foo" {
"bar" "baz"
"oof" {
"rab" "zab"
}
}

Output:

{
"foo": {
"bar": "baz",
"oof": {
"rab": "zab"
}
}
}

Input:

"obj" {
"emptyo" {}
"troll" "}{"
}

Output:

{
"obj": {
"emptyo": {},
"troll": "}{"
}
}

Input:

"newline" "
"

Output:

{
"newline": "\n"
}

Input:

"key
with_newline" {
"\"escaped\"quotes" "escaped_end\""
}

Output:

{
"key\nwith_newline": {
"\"escaped\"quotes": "escaped_end\""
}
}

• In terms of the EBNF, what does the entire input need to be? Nov 2, 2015 at 23:00
• It's important to note that certain characters must be escaped in JSON strings. Since they aren't escaped in your KV format (I don't know whether your comment about laziness means that they are in the original KV spec), it's important to have some test cases which cover them. Nov 3, 2015 at 7:18
• Also, your spec forces text to contain exactly one char, but all of your examples have texts with multiple chars. What should the spec say? 0 or more chars? 1 or more chars? Nov 3, 2015 at 7:22
• So, when you say any character, do you mean Unicode, ASCII, printable ASCII and newlines, or something else? Nov 3, 2015 at 13:28
• Also, you might want to include some test cases that involve backslashes and escaped double quotes. Nov 3, 2015 at 15:40

{[~]2/{_'{#{1>W<"\u%04x"fe%s}{~J}?}f%':f*',*{}s\*}:J


text:
# Clear header except page numbering

Edit: Due to failure in answer, I will break the problem into two parts -- simple and complex with the intention of being more clear on what the question deals with.

Simple problem:

With respect to the following MWE, is there a way to clear the header from the first page of Appendix, but leaving the horizontal ruler and page number (just like it is for the very first page of Chapter 1)?

\documentclass[12pt, openright, twoside, a4paper, chapter=TITLE, english]{memoir}

\usepackage{lipsum}

\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\normalsize\scshape\bfseries}{\thechapter}{1em}{}
\titleformat{\section}{\normalfont\normalsize\scshape\bfseries}{\thesection}{1em}{}

\usepackage{fancyhdr}
\pagestyle{empty}
\pagestyle{fancy}
\fancyhf{} %... clears all headers and footers
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering
\fancyhead[LO]{\rightmark} %... left-odd page section title
\fancyhead[RE]{\leftmark} %... right-even page subsection title

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------- STANDARD POS-TEXTUAL ELEMENTS ---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-> Create counter for appendix
\newcounter{appendix}
\newcounter{appsection}[appendix]
\newcounter{appsubsection}[appsection]

%-> Change numbering format to capitalized alphabetic
\renewcommand{\theappendix}{\Alph{appendix}}

%-> Create appendix title command
\newcommand{\Appendix}[1]{%
%... make sure an odd blank page will be created for the Bibliography environment
\cleardoublepage

%... increase appendix counter
\refstepcounter{appendix}

%... make sure the appendix pages will be fancy
\fancyhf{} %... clears headers and footers
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering
% \def\thispagestyle##1{}

%-> Format title font and positioning
\rule{0cm}{0cm}\bigskip\vspace{3em}

\noindent
{\scshape\textbf{APPENDIX \theappendix\ -- #1}}

\bigskip\vspace{3em}
}

%-> Create appendix section command
\newcommand{\appsec}[1]{%
\def\appsecname{#1}
\refstepcounter{appsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection\hspace{1em}#1}}

\bigskip
}

%-> Create appendix subsection command
\newcommand{\appsubsec}[1]{%
\refstepcounter{appsubsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection.\theappsubsection\hspace{1em} #1}}

\bigskip
}

%-----> BEGIN DOCUMENT <-----%
\begin{document}

\chapter{This is the first chapter} \thispagestyle{fancy}
\section{This is the first section}
\lipsum[1-5]

\section{This is the second section}
\lipsum[6-10]

\Appendix{This is one appendix} \thispagestyle{fancy}
\lipsum[11-12]

\appsec{This is an appendix section}
\lipsum[13-20]

\end{document}

Complex problem:

This is just an addendum motivated by the suggestive use of built-in \appedix.

The reason I avoid \appendix is that I need a table with different horizontal levels for chapters and appendices. The complete piece of code that attempt to do this is the following:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------- STANDARD POS-TEXTUAL ELEMENTS ---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-> Create counter for appendix
\newcounter{appendix}
\newcounter{appsection}[appendix]
\newcounter{appsubsection}[appsection]

%-> Change numbering format to capitalized alphabetic
\renewcommand{\theappendix}{\Alph{appendix}}

%-> Create the command to start pos-text
\def\startpostext{%
%-> Format title font and positioning
\titleformat{\chapter}{\normalfont\normalsize\scshape\bfseries}{APPENDIX \thechapter\ -- }{0em}{}
}

%-> Create appendix title command
\newcommand{\Appendix}[1]{%
%... make sure an odd blank page will be created for the Bibliography environment
\cleardoublepage

%... make sure the \leftmark and the \rightmark will be printed correctly
% \phantomsection

%... increase appendix counter
\refstepcounter{appendix}

%... mannualy add the appendix to the ToC

%... make sure the appendix pages will be fancy
\fancyhf{}
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering

%-> Format title font and positioning
\rule{0cm}{0cm}\bigskip\vspace{3em}

\noindent
{\scshape\textbf{APPENDIX \theappendix\ -- #1}}
\thispagestyle{empty}

\bigskip\vspace{3em}
}

%-> Create appendix section command
\newcommand{\appsec}[1]{%
\def\appsecname{#1}
\refstepcounter{appsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection\hspace{1em}#1}}

\bigskip
}

%-> Create appendix subsection command
\newcommand{\appsubsec}[1]{%
\refstepcounter{appsubsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection.\theappsubsection\hspace{1em} #1}}

\bigskip
}

Observe here that \addcontentsline{toc}{chapter}{\protect\numberline{}\textbf{APPENDIX \theappendix\ -- #1}} adds the Appendices to the ToC with the desired indentation (horizontal level) ahead of the chapters. In addition, It is labeld, for instance, APPENDIX A -- Appendix title in the ToC.

Summary:

If there is a way of using \appendix that allows me to alter their horizontal level and display in ToC, that is fine.

If there is a way fo using the definition \Appendix as presented here and clear the header (except for horizontal ruler and page number), that is also okay!

What you call "failure in answer" actually is "failure in specifying all requirements at once".

Be that as it may—let's invent our own wheel by means of memoir: ;-)

\documentclass[12pt, openright, twoside, a4paper]{memoir}

\usepackage{lipsum}

%\usepackage{hyperref}

\makepagestyle{mypagestyle}
\makeevenfoot{mypagestyle}{}{}{}
\makeoddfoot{mypagestyle}{}{}{}
\pagestyle{mypagestyle}
\aliaspagestyle{chapter}{mypagestyle}

\makeatletter
\newcommand\chs@mychapterstyle{%
\@chs@def@ult
\chapterstyle{default}%
\setlength{\beforechapskip}{3em}%
\setlength{\afterchapskip}{3em}%
\renewcommand{\printchaptername}{}%
\renewcommand{\chaptitlefont}{\normalfont\normalsize\bfseries}%
\renewcommand{\chapnumfont}{\chaptitlefont}%
\renewcommand{\afterchapternum}{}%
}%
\newcommand\chs@myappendixstyle{%
\@chs@def@ult
\chapterstyle{default}%
\setlength{\beforechapskip}{3em}%
\setlength{\afterchapskip}{3em}%
\renewcommand{\printchaptername}{\chaptitlefont\MakeTextUppercase{\appendixname}~}%
\renewcommand{\chaptitlefont}{\normalfont\normalsize\bfseries}%
\renewcommand{\chapnumfont}{\chaptitlefont}%
\renewcommand{\printchapternum}{\chapnumfont\thechapter~--~}%
\renewcommand{\afterchapternum}{}%
\renewcommand\chaptermark[1]{%
\@setclcnt{chapter}{@memmarkcntra}%
\markboth{%
\ifnum\c@secnumdepth>\c@@memmarkcntra
\if@mainmatter
\@nameuse{chaptermarksn}%
{\@chapapp\ \@nameuse{thechapter}~--~}%
\fi
\fi
##1%
}
}{}%
}%
}%
\makeatother
\chapterstyle{mychapterstyle}%
\newcommand\chapternumberlinetoappendixnumberline{%
\renewcommand\chapternumberline[1]{\MakeTextUppercase{\appendixname}~##1~--~}%
}%

%-----> BEGIN DOCUMENT <-----%
\begin{document}

\tableofcontents*

\chapter{This is the first chapter}
\section{This is the first section}
\lipsum[1-5]

\section{This is the second section}
\lipsum[6-10]

\appendix
\settocdepth{chapter}
\chapterstyle{myappendixstyle}%

\chapter{This is one appendix}
\lipsum[11-12]

\section{This is an appendix section}
\lipsum[13-20]

\end{document}

Page 1:

Page 2:

Page 3:

Page 4:

Page 5:

Page 6:

Page 7:

Page 8:

Page 9:

• Kkkkkk yes @UlrichDiez you are right. I didn't intend to minimize your contribution. But, as my defense, My question was precisely "How to clear header except for the page number and horizontal ruler using the presented MWE as reference". Your solution now works for me. Thank you again and excellent job! :) – Brasil Jun 13 at 15:14
• My contribution is not that relevant. It merely consisted of skimming over the memoir-manual. The point is: The MWE presented in the initial release of your question did not exhibit in whatsoever way the desired appearance for entries within the table of contents. Statements regarding that came with your edit which took place when my first answer was already submitted. As a rule of thumb, when it comes to fiddling/struggling with LaTeX, it is good practice to state all requirements at once in order to avoid the need of (sometimes totally) reworking things... – Ulrich Diez Jun 13 at 15:28
• Sure! I will pay attention next times! Thank you! – Brasil Jun 13 at 19:03


text:
# Tag Info

21

Here's a set of functions that allows to do this. The code uses many ideas found on this site and on other places on the web. It is a bit factorized already so it should be easily reusable. More on YQL and available tables here: https://developer.yahoo.com/yql https://github.com/yql Query test Edit: this API is great also and simple http://www.quandl.com/...

18

Update: Athanassios correctly pointed out that my attempt to set defaults doesn't work. The problem appears to be that the absence of the element from the first list (ad) causes the defaults list to never be checked. A condensed exhibit: ad = {"accept_rate" -> 80, "badge_counts" -> {"bronze" -> 39, "silver" -> 9}}; defaults = {"age" -> ...

17

I separated this project into two parts. The first is to compute the coordinates of the Geohash location. (*Grab the user's geographical location. The location is based on IP address, so it may not be completely accurate. It's usually good enough to get your graticute. You can replace home with with known coordinates in the form {hx, hy} if you like.*) home ...

13

The bug is in the SystemConvertJSONDumptoString[] function which is defined like this: toString[num_?NumberQ, t_Integer] := If[Head[num] === Real && IntegerPart[num] == num, ToString[CForm[N[num]]] ~~ "0", ToString[CForm[N[num]]]] If my guess is correct, the purpose of the ~~ "0" part is to change 1. to 1.0. I am not very familiar with ...

13

I ran into the same issue. Dataset and nested Associations have a structure ideally suited for JSON export, but the JSON exporter only supports lists of rules. Any other type of expression triggers the error you see. Export The workaround is to recursively convert all nested associations to lists of rules. normalAsc[expr_] := expr //. a_Association :>...

10

See Szabolcs answer for the explanation. The number form there needs to be corrected because JSON needs a digit between . and e: Therefore, here the solution: SystemConvertJSONDumptoString[num_?NumberQ, t_Integer] := StringReplace[ToString[CForm[N[num]]], RegularExpression["\\.(($)|(e))"] -> ".0$1"]; For the following input: ExportString[{"a"...

10

You can define your own object and tell Mathematica to interpret it as JSON object. Dummy export to load relevant contexts: In[1]:= ExportString["", "JSON"]; Tell Mathematica to interpret JSONObject symbol as possible head of JSON objects: In[2]:= ClearAll[JSONObject] SystemConvertJSONDump\$JSONObjectHead = JSONObject; Now you can use ...

9

Element as referred to in the documentation are not a JSON elements, but the kind of information you can get from the specified file format. For JSON the elements available is just Data as given by Import["out.json", "Elements"]. For a typical JPEG photo the available elements are: {"Aperture", "BitDepth", "CameraTopOrientation", "ColorMap", \ "...

9

It is possible to get rid of all but one ReplaceAll. First, you need to remember that ReplaceAll tests each Rule in order, so to deal with the missing "badge_counts" condition, you can simply add that to the list, as follows {"display_name", "creation_date", "reputation", "reputation_change_week", "is_employee", "last_access_date", "user_type", "...

9

The result of importing a file in JSON format is a list of rules. For information about ways to use rules, see the documentation for Applying Transformation Rules. Here is an example: data = ImportString["{\"x\":1, \"y\":{\"a\":2, \"b\":[3, 4]}}", "JSON"] (* {"x" -> 1, "y" -> {"a" -> 2, "b" -> {3, 4}}} *) Retrieving a top-level property is ...

8

I don't believe that this is a bug. Here's why: What exactly happens? Export and ExportString will always encode "JSON" as UTF-8. This may be intentional, as UTF-8 is the default encoding for JSON files. From the documentation: Strings in the Wolfram Language are represented in JSON as UTF-8 strings, escaped as required by the JSON standard. ...

7

The reason is that the JSON format is quite limited. It doesn't support arbitrary expressions. You can e.g. see that by trying the folllowing: Export["test.json",someSymbol,"JSON"] You'll get the same error. If your goal is just to pass the expressions around (i.e. on the other side is another Mathematica instance to interpret them), the simplest ...

7

So if you have: file = Import[path] then after the file is not needed: Clear[file] e.g.: In[77]:= MemoryInUse[] file = Import[StringJoin[NotebookDirectory[], "IMG_3025.jpg"]]; MemoryInUse[] Clear[file]; MemoryInUse[] Out[77]= 79593488 Out[79]= 115619864 Out[81]= 79591456

6

The introduction of Assocation brings a powerful new way to handle this problem. Version 10.2 provides for import of JSON as nested associations without use of ToAssociations by using the format "RawJSON".   (* archive data *) ad = {"accept_rate" -> 75, "account_id" -> 395497, "age" -> 41, "badge_counts" -> {"bronze" -> 35, "...

6

The short answer is that, as @FJRA noted in the comment, only certain types are supported. Which types? Enter the long answer. Why the converter behaves as it does Long answer: JSON supports only certain types, and their nested combinations, as defined e.g. here. Mathematica converter maps JSON objects to lists of rules, arrays to lists, strings to strings,...

6

JSON stands for JavaScript Object Notation. In JavaScript, and hence in JSON, the ordering of dictionary keys is not determined, and not meaningful. Thus Mathematica's behaviour is correct. From the JavaScript language specification, An Object is an unordered collection of properties. Each property consists of a name, a value and a set of attributes. ...

6

tl;dr I think it's a memory leak (bug) and you should report it to Wolfram Support (please do!) According to my reading, you were saying that after importing JSON files many times, the kernel memory usage reported by the operating system (or some task manager program) was growing to unreasonable levels. However, the memory usage reported by the kernel ...

5

With Mathematica 10 or later, I recommend converting this data structure to either an Association or a Dataset: asc = Replace[out, r : {__Rule} :> Association[r], {0, Infinity}]; ds = Dataset[asc] Then you can index it with the keys, e.g. asc[["results", 1, "geometry"]] (* <|"location" -> <|"lat" -> 48.35593, "lng" -> 10.89459|>|>...

5

This seems to be a Java heap space error. I encounter this quite often when importing large Excel sheets, though I get a different error message: Import::nojmem. The help page for this error contains instructions that may be useful for you as well. Basically, you increase heap space using the following commands: Needs["JLink"] ReinstallJava[JVMArguments -&...

5

Here's a solution using your example file. Import as RawJSON because this gives us much easier to manipulate associations. json = Import[ "https://raw.githubusercontent.com/d3/d3-plugins/master/graph/data/miserables.json", "RawJSON"] After inspecting the format manually, it's easy to extract vertices: vertices = json[["nodes", All, "name"]] Links ...

4

For newer versions exporting an empty Association does what you want: ExportString[<||>, "JSON"] Newer Versions means >= 10.1, 10.0.x versions did export empty Associations to empty lists, of course the new behavior is a much better match for the distinction of JavaScript empty lists and objects in Mathematica...

4

refering to my answer your other question here is how you can get a table of e.g. coordinates and temperature from your example data (adopt to your needs): url = "http://api.openweathermap.org/data/2.5/find?lat=55.5&lon=37.5&cnt=10"; data = Import[url,"JSON"] //. x : {__Rule} :> Association[x]; Map[ (# @@@ {{"coord","lat"}, {"coord","lon"}, {"...

4

If you know what the JSON you receive looks like your own approach might work well enough. On the other hand JSON might not necessarily contain just nested "Objects" but also arrays, in which case it will cause errors or invalid unevaluated Assocation-expressions if one assumes that every list resulting from the imported JSON is a list of rules (or even has ...

4

Something like this is a good start. I tried to write it in a way to make it easy to expand. ruleListQ[{r__Rule}] = True; (* JSON won't have RuleDelayed *) ruleListQ[_] = False; formatJSON[json_] := Switch[json, _?ruleListQ, (* dictionary *) Column@Replace[json, HoldPattern[a_ -> b_] :> OpenerView[{a, formatJSON[b]}], {1}], _?(ArrayQ[#, _, ...

4

4

If we import the data as text, we can see that it is not valid JSON: json = Import["http://www.google.com/finance/option_chain?q=AAPL&output=json", "Text"]; json // Short (* {expiry:{y:2016,m:3,d:11},expirations... g_id:"22144",underlying_price:102.26} *) The keys are not quoted despite the requirement of the JSON standard. This is a well-known ...

3

Actually this problem is still in Mma 10.2 here is a solution ExportString["Conexión", "JSON"] (* "ConexiÃ\.b3n" *) ExportString["Conexión", "JSON", CharacterEncoding -> "UTF8"] (* "ConexiÃ\.b3n" *) FromCharacterCode[ ToCharacterCode[ExportString["Conexión", "JSON"]], "UTF8"] (* "Conexión" *) ExportString["Conexión", "RawJSON"] (* ...

2

Perhaps this might work to add the zeros after the decimal point: SystemConvertJSONDump`toString[num_?NumberQ,t_Integer]:= StringReplace[ StringReplace[ ToString[CForm[N[num]]], RegularExpression["\\.&"]->".0" ], ".e"->".0e" ] I cannot check, but this seems to comply with the format descriptions provided by hwlau.

2

This is unfortunately not an answer, but an extended comment that outgrew the comment form. In short, this might be a bug in ExportString. I am using Mathematica v. 10.1.0 on Windows 7 - 64 bit. Here's what I tried so far. I tried to export your JSON content to a file, using the same format you proposed. This works just fine. Export["fromExport.json", {...

2

This can be done with Clock. The following will import foo.json every 5 seconds. With[{update = 5}, Dynamic[{foo = Import["~/Desktop/foo.json"], Clock[{1, update, update}, update]}]]

Only top voted, non community-wiki answers of a minimum length are eligible


text:
# Homework Help: Normal component of the acceleration

1. Aug 1, 2010

### Sheen91

1. The problem statement, all variables and given/known data

Given y$$^{2}$$ = 8x$$^{3}$$ + 8x

where x and y are in metres, and y is positive

What is the normal component of the acceleration

When x = 4m, x = 7m/s, x = 2m/s$$^{2}$$

Note : Wasn't sure if it was Calc or Physics, but I was leaning toward Calc, as it is basically Algebra to solve for the answer.

2. Relevant equations

Not sure

3. The attempt at a solution

I understand that "x = 4m, x = 7m/s, x = 2m/s$$^{2}$$" is just "y$$^{2}$$ = 8x$$^{3}$$ + 8x" getting differentiated for each part, first of which doesn't need it.

y$$^{2}$$ = 8x$$^{3}$$ + 8x => y = ($$\sqrt{8x^3 + 8x}$$)

I am just a little lost at "What is the normal component of the acceleration"

Any and all help is greatly appreciated.

Thanks

2. Aug 2, 2010

### Staff: Mentor

These should probably be "... when x = 4m, dx/dt = 7 m/sec, and d^2x/dt^2 = 2m/sec^2. You can't have x being equal to three different quantities with three different units.
Are you sure that you are giving us the exact wording of this problem? It doesn't make much sense to me as you have written it.

3. Aug 2, 2010

### HallsofIvy

If this is not a trajectory in the plane, then the problem makes no sense- there is no "normal component". If it is a trajectory then you need to find the acceleration as the vector $(d^2x/dt^2}\vec{i}+ (d^2y/dt^2)\vec{j}$. Of course, to do that, you have to know the dependence of x and y on t.

Knowing that $y^2= 8x^3+ 8x$ tells you that $2y(dy/dt)= (24x^2+ 8)(dx/dt)$ but uyou still need to know or be able to calculate either dy/dt or dx/dt.

I agree with Mark44- please give the exact wording of the problem. "When x = 4m, x = 7m/s, x = 2m/s2" is impossible.

4. Aug 4, 2010

### Frangecoil

I came across the same question. Sheen has typed the entire question. Only mistake being the repeated x. Which was meant to be x, x' and x''.
I derived the equation twice and subbed in the given x values as i derived to get the corresponding y values. i.e. i solved for y, y' and y". Is this right?
If this is right i still get stuck on how to find the normal component.

5. Aug 4, 2010

### vela

Staff Emeritus
Hint: Since the motion is confined to a plane, the acceleration can be resolved into two components, the tangential component parallel to the velocity and the normal component perpendicular to the velocity.

6. Aug 5, 2010

### Sheen91

***Post removed***

Last edited: Aug 5, 2010
7. Aug 5, 2010

### Sheen91

y² = 8x³ + 8x

2y dy/dt = (24x² + 8) dx/dt

Velocity = sqrt ( (dx/dt)² + (dy/dt)² )

Acceleration = sqrt ( (d²x/dt²)² + (d²y/dt²)² ) = ???? :S (not sure)

2y dy/dt = (24x² + 8) dx/dt

2 d²y/dt² = 48x d²x/dt²

d²y/dt² = 24x d²x/dt²

Therefore:

Acceleration = sqrt ( (d²x/dt²)² + (d²y/dt²)² ) = sqrt( (d²x/dt²)² + (24x . d²x/dt²)² ) = sqrt ( 2² + (24 . 4 . 2)²) = sqrt ( 36868 ) = 192.01 m/s/s

Which doesn't seem right. :S

Can someone look through and see if I did anything wrong. Thank you

PS: I need to find the normal component of the acceleration, so I have yet to start that

Last edited: Aug 5, 2010
8. Aug 5, 2010

### vela

Staff Emeritus
This is good. Come up with numerical answers for what y and y' equal given the information you have about x and x'.

9. Aug 5, 2010

### vela

Staff Emeritus
That's not right. You have to use the product rule.

10. Aug 5, 2010

### Sheen91

Sorry I don't understand how, do I use the product rule in that??

Thanks for all the help so far vela, I really appreciate it

EDIT:
uhmm ohh wait

dy/dx = (dy/dt) / (dx/dt)

2y dy/dt = (24x² + 8) dx/dt

dy/dx = (dy/dt) / (dx/dt) = (24x² + 8) / 2y

d²y/dx² = ( (48x . 2y) - 2(24x² + 8)dy/dx ) / 4y²

I am a little lost.

Last edited: Aug 5, 2010
11. Aug 5, 2010

### Sheen91

y = sqrt (8x³ + 8x) = sqrt (8.4³ + 8.4) = sqrt (544) = 23.324

y' = (24x² + 8) x' / 2y = 58.82

now what?

12. Aug 5, 2010

### Sheen91

I am unsure on how to find the "Normal component of the Acceleration"

Vela can you let me know what to do step by step, rather than just one step at a time. I would really apreciate that.

I also got the numerical values of y and y', and am once again stuck.

Also how do I use the product rule on : 2y dy/dt = (24x² + 8) dx/dt

Have never been taught.

13. Aug 5, 2010

### Sheen91

I think I got it:

Product rule

2y dy/dt = (24x² + 8) dx/dt

(2 dy/dt) . dy/dt + d²y/dt² = (48x . dx/dt) + ( (24x² + 8) . d²x/dt²)

so that means:

d²y/dt² = (48x . dx/dt) + ( (24x² + 8) . d²x/dt²) - (2 dy/dt) . dy/dt

d²y/dt² = -4791.58

That seems very wrong.

Also after you get d²y/dt² and d²x/dt², what do you do? How do you find the normal component?

Last edited: Aug 5, 2010
14. Aug 5, 2010

### vela

Staff Emeritus
You forgot the 2y in front of y''. The RHS looks okay.
You have the two vectors a=axx+ayy and v=vxx+vyy. What you want to do is resolve a into components parallel and perpendicular to v. So how do you find the component of a parallel to v? Hint: Use the dot product.

15. Aug 5, 2010

### Frangecoil

Drawing a vector diagram for this question helps ALOT. It helped me solve it =]


text:
## 9.3.14 Rotation

This DataType is a structure that defines the rotation (or heading) of an object relative to the base coordinate system. The format is ‘yaw, pitch, roll’ as defined for aircraft principal axes. Its composition is formally defined in Table 67.

Table 67 – Rotation Structure

Name Type Description
Rotation Structure Subtype of Structure defined in OPC 10000-5.
Yaw Double The yaw of the object, in the unit defined for rotational measurements, e. g. in radians between PI and –PI (or in deg between +180 and -180). Rotation measured around a vertical axis. Reference (yaw = 0) is the X-axis of the coordinate system
Pitch Double The pitch of the object, in the unit defined for rotational measurements, e. g. in radians between PI and –PI (or in deg between +180 and -180). Rotation measured around a horizontal axis. Reference (pitch = 0) is the direction of the yaw on the horizontal plane of the coordinate system
Roll Double The roll of the object, in the unit defined for rotational measurements, e. g. in radians between PI and –PI (or in deg between +180 and -180). Rotation measured around a horizontal axis pointing in the direction defined by yaw, pitch

Its representation in the AddressSpace is defined in Table 68.

Attribute Value
BrowseName Rotation
IsAbstract False

Subtype of Structure defined in OPC 10000-5.

Table 68 – Rotation Definition


text:
## ML Aggarwal Class 6 Solutions for ICSE Maths Chapter 10 Basic Geometrical Concept Ex 10.1

Question 1.
How many lines can be drawn through a given point?
Solution:
Unlimited number of lines.

Question 2.
How many lines can be drawn through two distinct given points?
Solution:
One

Question 3.
How many lines can be drawn through three collinear points?
Solution:
one

Question 4.
Mark three non-collinear points A, B and C in your note-book. Draw lines through these points taking two at a time and name these lines. How many such different lines can be drawn?
Solution:

lines AB, BC and CA; three.

Question 5.
Use the figure to name :
(i) Five point
(ii) Aline
(iii) Four rays
(iv) Five line segments

Solution:
(i) O, B, C, D, E
(ii) $$\overleftrightarrow { DE, } \overleftrightarrow { DO } ,\overleftrightarrow { DB, } \overleftrightarrow { EO } ,$$ etc.
(iii) $$\overleftrightarrow { DB } ,\overleftrightarrow { DE } ,\overleftrightarrow { OB } ,\overleftrightarrow { OE } ,\overleftrightarrow { EB, }$$ etc.
(iv) $$\overline{\mathrm{DE}}, \overline{\mathrm{DO}}, \overline{\mathrm{EO}}, \overline{\mathrm{OB}}, \overline{\mathrm{EB}}$$, etc.

Question 6.
Use the figure to name:

(i) Line containing point E.
(ii) Line passing through A.
(iii) Line on which point O lies.
(iv) Two pairs of intersecting lines.
Solution:
(i) $$\overleftrightarrow { AE }$$ , etc.
(ii) $$\overleftrightarrow { AE }$$, etc.
(iii) $$\overleftrightarrow { CO } \quad or\quad \overleftrightarrow { OC }$$
(iv) $$\overleftrightarrow { CO } ,\overleftrightarrow { AE } \quad ;\quad \overleftrightarrow { AE } ,\overleftrightarrow { EF }$$

Question 7.
From the given figure, write

(i) collinear points
(ii) concurrent lines and their points of concurrence.
Solution:
(i) A, D, C ; B, D, E.
(ii) l, n, p ; point B and m, p, q ; point A.

Question 8.
In the given figure, write

(i) all pairs of parallel lines.
(ii) all pairs of intersecting lines,
(iii) concurrent lines.
(iv) collinear points.
Solution:
(i) l, m; l, n; m, n
(ii) l, p; m, p; n, p; l, q; m, q; n, q; l, r; m, r; n, r; p, q; p, r; q, r
(iv) A, B, C; A, H, I, D; D, E, F, G; C, I, E; B, H, F.

Question 9.
Count the number of line segments drawn in each of the following figures and name them:

Solution:
(i) $$\overline{\mathrm{AB}}, \overline{\mathrm{AC}}, \overline{\mathrm{AD}}, \overline{\mathrm{BC}}, \overrightarrow{\mathrm{BD}} \text { and } \overline{\mathrm{CD}}$$; Six.
(ii) $$\overline { AB } ,\overline { AE } ,\overline { AC } ,\overline { AD } ,\overline { BC } ,\overline { BE } ,\overline { BD } ,\overline { CD } ,\overline { CE } and\overline { DE }$$; Ten.
(iii) $$\overline { AB } ,\overline { AE } ,\overline { AD } ,\overline { BC } ,\overline { BE } ,\overline { CE, } \overline { CD } or\overline { ED }$$ Eight.

Question 10.
(i) Name all the rays shown in the following figure whose initial points are A, B and C respectively.

(ii) Is ray AB different from ray AD?
(iii) Is ray CA different from ray CE?
(iv) Is ray BA different from ray CA?
(v) Is ray ED different from ray DE?
Solution:
(i) Rays $$\overrightarrow{\mathrm{AB}}, \overrightarrow{\mathrm{AC}}, \overrightarrow{\mathrm{AD}}, \overrightarrow{\mathrm{AE}} ; \overrightarrow{\mathrm{BC}}, \overrightarrow{\mathrm{BD}}$$
$$\overrightarrow{\mathrm{BA}}, \overrightarrow{\mathrm{BE}} ; \overrightarrow{\mathrm{CD}}, \overrightarrow{\mathrm{CB}}, \overrightarrow{\mathrm{CA}}, \overrightarrow{\mathrm{CE}}$$
(ii) No
(iii) No
(iv) Yes.
(v) Yes.

Question 11.
Consider the following figure of line $$\overleftrightarrow { MN }$$. Says whether following statements are true or false in context of the given figure.

(i) Q, M, O, N and P are points on the line $$\overleftrightarrow { MN }$$.
(ii) M, O and N are points on a line segment $$\overline{\mathrm{MN}}$$.
(iii) M and N are end points of line segment $$\overline{\mathrm{MN}}$$ .
(iv) O and N are end points of line segment $$\overline{\mathrm{OP}}$$.
(v) M is a point on the ray $$\overline{\mathrm{OP}}$$.
(vi) M is one of the end points of line segment $$\overline{\mathrm{QO}}$$.
(vii) Ray $$\overrightarrow { OP }$$ is same as ray $$\overrightarrow { OM }$$.
(viii)Ray $$\overrightarrow { OM }$$ is not opposite to ray $$\overrightarrow { OP }$$.
(ix) Ray $$\overrightarrow { OP }$$ is different from ray $$\overrightarrow { QP }$$.
(x) O is not an initial point of ray $$\overrightarrow { OP }$$.
(xi) N is the initial point of $$\overrightarrow { N }$$ and $$\overrightarrow { NM }$$.
Solution:
(i) True.
(ii) True.
(iii) True.
(iv) False.
(v) False.
(vi) False.
(vii) False.
(viii) False.
(ix) True.
(x) False.
(xi) True.


text:
QUESTION

# BUS 308 Ashford Week 5 DQ 2 Quality Control

This archive file of BUS 308 Week 5 Discussion Question 2 Quality Control contains:

Quality Control. Visit the websites on Quality Control (QC) listed in the Required Websites for this week. In addition, locate an article on the Internet or in the Library databases that describes an example of the use of statistics in Quality Control. In your post, briefly define Quality Control and explain its importance. Also, describe some of the most widely used tools in the industry for measuring and controlling quality, emphasizing their relationship to what you have encountered in this class. Finally, explain the example from your article of statistics as applied in a Quality Control context.

• @
• 1 order completed
Tutor has posted answer for $5.19. See answer's preview$5.19


text:
# Why does NASA Horizons say that Earth inclination is not 0 at J2000 epoch?

I'm using NASA Horizons system to get Earth orbital elements with following settings:

Ephemeris Type : ELEMENTS
Target Body :    Earth-Moon Barycenter [EMB] [3]
Center :         Solar System Barycenter (SSB) [500@0]
Time Span :      Start=2000-01-01, Stop=2001-01-01, Step=12 h
Table Settings : output units=KM-S

This is what it says in the output:

Output units    : KM-S, deg, Julian Day Number (Tp)
Output type     : GEOMETRIC osculating elements
Output format   : 10
Reference frame : ICRF/J2000.0
Coordinate systm: Ecliptic and Mean Equinox of Reference Epoch

And here are the orbital elements for the J2000 epoch:

2451545.000000000 = A.D. 2000-Jan-01 12:00:00.0000 TDB
EC= 1.487370652262564E-02 QR= 1.466664481240442E+08 IN= 1.196622093669550E-02
OM= 9.348586355904454E+00 W = 6.534678781572920E+01 Tp=  2451519.451250376645
N = 1.149765722413008E-05 MA= 2.538006615432194E+01 TA= 2.612305949633834E+01
A = 1.488808583174952E+08 AD= 1.510952685109462E+08 PR= 3.131072643603165E+07

So as you can see the inclination is about 0.012° which is not 0 (by the way, same goes both for Earth and Earth-Moon Barycenter). I thought inclination of the Earth orbit in J2000 reference frame must be 0 at J2000 epoch by definition. Could someone clarify this please?

P.S. Now that I think about it and look at this picture my question becomes more like "Why is the inclination not 23.4°?"

• You should ask your second "Now that I think about it" question as a separate question. In fact, in the future it will be much better if you think about it before you ask a question! :-) I hope the answer is helpful to your primary question. – uhoh Oct 16 '16 at 13:31
• It's not 23.4 because Earth's equator has nothing to do with its orbit around the sun. – Russell Borogove Oct 16 '16 at 14:51
• I like @DavidHammen 's answer also. I recommend you accept that one. – uhoh Oct 16 '16 at 17:25

Here's the heart of your problem:

Center :         Solar System Barycenter (SSB) [500@0]

The ecliptic is defined in terms of the Earth's mean (or average) orbit about the Sun at the epoch rather than about the solar system barycenter. Had you instead chosen the Sun as the center you would have found an inclination of 0.000266 degrees (about one arc second) at noon TDB on 1 Jan 20000. Aside: The Earth-Moon barycenter had an inclination of about 0.0001 degrees at that time per the Horizons web site.

There are a number of reasons for that small one arc second discrepancy. One is that JPL's HORIZONS system currently uses the DE431 JPL ephemerides to compute the positions and velocities of solar system bodies. This ephemeris was released in 2014, decades after the J2000.0 frames were defined.

Another reason is the way JPL generates its ephemerides. JPL uses a batch least squares technique to iteratively refine the initial states for an integrated model of the solar system in an attempt to minimize the weighted sum squared error between observations and what this integrated model predicts would be observed. JPL does not release those epoch states. Instead, it releases Chebyshev polynomial coefficients that describe the positions of solar system bodies in something close to a minimum absolute error sense. This is one of the beauties of Chebyshev polynomials; they come very close to the ideal of a minimum absolute error predictor. However, the generator only looks at position; it does not look at velocity. Both position and velocity are needed to compute the osculating orbital elements.

Yet another reason is that those Chebyshev polynomial coefficients are expressed in terms of the ICRF frame rather than an ecliptic frame. A transformation is needed to convert those ICRF positions and velocities to an ecliptic frame. Small numerical errors (e.g., see https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) will creep in while performing those transformations. Other numerical errors will creep in while calculating the inclination. These numerical errors alone explain a good portion of that one arc second discrepancy.

Finally, the transformation from the J2000 Earth mean equator / Earth mean equinox frame (which is very close to the ICRF frame) to the J2000 ecliptic / Earth mean equinox frame was computed using a much older version of JPL's solar system model, and it was done using the integrated model rather than the Chebyshev polynomial coefficients.

First, if you look at the actual data output from the ephemeris, you can see that around the year 2000 the Earth+Moon center of mass (barycenter) is moving in a plane parallel to the ecliptic within a few hundred kilometers. Both the Earth and the Sun slowly drift up and down because the origin of the coordinate system is actually the center of mass of the solar system, and the other planets, Jupiter and Uranus in particular, have to be taken into account.

I never really use those generated orbital elements. They are an approximation - a fit - to the motion of the body at that particular time. You can propagate the motion of the body for a short time using them, but they are not meant to be used to describe long-term motion.

The solar system is a bunch of objects all interacting with each other. The sun is not (really) in the center, and the planets do not (exactly) even orbit around the Sun.

So, for example if you look at the same orbital elements around the Sun instead of around the entire solar system barycenter, you'll see that the inclination drops to 0.0001 degrees. If at all possible, stick to the cartesian (x, y, z) data to avoid having to think about these issues.

above: data from JPL Horizons database. These are the z-coordiantes only - perpendicular to the ecliptic. Units are kilometers. Solid smooth line is the Earth-Moon barycenter. Solid wiggly line is the Earth Geocenter, and dashed line is the sun. TOP: raw z-coordinates, BOTTOM: z-coordinates minus z-coordinates of the Sun.

Away from the year 2000, the Earth is moving up and down once per year relative to the sun. It flattens out around 2000, when the Earth's orbit coincides with the ecliptic by definition.

Here is the python script I used to read the data and make the plot. It's not pretty but it does the job.

import numpy as np
import matplotlib.pyplot as plt

fnames = ['J2000 Earth Barycenter horizons_results.txt',
'J2000 Earth Geocenter horizons_results.txt',
'J2000 Sun horizons_results.txt']

names  = ['Earth_Barycenter', 'Earth_Geocenter', 'Sun']

JDs, positions = [], []

for fname in fnames:

with open(fname, 'r') as infile:

iSOE = [i for i, line in enumerate(lines) if "$$SOE" in line][0] iEOE = [i for i, line in enumerate(lines) if "$$EOE" in line][0]

print iSOE, iEOE, lines[iSOE], lines[iEOE]

lines = [line.split(',') for line in lines[iSOE+1:iEOE]]
JD  = np.array([float(line[0]) for line in lines])
pos = np.array([[float(item) for item in line[2:5]] for line in lines])

JDs.append(JD)
positions.append(pos)

JD = JDs[0]  # assume they are identical

class Obj(object):
def __init__(self, name):
self.name = name

things = []

for name, pos, JD in zip(names, positions, JDs):

thing     = Obj(name)
thing.pos = pos
thing.JD  = JD

things.append(thing)

earth_bary, earth_geo, sun = things

years = 2000. + (JD - JD[1826])/365.2564

if 1 == 1:
fig = plt.figure()

ax1 = plt.subplot(2,1,1)
ax1.plot(years, earth_bary.pos.T[2])
ax1.plot(years, earth_geo.pos.T[2])
ax1.plot(years, sun.pos.T[2], '--')
ax1.set_xlim(1995, 2005)
ax1.get_xaxis().get_major_formatter().set_useOffset(False)

ax2 = plt.subplot(2,1,2)
ax2.plot(years, earth_bary.pos.T[2]-sun.pos.T[2])
ax2.plot(years, earth_geo.pos.T[2]-sun.pos.T[2])
ax2.plot(years, sun.pos.T[2]-sun.pos.T[2], '--')
ax2.set_xlim(1995, 2005)
ax2.get_xaxis().get_major_formatter().set_useOffset(False)

plt.show()
• Thank you! But what about this picture? The XY-plane of J2000 reference frame is equatorial plane, not the ecliptic. Why is inclination not 23.4 deg.? – Anton Gromov Oct 16 '16 at 13:15
• @AntonGromov you should ask that as a separate question instead of adding multiple questions here. There is more than one coordinate system that uses 'J2000' in it's name. There are several of them, and it's a whole different (and substantial) question. – uhoh Oct 16 '16 at 13:22
• @DavidHammen do you have anything constructive to offer? What do you think needs to be improved? – uhoh Oct 16 '16 at 16:47
• @uhoh, see my answer below. – David Hammen Oct 16 '16 at 16:54
• Also relevant: physics.stackexchange.com/questions/188650/… – David Hammen Oct 16 '16 at 17:04


text:
# cechmate.utils.sparse_to_dense¶

cechmate.utils.sparse_to_dense(sparse_bm)[source]

Converts a sparse boundary matrix to a dense boundary matrix.

This is used for visualization and debugging as dense boundary matrices can be easier to read to small matrices. Dense boundary matrices are the default filtration format used in cechmate filtrations.

Parameters

sparse_bm – Sparse boundary matrix.

Returns

dense (np.array) – Square matrix representation of boundary matrix.


text:
Homework Help: Transformation that Preserves Action (Lagrangian Mechanics)

1. Sep 6, 2015

Xyius

Hello, I am stuck on the following problem.

1. The problem statement, all variables and given/known data

Consider the continuous family of coordinate and time transformations (for small $\epsilon$).

$$Q^{\alpha}=q^{\alpha}+\epsilon f^{\alpha}(q,t)$$
$$T= t+\epsilon \tau (q,t)$$

Show that if this transformation preserves the action
$$S=\int_{t_1}^{t_2}L(q,\dot{q},t)dt=\int_{T_1}^{T_2}L(Q,\dot{Q},T)dT$$,
then
$$\frac{\partial L}{\partial \dot{q}^{\alpha}}(\dot{q}^{\alpha}\tau-f^{\alpha})-L\tau$$
is a constant of motion.

2. Relevant equations

I am guessing as to which equations I may need

Extended Noether's Theorem:
$$\Gamma=\sum_{\alpha}\frac{\partial L}{\partial \dot{q}_{\alpha}}\left( \frac{\partial \psi_{\alpha}}{\partial \epsilon} \right)_{\epsilon = 0}-\Psi_{\epsilon = 0} = \text{Constant}$$
Where $\Psi$ is a function in which it's time derivative is the difference between the Lagrangian before and after the transformation (Note that it is possible that the extended Noether's theorem doesn't apply and the normal Noether's theorem is sufficient, I do not know).

The Energy Function:
$$E=\sum_{\beta}\dot{x}_{\beta}\frac{\partial L}{\partial \dot{x}_{\beta}}-L$$

3. The attempt at a solution

So the first thing I think I should do is apply the transformation to the Action. First I need to find $dT$.
$$T= t+\epsilon \tau (q,t) \rightarrow dT=(1+\epsilon \dot{\tau})dt \rightarrow dt=\frac{1}{1-(-\epsilon \dot{\tau})}dT \approx (1-\epsilon \dot{\tau})dT$$
Thus the action is,
$$S'=\int_{t_1+\epsilon \tau(q,t_1)}^{t_2+\epsilon \tau(q,t_2)}L(Q,\dot{Q},T)dT-\epsilon \int_{t_1+\epsilon \tau(q,t_1)}^{t_2+\epsilon \tau(q,t_2)}\tau L(Q,\dot{Q},T)dT.$$
$$S'=\int_{T_1}^{T_2}L(Q,\dot{Q},T)dT-\epsilon \tau L$$
$$S'=S-\epsilon \tau L$$

Thus when applying this transformation, the two actions differ by $\epsilon \tau L$. This seems very similar to Noether's theorem except for that theorem we are talking about Lagrangians and not Actions. However, since the action is just the integral of the Lagrangian, can I assume the same principles apply? In Noether's theorem, we had
$$\frac{\partial L'}{\partial \epsilon}=\frac{d \Psi}{dt}$$
In this case it appears that we have the following,
$$\frac{\partial S'}{\partial \epsilon}=\frac{d \Psi}{dT}=-L\tau$$

Can I therefore make the conjecture that,
$$\Gamma=\sum_{\alpha}\frac{\partial S}{\partial \dot{q}_{\alpha}}\left( \frac{\partial \psi_{\alpha}}{\partial \epsilon} \right)_{\epsilon = 0}-\Psi_{\epsilon = 0} = \text{Constant}$$

However evaluating this I do not get the required answer. :(

2. Sep 6, 2015

Xyius

I have tried a different approach and am still getting stuck.

The change in action up to first order is given by,

$$S'-S=\int_{t_1}^{t_2}\left[ \frac{\partial L}{\partial t}\delta t + \frac{\partial L}{\partial q}\delta q + \frac{\partial L}{\partial \dot{q}}\delta \dot{q}\right]$$
$$S'-S=\int_{t_1}^{t_2}\left[ \frac{\partial L}{\partial t}\epsilon \tau + \frac{\partial L}{\partial q}\epsilon f+ \frac{\partial L}{\partial \dot{q}}\frac{d}{dt}\left( \epsilon f \right)\right]$$

I have tried doing various integration by parts and still cannot seem to get to the correct answer. :(

EDIT:

A little more headway. I can re-write the integrand as the following.
$$\left[ \frac{\partial L}{\partial t}\epsilon \tau + \frac{\partial L}{\partial q}\epsilon f+ \frac{\partial L}{\partial \dot{q}}\frac{d \epsilon}{dt} f + \frac{\partial L}{\partial \dot{q}}\frac{df}{dt} \epsilon \right]$$

$$\left[ \left( \frac{\partial L}{\partial t} \tau + \frac{\partial L}{\partial q} f + \frac{\partial L}{\partial \dot{q}}\frac{df}{dt}\right)\epsilon + \frac{\partial L}{\partial \dot{q}}\frac{d \epsilon}{dt} f \right]$$

$$\left[ \frac{dL}{d\epsilon}\epsilon + \frac{\partial L}{\partial \dot{q}}\frac{d \epsilon}{dt} f \right]$$

I am gettin' there! (I think). The goal is to write the integrand of the same form as the constant of motion. The integrand must be zero for the action to be invariant under the transformation.

Last edited: Sep 6, 2015


text:
INTERACTIVE ANIMATION: THE GAMMA DISTRIBUTION

This animation illustrates the Gamma distribution.

Foreword

In fact, we only illustrate the following special case of the Gamma distribution :

* Let Xi (i = 1, 2, ...n) be n independent exponentially distributed random variables.

Xi ~ Exp()

Denote X the r.v. defined as the sum of the Xi :

X = i Xi

Then X is Gamma distributed with parameters n and :

X ~ Gamma(n, )

For a  proof, see the special case of the Gamma distribution when α is an integer.

This is a special case because α is here constrained to be a positive integer n, while in the general case, it can be any positive real number. The expression for the probability density function is now :

owing to the properties of the Gamma function.

_________________________________________

 The "Book of Animations" on your computer

Upper frame

The n iid exponentially distributed r.v. are simulated by drawing a n-point sample from the single exponential distribution in the upper frame.

Lambda

The value of is just the height of the point where the exponential curve meets the vertical axis (intercept).

Mean

Recall that the mean of the distribution is 1/. It is displayed as a vertical blue line. Change the value of  by sliding the mean with your mouse positioned just over the top of the displayed value of the mean.

Sample size

Adjust n, the sample size, with the "Nb. Points" control buttons.

Lower frame

Gamma distribution

The red curve is the Gamma distribution for the selected values of  and n.

Mean

The mean value is n/, and is displayed as a vertical blue line.

Mode

We leave as an exercise to show that the mode is (n-1)/. It is therefore always less than the mean, as expected from a positively skewed bell-shaped distribution.

Special case n = 1

When n = 1, the Gamma distribution is just the exponential distribution Exp().

Animation

After choosing the values of  and n, click on "Go" and watch the build-up of the histogram of the corresponding Gamma distribution.

Note that in the "Next" mode, the value of X is displayed between the upper and lower frames.

Warning : the horizontal and vertical scales are different in the upper and lower frames.

 Download this Glossary


text:
# RMS contrast of image interpretation

I have two grayscale images, say A and B, and I want to determine, which one is more contrast. For that I'm calculating an RMS contrast as it is described in Wikipedia. The results are about RMS_A = 0.4 and RMS_B = 0.1. Does it mean that image A is more contrast as its gray pixels are nearer to black/white values? How should I interpreter RMS value to determine contrast?

• Are the images of the same scene or can be totally different? – Royi Aug 4 at 5:12

You defined to compute an RMS. I don't know why you choose it, but OK. How can we probe it as a contrast measure? If you are considering images with positive pixel values, and consider that multiplying them by a scale factor $$a>1$$, you extend the range, hence the contrast, or if $$a>1$$, you shrink the range, hence the contrast again. How does the RMS behave? A quick computation should give you an answer.