text:
# Multivariate Distributions, Moments, and Correlations

 P: 13 So if I start with a multivariate distribution f(x,y), I can find the marginal distributions, the conditional probability distributions, all conditional moments, and by the law of iterated expectations, the moments of both X and Y. It seems to me that I should be able to relate the conditional moments in x to the conditional moments in y. Right? This is mainly coming from intuition. To be a bit more clear. If I have a function V(x,t) and it has all the properties of a joint probability distribution, I can begin to describe its shape by finding the conditional moments in X and in T. But it seems like all of the conditional moments in X should be able to recreate the original function V(x,t) just as well as all the conditional moments in T. I was wondering if this makes any sense at all. I'm not all too familiar with statistics, and feel like a huge dilletent Relatedly, if i want to define a covariance or correlation between my two random variables, x and t, but I only know their joint distribution, V(x,t), then is the way to go about it to comput the first two moments of X and T using the law of iterated expectations, and then find the covariance and correlation that way? Sorry, one final thing. Having a probability distribution p(x) is equivalent to having the infinity of moments of that distribution. My question is, how can you rebuild the probability distribution given all the moments? Sorry for my ramblings :) Any help is appreciated.
P: 2,499
 Quote by shaiguy6 But it seems like all of the conditional moments in X should be able to recreate the original function V(x,t) just as well as all the conditional moments in T. I was wondering if this makes any sense at all. I'm not all too familiar with statistics, and feel like a huge dilletent Relatedly, if i want to define a covariance or correlation between my two random variables, x and t, but I only know their joint distribution, V(x,t), then is the way to go about it to comput the first two moments of X and T using the law of iterated expectations, and then find the covariance and correlation that way? Sorry, one final thing. Having a probability distribution p(x) is equivalent to having the infinity of moments of that distribution. My question is, how can you rebuild the probability distribution given all the moments?

I'm not exactly sure what you're after, but if you know f(x,y) and f(x) you can find the conditional expectation of Y from:

$$E(Y|X=x)=\int y \frac{f(x,y)}{f(x)} dy$$

In general, for a random variable X conditional on an event B: E(X|B) is the sum or integral of the products of all possible values of the RV (or function) and the respective conditional probabilities of each.

EDIT: Note the nth moment is $$E(X-x)^n$$, n>1 and the covariance E[(X-x)(Y-y)].
P: 13
 Quote by SW VandeCarr I'm not exactly sure what you're after, but if you know f(x,y) and f(x) you can find the conditional expectation of Y from: $$E(Y|X=x)=\int y \frac{f(x,y)}{f(x)} dy$$ In general, for a random variable X conditional on an event B: E(X|B) is the sum or integral of the products of all possible values of the RV (or function) and the respective conditional probabilities of each. EDIT: Note the nth moment is $$E(X-x)^n$$, n>1 and the covariance E[(X-x)(Y-y)].

yea thanks, so I've been messing around a bit, and I think I've almost got it figured out (just need to make everything pretty for my specific example). But in general, this is what I have:

Given the moments of either conditional distribution functions, you can recreate the characteristic function. Then, to get back the conditional distribution function, you take the inverse fourier transform of the characteristic function. Since we can easily relate each of the conditional distribution functions to eachother, we can then get the conditional distribution function of the other variable, and then we can get the moments from there. This is how the moments are related to eachother. Going from either of the conditional distributions back to the joint distribution is straightfoward enough. If we keep everything in terms of the original moments, we will derive a relationship between the conditional moments and the joint moments (though in general it doesn't look pretty).

P: 2,499
Multivariate Distributions, Moments, and Correlations

 Quote by shaiguy6 Since we can easily relate each of the conditional distribution functions to eachother, we can then get the conditional distribution function of the other variable, and then we can get the moments from there. This is how the moments are related to eachother. Going from either of the conditional distributions back to the joint distribution is straightfoward enough. If we keep everything in terms of the original moments, we will derive a relationship between the conditional moments and the joint moments (though in general it doesn't look pretty).
If I understand you correctly, if you know f(x) and f(y), you can get f(x,y) using the characteristic function. In general, for any two of the above functions you can obtain the third. Moreover, knowing the functions allows you to obtain the moments. However,it sounds like you're trying to get the functions from knowing only the moments. I'm not sure this is true. Obtaining the expectations (the first moments) E(X|Y=y) or E(Y|X=x) analytically requires you know at least two of the three functions.
P: 13
 Quote by SW VandeCarr If I understand you correctly, if you know f(x) and f(y), you can get f(x,y) using the characteristic function. In general, for any two of the above functions you can obtain the third. Moreover, knowing the functions allows you to obtain the moments. However,it sounds like you're trying to get the functions from knowing only the moments. I'm not sure this is true. Obtaining the expectations (the first moments) E(X|Y=y) or E(Y|X=x) analytically requires you know at least two of the three functions.
i actually start with only the joint distribution, f(x,y). Then I am trying to find a relationship relating the moments of the conditional probability f(x|y) to the moments of the conditional probability f(y|x). I'm running into a slight issue taking the inverse Fourier transform of e^k... Other than that I think the algorithm above works perfect. Wait, finding the expectation of the conditionals only requires knowing f(x,y) I thought.

Because for instance if I have f(x,y) given, I can get the conditional by taking $$f(x|y)=\frac{f(x,y)}{\int_{-\infty}^{\infty} f(x,y)dy}$$ THen we can find moments of that in the normal fashion

In other words, the marginal distributions f(y) and f(x) can be directly found from f(x,y), unless I am misinterpreting something.

So we have: $$E[f(Y|X=x)]=\int_{-\infty}^{\infty} y \frac{f(x,y)}{\int_{-\infty}^{\infty} f(x,y)dy} dy$$

 Related Discussions Quantum Physics 5 Set Theory, Logic, Probability, Statistics 11 General Math 1 Calculus & Beyond Homework 3


text:
# Part II: Derivative.

December 9, 2018

### Foreword

In the previous post we started talking about applied mathematics, and touched upon some basic concepts, and today our topic is derivatives.

By the end of XVII century, Isaac Newton discovered laws of mechanics, found the law of universal gravitation and built the mathematical theory, helping reduce "uneven to uniform" and "heterogeneous to homogeneous". Simultaneously with Newton, the German mathematician Gottfried Wilhelm Leibniz was studying how to draw tangents to curves. Independently of each other, almost at the same time, Leibniz and Newton discovered calculus. Leibniz used the notation that turned out to be so convenient, that it is still used to this day.

The new math created by Newton and Leibniz consisted of two major parts: differential and integral calculus. The first part in its basis has a straightforward idea: any small changes in continuous functions can be approximated as linear. The idea of integral calculus is based on the approach of using these small linear approximations to work with some complex, irregularly varying functions.

In this post, I would like to talk only about the two most essential parts of the differential calculus: derivative and differential. To be more precise, we will define the derivative and explain its geometric meaning, find out what the differential is and how it differs from the derivative. We also will be talking about how derivatives work for functions of several variables and will thoroughly consider how all this can be used for real-life applications.

The material will become more difficult from section to section, therefore feel free to skip what you think is unnecessary or too complicated. Further, all the same principles will be used for the notation which were described in the first part of this series of posts. So, let's get started!

#### The Idea and Definition

Nikolai Lobachevsky said: "There is no branch of mathematics, however abstract, which may not some day be applied to phenomena of the real world". So does derivative. The concept of the derivative pervades all modern science, including physics, chemistry, economics and whatever you can imagine, so let's consider the following example. A car moving on a straight road from point $$A$$ to point $$B$$ with a distance of 100 kilometers between them. The question: "What was the average car speed if it finished the trip within 2 hours?" Of course, you have already answered the question: $$\overline{v} = \dfrac{S}{t} = \dfrac{100}{2} = 50$$ km/h. But what if we would like to study the average speed of the car at each point of its path? Well, as you might have guessed, we need to know the car coordinate function $$s(t)$$: the dependency of the coordinate $$s$$ on time $$t$$. Thus, more formally, between any two points $$s_{1},s_{2}$$, where the car was at the moment of time $$t_{1}$$ and $$t_{2}$$ respectively, the average speed can be estimated using the next approximation: $\overline{v} = \dfrac{s_{2} - s_{1}}{t_{2} - t_{1}}$

The smaller the difference between these two time points - the better the above approximation is. So, finally, the instant car speed is becoming equal to the limit: $v(t) = \lim_{\Delta t \rightarrow 0} \dfrac{\Delta s}{\Delta t}$

That was an illustration of how an idea of the derivative had apparently appeared in Newton's mind, when he was studying the laws of kinematics. Therefore, the derivative is just a name for the following limit:

Consider a function $$f \, : \, [a, \, b] \rightarrow \mathbb{R}$$ and a point $$x_{0} \in [a, \, b]$$. If the following finite limit exists: $\lim_{x\rightarrow x_{0}} \dfrac{f(x)-f(x_{0})}{x-x_{0}}$ , then this limit is called the derivative of the function $$f(x)$$ at $$x_{0}$$ and denoted by the prime symbol $$f'(x_{0})$$.

If the above limit exists at each point of the interval $$[a, \, b]$$, then the mapping $$x\mapsto f'(x)$$ appears. This new function is also called the derivative and denoted similarly: $$f'(x)$$.

As you've just noticed, the denominator of the above expression, the argument increment $$\Delta x$$ tends to zero, therefore, for the limit to exist, its numerator must tend to zero as well. It means that $$f(x_{0}) = \lim_{x \to x_{0}} f(x)$$ and this, in turn, guarantees, that the function is continuous at $$x_{0}$$. However, the converse of this fact is false, it just does not work backwards: the fact that the function is continuous does not necessarily lead to the derivative existence. Here is an example: the absolute value function $$|x|$$ at $$0$$.

Using this definition, formulas for all basic function derivatives can be obtained.

#### Geometrical Meaning

Another way to understand what the derivative is and how it works is to consider a geometric example of tangent of curves1.

The figure above depicts the so-called tangent $$\tau$$ and secant $$s$$ lines for some function $$f$$ at some point $$x_{0}$$. There are also shown the increments of the function and argument: $$\Delta f$$ and $$\Delta x$$ respectively.

In the general two-dimensional case, the tangent line equation is represented as follows: $\tau(x)=A(x-x_{0})+B$

Since by the definition of the tangent line $$\tau(x_{0}) = f(x_{0})$$, then, plugging it into the expression above, we get: $$B = f(x_{0})$$. Moreover, using purely geometric considerations, we can calculate the slope coefficient $$A$$ of the secant line: $$A = \tan(\alpha) = (f(x)-f(x_{0}))/(x-x_{0}) = \Delta f / \Delta x$$; this slope is equivalent to the angle $$\alpha$$ that is shown in grey in the figure. The same figure also shows, that in the extreme case, when $$\Delta x \to 0$$, the function increment also tends to zero $$\Delta f \to 0$$. Thus, the ratio between function and argument increments, following the definition, approaches the value of the derivative at $$x_{0}$$: $A \xrightarrow[]{} \lim_{\Delta x\rightarrow 0} \dfrac{\Delta f}{\Delta x} = f'(x_{0})$

Voila! On the two-dimensional plane, the derivative of a function of one variable2 at a point equals to the angle of inclination of the tangent line to this function at that point.

Thus, in the case with the car from the example above, where speed is the derivative of the coordinate function, we have that the instant speed $$v(t)$$ is equal to the slope of the coordinate function $$s(t)$$ at the same moment of time. Consequently, the steeper the slope, the greater the speed.

#### Differential

The concept of the derivative is closely intertwined with the concept of the differential of a function. To understand what the differential is, firstly, it is better to recall what linear mappings are, and, secondly, what a little-o function is.

Let's start from linear mappings. In simple words, it is a generalization of linear function to extend its properties on more domains and objects such a function may operate on. In terms of geometry, linear mappings are those mappings, which stretch and/or rotate vectors, preserving the dot product. Linear mappings are usually denoted as $$L$$. In one-dimensional case, $$L$$ is a linear continuous function $$x \mapsto \alpha \cdot x$$, where $$\alpha \in \mathbb{R}$$ is a number.

What does little-o notation mean? If we have two functions $$f$$ and $$g$$, then $$f$$ is little-o of $$g$$ for $$x \rightarrow x_{0}$$, if $$g$$ decreases much slower then $$f$$, while approaching $$x_{0}$$. This is usually denoted as follows: $$f(x) = o(g(x))$$. Often, mathematicians read it as "$$f$$ is infinitesimal with respect to $$g$$". More formally, the definition is always considered at some point $$x_{0}$$, which belongs to both functions' domains, so the expression $$f(x) = o(g(x))$$ can be easily substituted by the following limit:

$\lim_{x \rightarrow x_{0}} \dfrac{f(x)}{g(x)} = 0 \Leftrightarrow f(x) = o(g(x)),\, x \rightarrow 0$

For instance, $$x^3 = o(x)$$ when $$x \to 0$$. Usually, this notation is used, when functions are being approximated. For example, near zero, sine behaves like a linear function, and this fact might be written like this: $$\sin(x) = x + o(x), \,\, x \rightarrow 0$$. This is it! Now we can move forward to the differential.

The concept of the differential of a function appeared, when mathematicians were trying to strictly define the idea of function differentiability. Under what conditions can we be sure, that some function has the derivative at some point? In fact, after a lot of research, it was shown that in order for a function to have a derivative, it suffices, that it can be linearly approximated at this point. It means that the function should have a tangent at that point. Thus, more formally:

A function $$f \, : \, U(x_{0}) \rightarrow \mathbb{R}$$, defined on some neighborhood of a point $$x_{0} \in \mathbb{R}$$, is called differentiable at this point, if there exists a linear mapping $$L \, : \, \mathbb{R} \rightarrow \mathbb{R}$$, that for the neighborhood $$U(x_{0})$$, the following is correct: $f(x_{0}+h) = f(x_{0}) + L(h) + o(h), \qquad h \rightarrow 0$ , where $$h \in \mathbb{R}$$ is a small argument increment. If such a mapping exists, it is called the differential of the function $$f$$ at the point $$x_{0}$$.

The differential is a function, or more precisely - a linear mapping - and this is extremely important. There are many ways to denote the differential, but I prefer the following one: $$df(x_{0},h)$$. Why? First of all, because it highlights that the differential is a function, and secondly that this function depends on both point and argument increment value. But for brevity, we will use just $$df$$: the shortest and probably the most popular way of doing this.

How is this related to the derivative? There is a theorem, connecting all these three definitions: differential, derivative, and differentiability:

Assume $$f \, : \, [a, \, b] \rightarrow \mathbb{R}$$ and a point $$x_{0} \in [a, \, b]$$. Function $$f(x)$$ has a derivative $$f'(x_{0})$$ at $$x_{0}$$ if and only if there exists the differential $$df$$ (i.e., $$f$$ is differentiable), in so doing, $$df(x_{0},h) \equiv df = f'(x_{0})h$$.

The argument increment $$h$$ is usually considered arbitrary. The differential, being a linear mapping, changes these increments as follows: it stretches them in proportion to the value of the derivative at a given point.

If $$h$$ is small enough and we can neglect the error $$o(h)$$, then the differential of a linear function $$y=x$$ is given by: $$dx \equiv d(y) = d(x) = (x)'h = 1\cdot h$$. Thus, this differential is equal to its argument increment $$h$$. Therefore, the above expression for the differential of an arbitrary function $$f$$ can be easily rewritten: $$df = f'(x)h \Leftrightarrow df = f'(x)dx$$, which is why, sometimes the derivative is denoted by: $f'(x) = \dfrac{df}{dx}$

Although it is not a strict definition and it can lead to the erroneous conclusions, so I do advise you to use this only as a notation and not as a formula. This is how more than 300 hundred years ago the Leibniz's notation appeared.

To summarize, the differential is a linear part of the function increment, connecting it with the argument increment through the derivative of this function: $$df = f'(x)dx$$.

#### Higher-order Derivatives

Of course, it is absolutely fine, being functions, for some derivatives to have their own derivatives as well. The definition of the derivative of an arbitrary order is defined recurrently:

$$n$$-th-order derivative is defined through the $$n-1$$-th derivative, i.e., $$f^{(n)}(x) = (f^{(n-1)})'(x)$$.

For example, for a cubic function $$y = x^{3}$$, its third-order derivative is given by:$$y''' = (x^{3})'''=(3x^{2})''=(6x)'=6$$. In Leibniz's notation $$n$$-th-order derivative symbol is written as follows: $$\dfrac{d^{n}f}{dx^{n}}$$.

Bearing in mind the same logic, one can introduce the concept of the higher-order differential. For example, the second-order differential is defined by the following expression: $d^{2}f(x_{0}) = f''(x_{0})(dx)^{2} = f''(x_{0})dx^{2}, \quad dx^2 \equiv (dx)^2$ Thus, for example, for a linear function $$y = x$$, its second differential equals zero: $$d^{2}y = d^{2}x = 0 \cdot (dx)^{2} = 0$$.

Just like most things in math, higher-order derivatives also carry the physical meaning. For example, in the case of a car, its speed is the derivative of the car's distance function. So, the car's acceleration is the derivative of the speed, that is, the second-order derivative of the distance function. We will discuss that later in this post. Such connections between different concepts are incredibly important for physics. It is also impossible to overemphasize the importance of the second-order derivatives for the convex analysis, where the derivatives can be used, for instance, to determine whether a given function is convex.

#### Multivariable Functions and the Partial Derivatives

The world is not limited only by single-variable functions: many things may depend on many other things. For example, the indoor temperature of your house depends on the outside temperature, the materials of walls, floors, ceilings and so on. Such complex dependencies are called multivariable functions or functions of several variables.

Speaking rigorously:

Consider two Euclidean spaces $$\mathbb{R}^{n}$$ and $$\mathbb{R}^{m}$$. If there exists an open connected set (usually called a region) $$\mathcal{D} \subset \mathbb{R}^{n}$$, then a mapping $$f \, : \, \mathcal{D} \rightarrow \mathbb{R}^{m}$$ is called a multivariable function, that maps each point $$\mathbf{x} \in \mathcal{D}$$ to its $$m$$-dimensional image.

That is, such a function transfers points from the $$n$$-dimensional space to the $$m$$-dimensional one. No more, no less.

• Example 1. Vector function. $$f \, : \, \mathbb{R} \rightarrow \mathbb{R}^{3}:$$ $f: \,\, x \rightarrow \begin{bmatrix} -x\\-x\\x^{2} \end{bmatrix}$
• Example 2. Scalar function. $$f \, : \, \mathbb{R}^{3} \rightarrow \mathbb{R}: \,\, f(x,y,z) = x^{2}+y^{2}+z^{2}$$.
• Example 3. 3D graph. $$f \, : \, \mathbb{R}^{2} \rightarrow \mathbb{R}^{3}:$$ $f: \,\, \begin{bmatrix} x\\y \end{bmatrix} \rightarrow \begin{bmatrix} x\\y\\\sqrt{x^{2}+y^{2}+1} \end{bmatrix}$
• Almost all the definitions/ideas/notations/theorems in single-variable function theory might be applied for the multivariable functions. Moreover, even notation will not change much. For example, all modulus signs $$||$$ should be replaced with the respective Euclidean norm $$\lVert \cdot \rVert$$.

The definition of the derivative for multivariable functions can be introduced through the definition of the partial derivative. Usually, a scalar-valued function $$f \, : \, \mathbb{R}^{n} \rightarrow \mathbb{R}$$ is considered for simplicity. In this context, the word "partial" means that all function arguments are fixed at some point $$\mathbf{x}_{0} = (x_{1}, x_{2}, \dots, x_{n}) \in \mathbb{R}^{n}$$ (multidimensional objects will be further highlighted in bold) except for a single argument $$x_{i}$$, which is changed. Thus, similarly to the single-variable derivative definition, we have:

If the following limit exists: $\lim_{\Delta x_{i} \rightarrow 0} \dfrac{f(x_{1}, \dots , x_{i}, \dots x_{n})-f(x_{1}, \dots,x_{i} + \Delta x_{i} , \dots, x_{n})}{\Delta x_{i}}$ , then this limit is called the derivative of the function $$f(\mathbf{x})$$ at $$\mathbf{x}_{0}$$ with respect to the variable $$x_{i}$$ and denoted by the following symbol: $$\dfrac{\partial f}{\partial x_{i}}$$.

That is, in simple words, the partial derivative is a regular derivative, but computed for the multivariable function, whose arguments are "frozen" except for a single considered variable.

Let's consider function $$f$$ from the above illustration: $f \, : \, (x,y) \mapsto (x,y,\sqrt{x^{2}+y^{2}+1})$

For example, let's assume $$x = 1$$, i.e., "fix" variable $$x$$. Geometrically it means that we need to draw a plane $$x = 1$$. Then, the intersection of that plane and the function surface will "cut out" a curve $$y \mapsto (1,y,\sqrt{y^{2}+2})$$ (the red curve in the figure below). Thus, for the $$y$$-partial derivative of $$f$$, we have to consider a function $$\sqrt{y^{2}+2}$$. For example, at point $$(1,1)$$, this partial derivative is given by: $\dfrac{\partial f}{\partial y} = \left.\dfrac{d(\sqrt{y^{2}+2})}{dy}\right|_{y=1} = \left.\dfrac{y}{\sqrt{y^{2}+2}}\right|_{y=1}=\dfrac{\sqrt{3}}{3}$

Also, partial derivatives can be applied multiple times with respect to different variables; these derivatives are called mixed partial derivatives. Here is an example. Given a scalar-valued function $$f = x^{2} / y$$, the mixed partial derivative with respect to the variables $$x$$ and $$y$$ will be: $\dfrac{\partial^{2} f}{\partial x \partial y} = \dfrac{\partial}{ \partial x} \dfrac{\partial (x^2/y)}{\partial y} = \dfrac{\partial (-x^{2}/y^{2})}{ \partial x} = \dfrac{-2x}{y^{2}}$

#### Differential of a Scalar Function

The question of the differentiability of functions of several variables, as in the one-dimensional case, is connected with the concept of the differential. The sufficient condition for the differentiability might be written as follows:

Assume $$\mathcal{D} \in \mathbb{R}^{n}$$ is a region, where a function $$f \, : \, \mathcal{D} \rightarrow \mathbb{R}$$ is defined. If all first-order partial derivatives exist and they are continuous at $$\mathbf{x}_{0}$$, then this function is differentiable at this point.

However, the necessary condition is the following:

If $$f$$ is differentiable at $$\mathbf{x}_{0}$$, then all partial derivatives of $$f$$ exist, and the function increment can be expressed in the form: $f(\mathbf{x}_{0}+\Delta\mathbf{x})-f(\mathbf{x}_{0})=\underbrace{\sum_{i=1}^{n}\dfrac{\partial f}{\partial x_{i}}(\mathbf{x}_{0}) \Delta x_{i}}_{=df(\mathbf{x}_{0}, \Delta \mathbf{x})} + o(\lVert \Delta \mathbf{x} \rVert), \qquad \Delta \mathbf{x} \rightarrow 0$ In the case when all variables are independent and the argument increment is infinitesimal, then all $$\Delta x_{i} = dx_{i}$$.

By the way, if all partial derivatives of $$f(\mathbf{x})$$ exist at some point $$\mathbf{x}_{0}$$, then this function is called smooth.

In the more general case, when $$\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$$ functions are considered, the differential, being a linear mapping, becomes a matrix operator, represented through the Jacobian matrix, that acts on the argument increment vector $$\Delta \mathbf{x}$$. Thus, it takes $$\Delta \mathbf{x}$$ as input and with some error $$o(\lVert \Delta \mathbf{x} \rVert)$$ produces as output a vector of the function increment: $df_{\mathbf{x}_{0}}: \Delta \mathbf{x} \mapsto \Delta \mathbf{f}$ The way how this transformation is performed also depends on the considered point $$\mathbf{x}_{0}$$:

Moving too fast? Well, let's take a break and try to see how it works in practice. Let's consider as an example function $$f = 1 - 0.2\cdot(x^{2}+y^{2})$$ from the figure above. Since $$f$$ is a $$\mathbb{R}^{2} \rightarrow \mathbb{R}^{3}$$ function, its differential $$df$$ is a $$3 \times 2$$ linear operator: $f \equiv \begin{bmatrix} f_{1} \\ f_{2} \\ f_{3} \end{bmatrix} = \begin{bmatrix} x \\ y \\ 1 - 0.2\cdot(x^{2}+y^{2}) \end{bmatrix} \Rightarrow df = \begin{pmatrix} \frac{\partial f_{1}}{\partial x} & \frac{\partial f_{1}}{\partial y} \\ \frac{\partial f_{2}}{\partial x} & \frac{\partial f_{2}}{\partial y} \\ \frac{\partial f_{3}}{\partial x} & \frac{\partial f_{3}}{\partial y} \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ -0.4x & -0.4y \end{pmatrix}$ $df_{(1,1)} \cdot \Delta \mathbf{x} \equiv df_{(1,1)} \cdot \begin{bmatrix} dx \\ dy \end{bmatrix} = \begin{bmatrix} dx \\ dy \\ -0.4(xdx+ydy) \end{bmatrix}$ What's this about? How should it work? Well, everything is shown in accordance with the definition: the differential, in this particular case, is taking an arbitrary increment vector $$\Delta \mathbf{x} = (dx,dy, 0)$$ from the $$XY$$-plane and maps it onto the tangent space of the surface (hatched gray parallelogram in the figure) made by function $$f$$ in the $$3D$$-space.

During this "mapping", the original vector's direction and initial point are preserved. Why? Because if you take a look at the first two rows of the differential, then you'll see that it has exactly the same $$x$$ and $$y$$ coordinates: $$dx$$ and $$dy$$, whereas the argument increment's $$z$$-component has became non-zero: $$-0.4(xdx+ydy)$$. Thus, for example at $$\mathbf{x}_{0} = (0,1)$$, vector $$(-1,1,0)$$ will be moved and become equal to $$(-1,1,-0.4)$$, and it is the vector that represents an approximation of the function increment $$\Delta \mathbf{f}$$. This is how the differentials work in the general case.

The gradient is a widely spread term, which is used in calculus to represent a scalar-function derivative through all its partial derivatives being collected into a single vector.

Consider a scalar function $$f \, : \, \mathbb{R}^{n} \rightarrow \mathbb{R}$$. If at some point $$\mathbf{x}_{0}\in\mathbb{R}^{n}$$ all its partial derivatives $$\dfrac{\partial f}{\partial x_{i}}$$ exist and they are continuous, then the gradient at point $$\mathbf{x}_{0}$$ of the function $$f$$ is called the following vector: $$(\dfrac{\partial f}{\partial x_{1}}, \dots, \dfrac{\partial f}{\partial x_{n}})$$. This vector is denoted by $$\mathrm{grad}f$$ or $$\nabla f$$.

The scalar multiplication of the function gradient and the argument increment, by definition, will give us an expression for the differential: $$df = \langle \mathrm{grad}f, \Delta \mathbf{x} \rangle$$.

What is the gradient used for? This term was introduced in mathematics at the end of XIX century by the great Scottish physicist J. C. Maxwell. The gradient was used to simplify the description of the so-called scalar fields. The gradient is a handy tool, that might be used for studying different functions. For example - in order to find their extrema - because the gradient computed at each point indicates in its direction the greatest rate of increase of a function.

Let's not change our traditions and consider an example of the vector gradient field for the function $$f = \sqrt{x^{2}+y^{2}+1}$$ defined on a square area $$X\times Y = [-1,1]\times[-1,1]$$:

Here it is seen that starting from the origin $$(0,0)$$, the gradient vectors begin to grow, and they grow faster if they are farther from zero. This growth rate is shown through the norm (length) of the gradient vectors depicted.

#### The Hessian Matrix

There are a few more topics to be covered before proceeding to the conclusion of this post. In this section, I would like to discuss with you another important and undoubtedly convenient mathematical tool. If you need to calculate, for example, the second-order differential of some multivariable function, then it is needed to apply the differential operator to the already calculated first-order, regular differential. In the scalar-valued function case, we have to compute all possible permutations of all partial derivatives: $d^{2}f(\mathbf{x}_{0}) = d(df)(\mathbf{x}_{0}) = \sum_{j=1}^{n}\sum_{i=1}^{n}\dfrac{\partial^{2}f}{\partial x_{j} \partial x_{i}}(\mathbf{x}_{0})\Delta x_{j} \Delta x_{i}$ This expression can be written way simpler using the so-called Hessian matrix: $d^{2}f(\mathbf{x}_{0}) = \Delta \mathbf{x}^{\mathsf{T}} \cdot \mathbf{H}_{\mathbf{x}_{0}} \cdot \Delta \mathbf{x} = [\Delta x_{1}, \dots, \Delta x_{n}] \cdot \left. \begin{pmatrix}\frac{\partial^2f}{\partial x_1^{2}} & \cdots & \frac{\partial^2f}{\partial x_1 \partial x_n} \\ \vdots & \ddots & \vdots \\ \frac{\partial^2f}{\partial x_n \partial x_1} & \cdots & \frac{\partial^2f}{\partial x_n^{2}}\end{pmatrix} \right |_{\mathbf{x}_{0}} \cdot \begin{bmatrix} \Delta x_{1}\\ \vdots\\ \Delta x_{n} \end{bmatrix}$ This is a square-symmetric matrix with the size $$n$$ equal to the number of function's arguments: $$\mathbf{H} \in M_{n}(\mathbb{R})$$. Do not be afraid of all these intricate and intimidating matrix-vector products: it is made just for convenience and brevity. At least, because it is much easier and much more efficient for the computers (or more precisely, algorithms they use) to operate with sets of numbers rather than with each number separately.

Let's take a look at our beloved scalar function from the example 3: $$f = \sqrt{x^{2}+y^{2}+1}$$. Consider this function at the point $$\mathbf{x}_{0}=(1,1)$$. Because $$f$$ uses two arguments, we get $$2 \times 2$$ Hessian matrix3. Usually, arguments $$x_{1}$$ and $$x_{2}$$ are considered as $$x$$ and $$y$$ variables respectively. Thus the hessian is given by: $\mathbf{H}_{(1,1)} = \dfrac{1}{(x^{2}+y^{2}+1)^{3/2}} \cdot \left. \begin{pmatrix}y^2+1 & -xy \\ -xy & x^2+1 \end{pmatrix} \right |_{(1,1)} = \begin{pmatrix}\dfrac{2}{\sqrt{3}} & -\dfrac{1}{\sqrt{3}} \\ -\dfrac{1}{\sqrt{3}} & \dfrac{2}{\sqrt{3}}\end{pmatrix}$ The study of the Hessian matrices at a certain point is useful to determine the extrema of multivariable functions. Let's elaborate on this.

#### Extremum of a Function

Despite all the beauty of the formalism of derivatives, I am deeply convinced that all this should be studied, first of all, as a tool. Furthermore, since the derivative of a function is a measure of the rate of change of this function at each point, the derivative can be used to find the special points of a function: the points at which the function takes its minimum or maximum values, or in other words, the extrema.

Firstly, it'd be useful to have a formal definition of an extremum:

Assume a function $$f \, : \, \mathcal{D} \subset \mathbb{R}^{n} \rightarrow \mathbb{R}$$. Then, this function has a local minimum (or maximum) at some point $$\mathbf{x}_{0} \in \mathcal{D}$$, if there exists a sphere $$S(\mathbf{x}_{0}, \delta)$$ with some radius $$\delta$$, that for any point inside this sphere $$\mathbf{y} \in\mathcal{D} \cap S(\mathbf{x}_{0}, \delta)$$, it is correct, that $$f(\mathbf{y}) \ge f(\mathbf{x}_{0})$$ (or $$f(\mathbf{y}) \le f(\mathbf{x}_{0})$$). Point $$\mathbf{x}_{0}$$ that is either a maximum or minimum is called an extremum.

There exists the necessary (but not sufficient!) condition of a local extremum:

Assume a function $$f \, : \, \mathcal{D} \subset \mathbb{R}^{n} \rightarrow \mathbb{R}$$, which has all its partial derivatives defined and they are continuous4. If $$f$$ has a local extremum at some point $$\mathbf{x}_{0} \in \mathcal{D}$$, then all the partial derivatives are equal to zero: $$\dfrac{\partial f}{\partial x_{i}} = 0 \,\, \forall i$$.

For a single-variable function this statement means, that if some function $$f(x)$$ has an extremum at $$x_{0}$$, then $$f'(x_{0})=0$$. But from the practical perspective, it is the conditions (and not consequences) under which a function may have an extremum is more useful subject to be figured out. Here comes Taylor's theorem to help us: $\Delta f = f(\mathbf{x}_{0} + \Delta \mathbf{x}) - f(\mathbf{x}_{0}) = \nabla f( \mathbf{x}_{0})^{\mathsf{T}} \cdot \Delta \mathbf{x} + \dfrac{1}{2!} \Delta \mathbf{x}^{\mathsf{T}} \cdot \mathbf{H}_{\mathbf{x}_{0}} \cdot \Delta \mathbf{x} + o({\lVert \Delta \mathbf{x} \rVert}^{2})$ Therefore, near the extrema, when all partial derivatives (in accordance with the criterion above) are close to zero, we can assume that: $\Delta f \approx \dfrac{1}{2} \cdot d^{2}f(\mathbf{x}_{0}) = \dfrac{1}{2} \cdot \Delta \mathbf{x}^{\mathsf{T}} \mathbf{H}_{\mathbf{x}_{0}} \Delta \mathbf{x}$ , and it gives us a hint: in order to find the extrema, it is required to study the Hessian matrix behavior... Thanks to mathematicians and their research, it turned out that the hint is correct! There is the necessary and sufficient condition for an extremum:

Assume a function $$f \, : \, \mathcal{D} \subset \mathbb{R}^{n} \rightarrow \mathbb{R}$$ and $$f \in C^{2}(\mathcal{D})$$. Consider the Hessian matrix $$\mathbf{H}_{\mathbf{x}_{0}}$$ of the function $$f$$ at $$\mathbf{x}_{0}\in\mathcal{D}$$: if $$\mathbf{H}_{\mathbf{x}_{0}}$$ is a positive-definite (negative-definite) matrix, then $$\mathbf{x}_{0}$$ is a local minimum (or a maximum). Otherwise, $$\mathbf{x}_{0}$$ is not an extremum.

Sounds confusing? I'm here to help you! So first things first. The basic idea, in fact, is very logical and simple, although it is veiled by the sophisticated definition. If we consider a function near the extremum in a quadratic approximation, then this point is a local minimum if the function behaves similarly to the parabola, and a maximum, if this parabola is inverted. To better understand what is going on, let's take a look at the following example:

For the illustration purposes, it would be great to find all minimums and maximums of the function $$f=x^{2}e^{-x^{2}} + y^{2}e^{-y^{2}} + 1$$ step by step. Firstly, we need to determine the critical points, where the partial derivatives become equal to zero: $\dfrac{\partial f}{\partial x} = 2x(1-x^{2})\cdot e^{-x^{2}} = 0 \Rightarrow x = {-1,0,1}$ $\dfrac{\partial f}{\partial y} = 2y(1-y^{2})\cdot e^{-y^{2}} = 0 \Rightarrow y = {-1,0,1}$ Thus, we have 9 potential extrema at the points where $$x$$ and $$y$$ coordinates can be any number from $$-1,0$$ or $$1$$. The next step is to investigate function behavior near the critical points. To do this, let's firstly calculate the Hessian matrix: $\mathbf{H} = \begin{pmatrix} 2 e^{-x^{2}} (1 - 5 x^{2} + 2 x^{4}) & 0 \\ 0 & 2 e^{-y^{2}} (1 - 5 y^{2} + 2 y^{4}) \end{pmatrix}$ To study this matrix, we can use the definition of the function increment, which we gave earlier, but with a slight reservation: at the critical points linear approximation is not enough, the second-order approximation is needed. Using the expression we've recently gotten for the second-order differential and denoting $$g(x) = 1 - 5x^{2}+2x^{4}$$ for brevity, we finally have: $\Delta f \approx \dfrac{1}{2} \cdot [dx\,\,dy] \cdot \begin{pmatrix}2e^{-x^{2}}g(x) & 0 \\ 0 & 2e^{-y^{2}}g(y) \end{pmatrix} \cdot \begin{bmatrix} dx \\ dy \end{bmatrix} = e^{-x^{2}}g(x)(dx)^{2} + e^{-y^{2}}g(y)(dy)^{2}$ In this way, the quadratic form $$\Delta f$$ is negative-definite, if both $$x=\pm 1$$ and $$y=\pm 1$$, because $$g(\pm 1) = -2$$ and therefore $$\Delta f \approx -2e^{-1}(dx^{2}+dy^{2}) < 0\,\, \forall dx,dy \ne 0$$. Similarly, if $$x = y = 0$$ $$g(0)=1$$, then $$\Delta f$$ is a positive-definite form, and therefore $$\Delta f > 0\,\, \forall dx,dy \ne 0$$.

In accordance with the definition, point $$(0,0)$$ is a local minimum, whereas four points $$(1,1),\,(-1,-1),\,(-1,1),\,(1,-1)$$ are local maximums respectively. At the remaining points $$(0,\pm 1)$$ and $$(\pm 1, 0)$$ we cannot definitely say that $$\Delta f$$ is either positive or negative for all non-zero argument increment values. This means that these points are the so-called saddle points, that is clearly seen in the figure above. It is important to note, that instead of studying the Hessian matrix definiteness, it is possible to directly study how the function increment behaves, depending on the argument increment values. It's exactly what we've done.

All the above considerations are valid only for functions with an infinite domain. If the domain is finite, then in the case when a function has no critical points, the extrema are located at the edge points of the domain. For example, in the case of a linear function $$y=x$$ defined on the positive half-plane $$[0,+\infty)$$, there would be a single global minimum on the left edge of the domain located at $$0$$.

Summarizing the above, we can distinguish the following steps for the algorithm for finding extrema of a function:

1. Calculate the partial derivatives and solve all equations $$\dfrac{\partial f}{\partial x_{i}} = 0$$. If this equation system has a solution, move to the next step.
2. For each critical point $$\mathbf{x}_{j}$$ calculate the Hessian matrix $$\mathbf{H}_{\mathbf{x_{j}}}$$.
3. Having determined the matrix's definiteness using Sylvester's criterion, make a conclusion about the nature of the critical point $$\mathbf{x}_{j}$$.

#### Applications

In general, in addition to the geometric applications, the derivative is used to solve various optimization problems: problems where, under certain conditions, it is necessary to maximize or minimize something: reduce costs, maximize profits, build the most effective rocket nozzle, train neural networks to recognize faces, and many other similar examples. In this section, I want to illustrate, that the derivative is an incredibly powerful tool. Let's start with something simple.

Example 1. Suppose we have enough building material to build a fence of length $$L$$ in order to enclose a rectangular area of your country house's backyard. Of course, like anybody else, you'd like to make this area as large as possible. After all, otherwise you would not have had enough space to have a BBQ, right? So, how can we do that? Firstly, let's label both backyard's sides as $$a$$ and $$b$$. Since we know the expression for the perimeter $$a + b = L/2$$, we have the following expression for the total square: $$S(a) = ab = a(L/2-a)$$. Secondly, we need to maximize this square, using the algorithm above: $$\dfrac{d S}{d a} = 0 \Leftrightarrow L/2 - 2a = 0 \Rightarrow a_{0} = L/4$$. Let's check that critical point for being a maximum: $$\dfrac{d^{2} S}{d a^{2}} = -2 < 0 \Rightarrow a_{0}$$ is a global maximum, perfect! Thus, $$S_{max} = a_{0}(L/2-a_{0}) = L^{2}/16$$, so, to make backyard as large as possible with the limited material for the fence - make it square-formed! Oh, had we all known that in advance...

Example 2. Imagine that a ferry runs between the mainland and the island. The ferry sails with average speed $$v$$. Fuel consumption per hour can be approximated by a quadratic dependence with a fixed proportionality coefficient: $$\alpha v^{2}$$. In addition, within an hour, the ferry spends another $$P$$ dollars for miscellaneous expenses. We need to figure out at what speed the ferry should chose to minimize the expenses per mile. So, total expenses per hour: $$E'=P +\alpha v^{2}$$, then per-mile expenses are: $$E = \dfrac{E'}{v} = \dfrac{P}{v}+\alpha v$$. Let's determine the critical points: $$\dfrac{dE}{dv} = \alpha - \dfrac{P}{v^{2}} = 0 \Rightarrow v_{0} = \sqrt{\dfrac{P}{\alpha}}$$. Now we have to check that it is a global minimum: $$\dfrac{d^{2}E}{dv^{2}}=\dfrac{2P}{v^{3}} > 0$$. Therefore, the second derivative is always positive, at least in our circumstances. Finally, with the optimal speed $$v_{0}$$ average per-hour expenses are equal to $$E'=E'(v_{0})=2P$$, i.e., double miscellaneous expenses. Thus, theoretically the ferry owner has to estimate the value of $$\alpha$$ to make the business more efficient.

If you want something more interesting, take a look at this post for more sophisticated example from physics, where derivatives are widely used.

...

Well, we've finally made it! Thanks for getting to the end and I hope you enjoyed it! As always, if you have any questions or comments, leave them below. In the next, third post, let's talk about integrals.

### Notes

1. The tangent line is a line that passes through a point of the curve and coincides with it at this point up to the first order.
2. Actually, the derivative is a tool for calculation tangents not only in the one-dimensional case: tangent planes, surfaces, and so on are also calculated using the derivatives.
3. The second-order mixed partial derivatives are equal for the function if this function is twice continuously differentiable.
4. Such functions are usually denoted as $$f \in C^{1}(\mathbb{R}^{n})$$.

format: plain


text:
# Thread: Equation of a parabola Given Focus and Directrix

1. ## Equation of a parabola Given Focus and Directrix

Need some help writting a formula for this conic section.

Given: Focus is (1,1) and directrix is y=-x-2

Thanks

2. You can use the distance formula and the formula for the distance from a point to a line.

$\sqrt{(x-1)^{2}+(x-1)^{2}}=\frac{|x+y+2|}{\sqrt{2}}$

Square both sides:

$2(x-1)^{2}=\left(\frac{x+y+2}{\sqrt{2}}\right)^{2}$

Expand and simplify.

3. Originally Posted by galactus
You can use the distance formula and the formula for the distance from a point to a line.

$\sqrt{(x-1)^{2}+(x-1)^{2}}=\frac{|x+y+2|}{\sqrt{2}}$

Square both sides:

$2(x-1)^{2}=\left(\frac{x+y+2}{\sqrt{2}}\right)^{2}$

Expand and simplify.
thanks. Anyone else?

4. Originally Posted by Daddycakes
thanks. Anyone else?
Anyone else for what? Show us what you have done after galactus' post. If you can't get any further than that point, let us know. Be specific!

-Dan

Edit: Actually a slight change is needed here:
$\sqrt{(x-1)^{2}+(x-1)^{2}}=\frac{|x+y+2|}{\sqrt{2}}$

should be
$\sqrt{(x-1)^{2}+(y-1)^{2}}=\frac{|x+y+2|}{\sqrt{2}}$

So
$(x - 1)^2 + (y - 1)^2 = \frac{(x + y + 2)^2}{2}$

-Dan


text:
## Tuesday, November 08, 2011 ... /////

### Australian senate approves carbon tax

The last hurdle has fallen and the smallest continent is on its way to implement – and gradually increase – the masochist carbon [dioxide] tax. (The environmentalists understand neither the difference between carbon and carbon dioxide nor anything else that matters in these matters.)

As I previously discussed, I don't think that the modest price of \$23 per ton of CO2 is enough to visibly hurt the Australian economy; it will subtract less than 1% from the country's growth rate (but every year) and delay the curve of the CO2 emissions – which will continue to grow – by half a year or so.

It's very hard to find a true sentence in the Australian government's pro-carbon-tax ads.

You obviously shouldn't expect any long-term impact on the production of CO2 and surely no impact on temperatures. Europe is running a similar scheme and a result is that the world CO2 emissions during the last year jumped by the greatest amount ever, while Europe had to pay for this stupidity by millions of jobs, anyway. The tax in the country of Oz will only be paid by 500 most productive Australian companies (which include both big companies and medium companies), to emphasize that this is not supposed to be a fair new tax but just another malicious left-wing harassment directed against the successful and useful ones, against those who make sure that Australia isn't a third-world country. Needless to say, everyone, and especially the vulnerable ones, will be a victim at the end.
Another topic: IAEA nuclear report on Iran here (PDF, abstract)
The main purpose of the bill is analogous to the purpose of the Kristallnacht which took place exactly 73 years ago: to increase the self-confidence and arrogance of those who hate the capitalist industrial civilization.

The supporters of the bill – Labor Party members and watermelons – only had 36 votes which was enough to beat 32 votes from all other parties that opposed the bill. According to the Herald Sun poll, 2/3 of the Australian public opposes the tax. The green nuts have already gloriously congratulated themselves. They have also received a happy mail from the Madoff of the carbon schemes, Mr Al Gore: "With this vote, the world has turned a pivotal corner in the collective effort to solve the climate crisis." Oh sure. The world will only turn the pitoval corner when your neck will be reshaped in the same way, Al.

Meanwhile, the Herald Sun also mentions what this exercise means in the real-world terms. Just the state of Victoria has written off 35,000 jobs. Sensible politicians point out that Julia Gillard has no mandate to introduce the tax: she promised that this tax wouldn't be introduced if she were allowed to enter politics. Polls indicate that the left-wing parties will be beaten during the next elections and the carbon [dioxide] farce will be abolished but the episode still shows the "tipping point" connected with the left-wing parties' having over 50 percent in a Parliament: an out-of-control, exponentially growing, self-feeding departure from freedom, democracy, and capitalism always has a nonzero probability to start.


text:
# Error using tufte-book class and biblatex [duplicate]

Possible Duplicate:
Can I use biblatex with Tufte classes?

Although there is a patch for using biblatex in the Tufte classes, it doesn't seem to work for me. First thing is, the hyphenat package produces an error stating that \nohyphens is already defined. Without the hyphenat package this error doesn't occur, but biblatex.sty instead states that \bibhang, \bibfont and \citename are already defined.

I guess the nobib option for tufte-book doesn't work properly and natbib clashes with biblatex. Is this possible? And what can I do?

\documentclass[nobib]{tufte-book}

\usepackage{hyphenat}
\usepackage[
style=authoryear
]{biblatex}
\bibliography{test.bib}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit \parencite{someone1900}.

\printbibliography

\end{document}

Now you were right, I had the wrong tufte-common.def. I fixed that, but now the problem is that obviously the hardwrap package is also required. Since I use ubuntu linux and therefor don't have tlmgr, I installed tufte-latex by hand in the directory /usr/share/texmf/tex/latex, which works for tufte but not for the hardwrap package. So hardwrap has to be put somewhere else, but i don't know where.

Do you have an idea?

The ouput of kpsewhich -var-value TEXMFHOME states that this directory is located in my home directory. But this directory doesn't seem to exist, because I can't change to it: if I want to do that, i.e. change to the directory as it was located by kpsewhich -var-value TEXMFHOME, the system states that this directory doesn't exist.

Is it possible to leave the installation of tufte-latex intact and put the revised tufte-common.def in the directory I want to work in?

## marked as duplicate by Audrey, Marco Daniel, egreg, Joseph Wright♦Apr 20 '12 at 18:01

• There is no support for biblatex. – Marco Daniel Apr 18 '12 at 21:30
• Are you following the solution in this post? It requires use of another tufte-common.def file. – Audrey Apr 18 '12 at 22:24
• hardwrap shouldn't pose any problems if you leave your original installation of tufte-latex and required packages intact. To override the original def file, just save the revised one as $TEXMFHOME/tex/latex/tufte-latex/tufte-common.def, where $TEXMFHOME is the path returned by kpsewhich -var-value TEXMFHOME. – Audrey Apr 20 '12 at 13:21
• Don't ever install stuff yourself into directories managed by your package manager (in this case /usr/share/. This is a Really Bad Idea (TM). – cfr Feb 14 '14 at 3:38


text:
Software for unsupervised deep architectures

Get uncomplicated access to unsupervised deep neural networks, from building their architecture to their training and evaluation

Get started

## How to install

In order to develop Ruta models, you will need to install its dependencies first and then get the package from CRAN.

### Dependencies

Ruta is based in the well known open source deep learning library Keras and its R interface, which is integrated in Tensorflow. In order to install them easily, you can use the keras::install_keras() function. Depending on whether you want to use the system installation, a Conda environment or a Virtualenv, you may need to call use_condaenv() or use_virtualenv() from reticulate.

Another straightforward way to install these dependencies is to use global system-wide (sudo pip install) or user-wide (pip install --user) installation with pip. This is generally not recommended unless you are sure you will not need alternative versions or clash with other packages. The following shell command would install all libraries expected by Keras:

\$ pip install --user tensorflow tensorflow-hub tensorflow-datasets scipy requests pyyaml Pillow h5py pandas pydot

Otherwise, you can follow the official installation guides:

Check whether Keras is accesible from R by running:

keras::is_keras_available() # should return TRUE

### Ruta package

From an R interpreter such as the R REPL or the RStudio console, run one of the following commands to get the Ruta package:

# Just get Ruta from the CRAN
install.packages("ruta")

# Or get the latest development version from GitHub
devtools::install_github("fdavidcl/ruta")

All R dependencies will be automatically installed. These include the Keras R interface and purrr.

## First steps

The easiest way to start working with Ruta is to use the autoencode() function. It allows for selecting a type of autoencoder and transforming the feature space of a data set onto another one with some desirable properties depending on the chosen type.

iris[, 1:4] |> as.matrix() |> autoencode(2, type = "denoising")

Ruta provides the functionality to build diverse neural architectures (see autoencoder()), train them as autoencoders (see train()) and perform different tasks with the resulting models (see reconstruct()), including evaluation (see evaluate_mean_squared_error()). The following is a basic example of a natural pipeline with an autoencoder:

library(ruta)

# Shuffle and normalize dataset
x <- iris[, 1:4] |> sample() |> as.matrix() |> scale()
x_train <- x[1:100, ]
x_test <- x[101:150, ]

autoencoder(
input() + dense(256) + dense(36, "tanh") + dense(256) + output("sigmoid"),
loss = "mean_squared_error"
) |>
make_contractive(weight = 1e-4) |>
train(x_train, epochs = 40) |>
evaluate_mean_squared_error(x_test)

For more details, see other examples and the documentation.


text:
## liamschumm one year ago How do I find $\cot10^\circ\cot30^\circ\cot50^\circ\cot70^\circ$? (please give me small hints, do not do the problem for me)

1. alekos

cot10 = cos10/sin10 Are you allowed to use a calculator?

2. liamschumm

No, and I know the definition of cot.

3. liamschumm

I tried using product to sum, but I did not get very far.

4. alekos

It would not be easy lets start with sin30 = sin(20+10) = sin20cos10 + cos20sin10 = 2sin10cos10cos10 + [1-2sin^2(10)]sin10

5. liamschumm

Oh...

6. alekos

eventually we would get sin30 = 3sin10 - 4sin^3(10) which we would need to solve by making x = sin10 so we get 3x - 4x^3 = 1/2

7. liamschumm

Oh, and $sin^2 x =1 - cos^2 x.$

8. alekos

yes. i actually used cos^2x = 1 - sin^2x I'll leave it to you to solve the cubic

9. liamschumm

Hmm... I do not think this is how this problem is supposed to be solved in my class... We have been covering formulas and manipulations of trig functions.

10. alekos

Yeah you're probably right. that's the only thing I can think of at the moment. There must be a more efficient way of doing this. let me get back to you

11. liamschumm

Ok, thanks anyways!

12. anonymous

$\cot 10\cot 30\cot 50\cot 70=\cot 10*\frac{ \cos 30 }{ \sin 30 }\cot 50\cot 70$ $=\frac{ \frac{ \sqrt{3} }{ 2 } }{ \frac{ 1 }{ 2 } }\left( \cot 70\cot 10 \right)\cot 50$

13. liamschumm

Ok, gotten that far.

14. anonymous

$\frac{2 \cos 70\cos 10 }{ 2\sin 70\sin 10 }=$ $\cos \left( A-B \right)+\cos \left( A+B \right)=2\cos A \cos B$

15. anonymous

$\cos \left( A-B \right)-\cos \left( A+B \right)=2\sin A \sin B$

16. liamschumm

So we have $\frac{\cos 60 + \cos 80}{\cos 60 - \cos 80},$ right?

17. anonymous

$\frac{ 1+2\cos 80 }{ 1-2\cos 80 }*\frac{ \cos 50 }{ \sin 50 }$

18. alekos

where to now?

19. alekos

I can't seem to find any way to simplify using trig identities, so we might have to go back to determining the value of each term

20. liamschumm

Oh, got it.

21. liamschumm

Using cos60+cos80 / cos60−cos80, like I said above. Thanks all!

22. alekos

We use a little known identity tanx*tan(60-x)*tan(60+x) = tan(3x) cot(10)*cot(30)*cot(50)*cot(70) = tan(80)*tan(60)*tan(40)*tan(20). Now tan(60) = sqrt(3), so we get = sqrt(3) * tan(20)*tan(40)*tan(80). Now use the identity tan(x)*tan(60 - x)*tan(60 + x) = tan(3x). and with x = 20 degrees we have tan(20)*tan(40)*tan(80) = tan(3*20) = tan(60) = sqrt(3), and so = sqrt(3)*sqrt(3) = 3.

23. alekos

I can show you the proof of the identity if you wish

24. anonymous

$2\cos 80\cos 50=\cos \left( 80+50 \right)+\cos \left( 80-50 \right)=\cos 130+\cos 30$ $=\cos \left( 180-50 \right)+\frac{ \sqrt{3} }{ 2 }=-\cos 50+\frac{ \sqrt{3} }{ 2 }$

25. alekos

@surjithayer i don't know why you posted that?

26. anonymous

$\cos 50+2\cos 80\cos 50=\cos 50-\cos 50+\frac{ \sqrt{3} }{ 2 }=\frac{ \sqrt{3} }{ 2 }$ i have solved the numerator . Similarly you can solve denominator.

27. alekos

but then the denominator comes out to be 2cos50 - sqrt3/2 doesnt get you anywhere

28. anonymous

$2 \cos 80\sin 50=\sin \left( 80+50 \right)-\sin \left( 80-50 \right)$ $=\sin 130-\sin 30=\sin \left( 180-50 \right)-\frac{ 1 }{ 2 }=\sin 50-\frac{ 1 }{ 2 }$ $\sin 50-2\cos 80\sin 50=\sin 50-\sin 50+\frac{ 1 }{ 2 }=\frac{ 1 }{ 2 }$

29. anonymous

$\sin \left( A+B \right)-\sin \left( A-B \right)=2 \cos A \sin B$

30. alekos

Yes. Thats a very sleek way of doing it and relies on the known trig identities. I prefer your method

31. anonymous

thank you


text:
Please use this identifier to cite or link to this item: http://hdl.handle.net/2381/32123
DC FieldValueLanguage
dc.contributor.authorErlebach, Thomas-
dc.contributor.authorHoffmann, Michael-
dc.contributor.authorKammer, F.-
dc.contributor.editorSpeckmann, B.-
dc.contributor.editorKobayashi, N.-
dc.date.accessioned2015-05-07T09:24:41Z-
dc.date.available2016-06-20T01:45:07Z-
dc.date.issued2015-06-20-
dc.identifier.citationProceedings of the 42nd International Colloquium on Automata, Languages, and Programming, Lecture Notes in Computer Science Volume 9134, 2015, pp. 444-455 (12)en
dc.identifier.isbn978-3-662-47671-0-
dc.identifier.issn0302-9743-
dc.identifier.urihttp://hdl.handle.net/2381/32123-
dc.description.abstractA temporal graph is a graph in which the edge set can change from step to step. The temporal graph exploration problem TEXP is the problem of computing a foremost exploration schedule for a temporal graph, i.e., a temporal walk that starts at a given start node, visits all nodes of the graph, and has the smallest arrival time. We consider only temporal graphs that are connected at each step. For such temporal graphs with $n$ nodes, we show that it is $\NP$-hard to approximate TEXP with ratio $O(n^{1-\epsilon})$ for any $\epsilon>0$. We also provide an explicit construction of temporal graphs that require $\Theta(n^2)$ steps to be explored. We then consider TEXP under the assumption that the underlying graph (i.e. the graph that contains all edges that are present in the temporal graph in at least one step) belongs to a specific class of graphs. Among other results, we show that temporal graphs can be explored in $O(n^{1.5}k^2\log n)$ steps if the underlying graph has treewidth $k$ and in $O(n\log^3 n)$ steps if the underlying graph is a $2\times n$ grid. Finally, we show that sparse temporal graphs with regularly present edges can always be explored in $O(n)$ steps.en
dc.language.isoenen
dc.publisherSpringer Berlin Heidelberg-
dc.rightsThe final publication is available at Springer via http://dx.doi.org/10.1007/978-3-662-47672-7_36-
dc.subjectinapproximabilityen
dc.subjectplanar graphsen
dc.subjectbounded treewidthen
dc.subjectregularly present edgesen
dc.subjectirregularly present edgesen
dc.titleOn Temporal Graph Explorationen
dc.typeConference Paperen
dc.identifier.doi10.1007/978-3-662-47672-7_36-
dc.description.statusPeer-revieweden
dc.description.versionPost-printen
dc.description.presentedICALP, Kyotoen
dc.date.end2015-07-10-
dc.date.start2015-07-06-
pubs.organisational-group/Organisationen
pubs.organisational-group/Organisation/COLLEGE OF SCIENCE AND ENGINEERINGen
pubs.organisational-group/Organisation/COLLEGE OF SCIENCE AND ENGINEERING/Department of Computer Scienceen
dc.identifier.eisbn978-3-662-47672-7-
Appears in Collections:Conference Papers & Presentations, Dept. of Computer Science

Files in This Item:
File Description SizeFormat


text:
Image under an entire function.

Let $f$ be an entire function and $B$ be a bounded open set in $\mathbb {C}$. Prove that boundary of image of $B$ under $f$ is contained in image of boundary of $B$. Does the same result is true for unbounded open set in $\mathbb C.$

If $f$ is constant it is clear. Assume it is non-constant.
Then by the open mapping theorem it is open. Therefore, interior points of $B$ are mapped to interior points of $f(B)$. Hence, boundary points of $f(B)$ can only be image of boundary points of $B$. In fact, if $w\in\partial f(B)$ there is a sequence $w_n=f(z_n)$ with $z_n\in B$ such that $w_n\to w$. Since $B$ is bounded $z_n$ have an accumulation point $z$, which must be in the boundary of $B$.
For the unbounded case we can consider $B=\{z\in\mathbb{C}:\ -2\pi<Im(z)<2\pi\}$ and $f(z)=e^z$.
Then $f(B)$ is equal to the $\mathbb{C}\setminus\{0\}$.
The origin is a boundary point of $f(B)$. But $e^z$ doesn't map any point of the plane to the origin, and in particular no point of the boundary of $B$.


text:
version: 1.10

## package tabwriter

import "text/tabwriter"

## Overview

Package tabwriter implements a write filter (tabwriter.Writer) that translates
tabbed columns in input into properly aligned text.

The package is using the Elastic Tabstops algorithm described at
http://nickgravgaard.com/elastictabstops/index.html.

The text/tabwriter package is frozen and is not accepting new features.

Example:

// Observe how the b's and the d's, despite appearing in the// second cell of each line, belong to different columns.w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, '.', tabwriter.AlignRight|tabwriter.Debug)fmt.Fprintln(w, "a\tb\tc")fmt.Fprintln(w, "aa\tbb\tcc")fmt.Fprintln(w, "aaa\t") // trailing tabfmt.Fprintln(w, "aaaa\tdddd\teeee")w.Flush()// output:// ....a|..b|c// ...aa|.bb|cc// ..aaa|// .aaaa|.dddd|eeee

Example:

// Observe that the third line has no trailing tab,// so its final cell is not part of an aligned column.const padding = 3w := tabwriter.NewWriter(os.Stdout, 0, 0, padding, '-', tabwriter.AlignRight|tabwriter.Debug)fmt.Fprintln(w, "a\tb\taligned\t")fmt.Fprintln(w, "aa\tbb\taligned\t")fmt.Fprintln(w, "aaa\tbbb\tunaligned") // no trailing tabfmt.Fprintln(w, "aaaa\tbbbb\taligned\t")w.Flush()// output:// ------a|------b|---aligned|// -----aa|-----bb|---aligned|// ----aaa|----bbb|unaligned// ---aaaa|---bbbb|---aligned|

## Constants

const (    // Ignore html tags and treat entities (starting with '&'    // and ending in ';') as single characters (width = 1).    FilterHTML uint = 1 << iota     // Strip Escape characters bracketing escaped text segments    // instead of passing them through unchanged with the text.    StripEscape     // Force right-alignment of cell content.    // Default is left-alignment.    AlignRight     // Handle empty columns as if they were not present in    // the input in the first place.    DiscardEmptyColumns     // Always use tabs for indentation columns (i.e., padding of    // leading empty cells on the left) independent of padchar.    TabIndent     // Print a vertical bar ('|') between columns (after formatting).    // Discarded columns appear as zero-width columns ("||").    Debug)

Formatting can be controlled with these flags.

const Escape = '\xff'

To escape a text segment, bracket it with Escape characters. For instance, the
tab in this string “Ignore this tab: \xff\t\xff” does not terminate a cell and
constitutes a single character of width one for formatting purposes.

The value 0xff was chosen because it cannot appear in a valid UTF-8 sequence.

## type Writer¶

type Writer struct {    // contains filtered or unexported fields}

A Writer is a filter that inserts padding around tab-delimited columns in its
input to align them in the output.

The Writer treats incoming bytes as UTF-8-encoded text consisting of cells
terminated by horizontal (‘\t’) or vertical (‘\v’) tabs, and newline (‘\n’) or
formfeed (‘\f’) characters; both newline and formfeed act as line breaks.

Tab-terminated cells in contiguous lines constitute a column. The Writer inserts
padding as needed to make all cells in a column have the same width, effectively
aligning the columns. It assumes that all characters have the same width, except
for tabs for which a tabwidth must be specified. Column cells must be
tab-terminated, not tab-separated: non-tab terminated trailing text at the end
of a line forms a cell but that cell is not part of an aligned column. For
instance, in this example (where | stands for a horizontal tab):

aaaa|bbb|daa  |b  |dda   |aa  |cccc|eee

the b and c are in distinct columns (the b column is not contiguous all the
way). The d and e are not in a column at all (there’s no terminating tab, nor
would the column be contiguous).

The Writer assumes that all Unicode code points have the same width; this may
not be true in some fonts or if the string contains combining characters.

If DiscardEmptyColumns is set, empty columns that are terminated entirely by
vertical (or “soft”) tabs are discarded. Columns terminated by horizontal (or
“hard”) tabs are not affected by this flag.

If a Writer is configured to filter HTML, HTML tags and entities are passed
through. The widths of tags and entities are assumed to be zero (tags) and one
(entities) for formatting purposes.

A segment of text may be escaped by bracketing it with Escape characters. The
tabwriter passes escaped text segments through unchanged. In particular, it does
not interpret any tabs or line breaks within the segment. If the StripEscape
flag is set, the Escape characters are stripped from the output; otherwise they
are passed through as well. For the purpose of formatting, the width of the
escaped text is always computed excluding the Escape characters.

The formfeed character acts like a newline but it also terminates all columns in
the current line (effectively calling Flush). Tab- terminated cells in the next
line start new columns. Unless found inside an HTML tag or inside an escaped
text segment, formfeed characters appear as newlines in the output.

The Writer must buffer input internally, because proper spacing of one line may
depend on the cells in future lines. Clients must call Flush when done calling
Write.

### func NewWriter¶

func NewWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer

NewWriter allocates and initializes a new tabwriter.Writer. The parameters are
the same as for the Init function.

### func (*Writer) Flush¶

func (b *Writer) Flush() error

Flush should be called after the last call to Write to ensure that any data
buffered in the Writer is written to output. Any incomplete escape sequence at
the end is considered complete for formatting purposes.

### func (*Writer) Init¶

func (b *Writer) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer

A Writer must be initialized with a call to Init. The first parameter (output)
specifies the filter output. The remaining parameters control the formatting:

minwidth    minimal cell width including any paddingtabwidth    width of tab characters (equivalent number of spaces)padding        padding added to a cell before computing its widthpadchar        ASCII char used for padding        if padchar == '\t', the Writer will assume that the        width of a '\t' in the formatted output is tabwidth,        and cells are left-aligned independent of align_left        (for correct-looking results, tabwidth must correspond        to the tab width in the viewer displaying the result)flags        formatting control

Example:

w := new(tabwriter.Writer)// Format in tab-separated columns with a tab stop of 8.w.Init(os.Stdout, 0, 8, 0, '\t', 0)fmt.Fprintln(w, "a\tb\tc\td\t.")fmt.Fprintln(w, "123\t12345\t1234567\t123456789\t.")fmt.Fprintln(w)w.Flush()// Format right-aligned in space-separated columns of minimal width 5// and at least one blank of padding (so wider column entries do not// touch each other).w.Init(os.Stdout, 5, 0, 1, ' ', tabwriter.AlignRight)fmt.Fprintln(w, "a\tb\tc\td\t.")fmt.Fprintln(w, "123\t12345\t1234567\t123456789\t.")fmt.Fprintln(w)w.Flush()// output:// a    b    c    d        .// 123    12345    1234567    123456789    .////     a     b       c         d.//   123 12345 1234567 123456789.

### func (*Writer) Write¶

func (b *Writer) Write(buf []byte) (n int, err error)

Write writes buf to the writer b. The only errors returned are ones encountered
while writing to the underlying output stream.


text:
We’re rewarding the question askers & reputations are being recalculated! Read more.

# Tag Info

## Hot answers tagged fsk

12

To restate your problem, you have a input signal in the frequency range of 3960-4040 Hz, and want to determine this frequency on the fly. Many microcontrollers can do this quite simply. The highest frequency of interest is 4.04 kHz, which has a period of 248 µs. That's a "long" time for even a small and cheap micro. At the other end, 1/3.96kHz = ...

6

A very simple but elegant approach to demodulate FSK is a delay and multiply. (Followed by a simple low pass filter). This is a non-coherent FM detector using the principal that the output of a multiplier is proportional to the phase of the two inputs. An XOR gate can be used as a such a multiplier. On its own it, a multiplier or XOR gate is a phase detector,...

5

With FSK the receiver locks on to the carrier frequency. You tune it in to that frequency, and a PLL locks on to it. As the carrier frequency changes so the PLL has to change to compensate. That change that it has to make is basically the demodulation and is output as the resultant signal for you to use. The receiver will, of course, have a finite range ...

5

I thought about amplifying the signal to generate harmonics, from which I will then filter out the frequencies I need. Harmonics are always multiples of the base frequency so you'd get 27 MHz, 54 MHz, 81 MHz etc... That's pretty useless for FSK modulation. For proper FSK modulation at 27 MHz you should be using something like 10 kHz or 100 kHz distance so ...

4

FSK is difficult to visualize as you increase in order. The reason for this is when you are using FSK, you have orthogonal frequencies that essentially add an extra dimension to your plane. You can visualize up to 3d (3 frequencies) as shown below (pardon the hand paint drawing), but once you get greater then that FSK just can't be represented this way. ...

3

In terms of an I/Q constellation diagram (i.e. a phasor or real/imaginary diagram), any frequency deviation from the center frequency would result in the IQ vector rotating around in a circle, with the speed of rotation being proportional to the frequency deviation. Essentially, the phase offset relative to your carrier/local oscillator would be continuously ...

3

There's a lot of approaches for decoding FSK. Zero-crossing detection will be pretty sensitive to noise. At these low rates, you don't have to worry. Every milkcan these days has enough compute power to do that. You can simply have one filter for each of your FSK symbol frequencies, and push through your receive signal, then have a conversion from value to ...

3

R1 is needed for the android device to recognize that there is something connected to the earphone port. R3 and R2 are a voltage divider to reduce the signal level from the arduino to a level that the android device can accept. It reduces the level at a ratio of 5 to 1 (5V from the arduino would give 1V in to the android. C1 is used because the android uses ...

3

I would think that the easiest way and quickest way to note the frequency shift of the input signal is to simply measure it directly!! Here is what I would do. Provide for a digital signal levels version of your signal. If the signal is some low level sinusoid or similar this may require some amplification and then squaring of the signal to digital signal ...

2

The signal spectrum only extends up to 4.04kHz, so 40kHz will be more than enough as explained by the Nyquist Theorem. Note that the sampling interval resolution does not limit the frequency resolution you can detect in the signal unless you are quantising it at 1-bit. As long as the quantisation errors do not swamp your signal, twice the highest frequency ...

2

Yes, this is how V21 low-speed modems work. Here's a good short description and example implementation from TI. (The fastest available wired communications links just send raw unmodulated bit edges, possibly with varying threshold voltages).

2

It's an old thread but in case you are still working on this, or anyone else is interested, there are 2 examples of completed Software based PSTN Telephone Caller ID projects here: https://forum.arduino.cc/index.php?topic=528459.0 or https://forum.arduino.cc/index.php?topic=490392.0 Both use a software AFSK demodulator to interpret the CLIP information ...

2

Two of the line look like they will carry the signal that you're after, the ones that connect to the topr-right corner of the IC with the series resistor and capacitor, but you cannot/shouldn't connect them straight to you PC without: knowing the expected signal levels of the signal you are interested in, the inputs must happily accept the signal levels; ...

2

To one way of quickly looking at it, R3 and R2 form a resistive divider which limits the amplitude of the output to something which will not excessively overdrive the microphone input. C1 is a DC-blocking or AC-coupling capacitor which passes only change in the signal level, while removing offset in its average, or DC voltage. This is quite normal when ...

2

An eye diagram shows amplitude against time but FSK has nominally constant amplitude and carries zero amplitude information. Apart from that, an eye diagram is used for the raw data and not a carrier modulated by data. A constellation diagram pin points regularities in amplitude and phase but FSK uses two frequencies therefore the phase relationship is lost ...

2

Some thoughts but certainly not a full design: - The modulator is a lot simpler than the demodulator. For each data bit, the number of oscillation cycles is as follows: - Bit = high, number of clock cycles is 4.516 MHz divided by 564.48 k = 8.0 cycles Bit = low, number of clock cycles is 3.951 MHz divided by 564.48 k = 7.0 cycles So, for the modulator, ...

2

Well, if you can stabilize the PLL a bit more this is going to provide better pay-back when it comes to recovering the data but, in the absense of any improvement, you could try passing the signal through a high pass filter that has a cut-off close to the data rate frequency. It should remove the lower frequency up-and-down wobble (to a large extent) but ...

2

FSK is frequency Shift Keying, a fancy way of saying the data is transmitted by frequency modulating a fixed carrier frequency. But this is not the same as FM. In FSK the shift is in discrete steps above and below the carrier frequency. In the center point is the main carrier frequency, which is xtal/PLL controlled. The data can increase or reduce this ...

2

You seem to misunderstand the mathematical formula given here. In a system with two symbols, there will only be two frequencies, one indicating a '1' has been sent, one indicating that a '0' has been sent. In that system, the integral increases the argument of the cosine by $$D_{f} \cdot t$$ when sending a '1', which gives a cosine with frequency f_c + ...

2

The main purpose of the "guard time" is to give the the receiver's AGC the time it needs to adapt to the new carrier level and allow the data demodulator to begin operating correctly. Many AGCs have a fast-attack, slow-decay characteristic. The preamble of a packet generally starts with a data-free zone that allows time for the fast-attack phase to work &...

2

If the regulations allow you, as wide as your transceiver supports, as long as it doesn't harm the sensitivity. For example, under FCC regulations in the 915MHz band, a transceiver can use ~500KHz for FSK deviation to comply with wide band transceiver regulations. But the same deviation under ETSI in the 433MHz ISM band is not allowed, because its out of ...

1

The RF sensitivity is basically the point where the receiver starts to produce a bit error rate that becomes significant or problematic. An FSK receiver (or an FM receiver) converts a frequency deviation (peak to peak) to an analogue voltage (peak to peak). If the basic noise in the receiver is such that it is approaching a similar order to the demodulated ...

1

Your calculations are correct, according to the data sheet and using their ppm figures the actual frequency of 433 MHz could be out by up to 108.25 kHz. Does this look like enough for the FSK receiver not to be able to tell the signal any longer ? No, I think a reasonably well designed FSK receiver should be able to lock on to anything in the realm of ...

1

If I am not wrong, this is my idea. You want to change your data stream on base of fsk_data and use counter for selection purpose. Let say you provide the fsk_data to logik. Inside your logik you have counter that select the pins of fsk_data which is 22 bit wide. Use counter of 5 bit & max value equivalent to 21 and fsk_data(counter_value) to point ...

1

If your data rate is low, a very simple possible solution is send the data serially by modulating the power transmitter off and on. You will need to have a capacitor on the receiver that is large enough to hold up the operation of the receiver for the duration of the longest "off" bit, but you get to pick how long this is and so you can make it relatively ...

1

It seems, at least to me, that utilizing multiple, thin frequency bands to encode essentially parallel pieces of information, cabled internet links could dramatically increase their bandwidth. That's how broadband ADSL works: - See this interesting article also.

1

You could also use a hardware PLL (phase-locked-loop) to detect and demodulate frequency (phase) variance (FSK or frequency-shift keying) of the signal, provided you have a good carrier or reference freq. No extensive sampling, subtraction or FFT needed, and the output could be a logic state for "frequency match" and "frequency mismatch."

1

10 milliSeconds won't do. A simple FFT at 40kHz with a block size equivalent to 10 milliSeconds will give you a frequency resolution of 100Hz. 50milliSeconds will give you a resolution of 40Hz, which will just barely allow you to "see" the difference. At that resolution, there will be one "bin" between 4040 and 4000 - that's 4000, 4020, 4040. To ...

1

Since you want a frequency resolution of at least 40 Hz I would think that you need a window of at least 1/40 Hz = 25 ms Are you familiar/willing to learn Matlab (or Octave, a free Matlab clone) ? Then you could easly try this out and see what you get.

1

This is where formats such as Manchester encoding come in to play. With Manchester encoding, the data is encoded into the transitions and not the levels. Equal numbers of 1s and 0s are always sent, so there is no issue with capacitance getting charged up with a bias of 1s or 0s. Also, clock recovery is simpler since the clock is embedded with the data.

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


text:
# Is a 1024-bit DSA key considered safe?

I created my PGP key in 2000. I’ve revoked the older, weaker sub-keys in favor of a 4096-bit RSA one, but the primary key is 1024-bit DSA. I read on Wikipedia that…

NIST 800-57 recommends lengths of 2048 for keys with security lifetimes extending beyond 2010.

1. Should I consider my primary key insecure?
2. If so, is there any way to replace it without revoking my entire key and creating a new one?
3. If my primary key were compromised, the attacker would be able to create signatures as me, but they wouldn’t be able to decrypt information that was encrypted to my public key, right?
-
Not a direct answer, but I generally use keylength.com (NIST and ECRYPT recommendations) as good indicators for key strength. –  Maarten Bodewes Aug 20 '13 at 19:21
I don't know if the PGP software you use supports this, but given that the trust system conforms to the "web of trust" model, the best way to replace your key would probably be to first generate a new key, then use your existing key to authenticate your new key to your contacts, before you revoke the old one. –  Henrick Hellström Aug 23 '13 at 6:14
What's the size of the subgroup q? If it's only 160 bits, this is probably a weaker point than the 1024 bit modulus. If it's 224 bits it's clearly strong enough. –  CodesInChaos Jun 19 '14 at 12:38

"Secure" is not a binary, black-and-white thing. Instead, it's about risk management. Instead of asking whether something is secure, it's better to ask whether it is "secure enough for such-and-such purpose". On the one hand, 1024-bit keys are uncomfortably close to what can be cracked, given lots of computational resources. On the other hand, for casual use, it's probably fine, and there's no need to go through a painful exercise to replace your key. But if you're generating new keys, these days it'd be a good call to use a 2048 bit key.

On your third question, someone who recovers your 1024-bit private signing key today would not be able to decrypt past ciphertexts, but they would be able to mount man-in-the-middle attacks on you in the future (which would let them decrypt information that anyone encrypts to you in the future), assuming they are willing to mount active attacks.

-
@bdesham, sorry, I don't know the answer to your second question. I don't know of any way to replace it without revoking it and creating a whole new key, but maybe someone else will know. –  D.W. Aug 22 '13 at 0:44

1 . Should I consider my primary key insecure?

It depends who you are trying to protect yourself from. AIUI based on the best known cryptanalysis 1024 bit RSA and DSA keys could be cracked by a well-funded attacker (I've seen the math run for RSA, not sure about DSA but AIUI they give similar security at a given key length) but it would probablly be cheaper to track you down and beat the key out of you.

Of course it is possible that govenement spooks have discovered cracking algorithms that are more efficiant than the best ones that are publically known.

For new keys generated now 2048 bit RSA is considered the minimum with the more security-paraniod groups generally reccomending 4096 bit. Some prominant cryptographers even reccomend going higher than that.

2 . If so, is there any way to replace it without revoking my entire key and creating a new one?

No, there is no way to replace the primary key other than creating a new one from scratch and telling your contacts to use it. Depending on how paranoid those you communicate with are they may accept a transition statement signed by your old key or they may require you to confirm the key is yours by out of band means.

It's also considered good pratice to sign the new key with the old key (but not vice-versa).

Afaic most people don't revoke the old key immediately but i'm not sure what the pros/cons of that are.

3 . If my primary key were compromised, the attacker would be able to create signatures as me,

Yes

but they wouldn’t be able to decrypt information that was encrypted to my public key, right?

AIUI encrypted messages are encrypted to a particular subkey. The attacker would not be able to decrypt messages encrypted with your existing subkey.

They could mark your existing subkey as revoked, add a new subkey and upload the result to the keyservers. People who downloaded the updated key would then encrypt messages to the attackers subkey. Also unless they had total control of your communications it would be very hard for them to do this while remaining undetected.

-
AFAIK a DSA cracker requires a few hundred times the RAM of an RSA cracker, so I'd assume that cracking a DSA key is a few hundred times more expensive than cracking an RSA key of the same size. Further evidence towards DSA being stronger is that the largest solved discrete logarithms over prime fields are smaller than the largest factored semi-primes. –  CodesInChaos Jun 19 '14 at 12:41


text:
## Congruences and Divisibility — A Purdue University Problem

Versão portuguesa aqui

Problem. For how many positive integers $x\leq 10,000$ is $2^{x}-x^{2}$ not divisible by $7$?

Here is my solution (accepted).

If $a\equiv b\quad \left( \text{mod }m\right)$, then $a^{n}\equiv b^{n}\quad\left( \text{mod }m\right)$. Applied to $2^{n}$ this property gives in general for $n=3k+s,1\leq s\leq 3,0\leq k$

$2^{n}\equiv 2^{s}\quad\left( \text{mod }7\right) ,\quad (1)$

which means that the remainders of the division of $2^{n}$ by $7$ form a periodic sequence of length $3$ starting at $n=1$

$\overset{\text{period}}{\overbrace{2,4,1}},\overset{3\text{ terms}}{\overbrace{2,4,1}},\ldots .$

As for $n^{2}$ since (a) if $a\equiv b\quad \left( \text{mod }m\right)$ and $c\equiv d\quad \left( \text{mod }m\right)$, then $a+c\equiv b+d\quad \left( \text{mod }m\right)$ and (b) if $a\equiv b\quad \left( \text{mod }m\right)$, then $a^{2}\equiv b^{2}\quad \left( \text{mod }m\right)$, we have in general for $n=7j+r,1\leq r\leq 7,0\leq j$

$n^{2}\equiv r^{2}\quad\left( \text{mod }7\right)\quad (2)$

which means that the remainders of the division of $n^{2}$ by 7 form a periodic sequence of length 7 starting at $n=1$

$\overset{\text{period}}{\overbrace{1,4,2,2,4,1,0}},\overset{7\text{ terms}}{\overbrace{1,4,2,2,4,1,0}},\ldots .$

If $a\equiv b\quad \left( \text{mod }m\right)$ and $c\equiv d\quad \left( \text{mod }m\right)$, then $a-c\equiv b-d\quad \left( \text{mod }m\right)$. Let $u_{n}=2^{n}-n^{2}.$ Therefore from (1) and (2) we have

$u_{n}\equiv 2^{s}-r^{2}\quad \left( \text{mod}7\right) .\quad (3)$

The remainders of the division of $u_{n}$ by $7$ form another periodic sequence of length $21=\text{lcm}(3,7)$ which starts also at $n=1$. Four examples of the evaluation of these remainders are presented below.

For $1\leq n\leq 21$ the following $15$ terms are not divisible by $7$:

$u_{1},u_{3},u_{7},u_{8},u_{9},u_{11},u_{12},u_{13},u_{14},u_{16},u_{17},u_{18},u_{19},u_{20},u_{21}$.

Hence for $1\leq n\leq 9996=21\times \left\lfloor \dfrac{10000}{21}\right\rfloor$, there are $15\times\left\lfloor \dfrac{10000}{21}\right\rfloor =7140$ terms that are not divisible by $7$.

From the remaining 4 terms $u_{9997}$ and $u_{9999}$  are not divisible by $7$, which gives a total of $7140+2=7142$ numbers $u_{n}=2^{n}-n^{2}$ not divisible by $7$.

Four examples of the evaluation of the remainders:

$u_{9}=2^{9}-9^{2}$

($9=3\times 2+3,s=3,9=7\times 1+2,r=2$)

$2^{9}\equiv 2^{3}\quad\left(\text{mod }7\right) \equiv 1\quad\left(\text{mod }7\right)$

$9^{2}\equiv 2^{2}\quad\left(\text{mod }7\right) \equiv 4\quad\left(\text{mod }7\right)$

$u_{9}\equiv 2^{3}-2^{2}\quad\left(\text{mod }7\right) \equiv -3\quad\left(\text{mod }7\right)$

$u_{10}=2^{10}-10^{2}$

($10=3\times 3+1,s=1,10=7\times 1+3,r=3$)

$2^{10}\equiv 2^{1}\quad\left(\text{mod }7\right) \equiv 2\quad\left(\text{mod }7\right)$

$10^{2}\equiv 3^{2}\quad\left(\text{mod }7\right) \equiv 2\quad\left(\text{mod }7\right)$

$u_{10}\equiv 2^{1}-3^{2}\quad\left( \text{mod }7\right)\equiv 0\quad\left( \text{mod }7\right)$

$u_{9997}=2^{9997}-9997^{2}$

($9997=3\times 3332+1,s=1,9997=7\times 1428+1,r=1$)

$2^{9997}\equiv 2^{1}\quad\left(\text{mod }7\right) \equiv 2\quad\left(\text{mod }7\right)$

$9997^{2}\equiv 1^{2}\quad\left(\text{mod }7\right) \equiv 1\quad\left(\text{mod }7\right)$

$u_{9997} \equiv 2^{9997}-9997^{2}\quad \left( \text{mod}7\right) \equiv 1\quad \left( \text{mod }7\right)$

$u_{9998}=2^{9998}-9998^{2}$

($9998=3\times 3332+2,s=2,9998=7\times 1428+2,r=2$)

$2^{9998}\equiv 2^{2}\quad\left(\text{mod }7\right) \equiv 4\quad\left(\text{mod }7\right)$

$9998^{2}\equiv 2^{2}\quad\left(\text{mod }7\right) \equiv 4\quad\left(\text{mod }7\right)$

$u_{9998} \equiv 2^{9998}-9998^{2}\quad \left( \text{mod}7\right) \equiv 0\quad \left( \text{mod }7\right)$

Remark: typos corrected. [In the 2nd. last paragraph before the examples: “there are”  added]

Edited: May 29, 2009: Portuguese version removed and posted here

Anúncios

## Sobre Américo Tavares

eng. electrotécnico reformado / retired electrical engineer
Esta entrada foi publicada em Congruences, Math, Number Theory, Problem, Purdue University com as etiquetas , . ligação permanente.

### 6 respostas a Congruences and Divisibility — A Purdue University Problem

1. Américo,

Congrats! It’s good to see that your solution was accepted. Keep the problems coming.

2. Could we just say that $a^n + b^n$ is divisible by $a + b$ for all odd $n$, and hence, $2^{33} + 3^{33}$ is divisible by 5?

Indeed, $b \equiv -a \quad (\mod a+b)$, and so, $b^n \equiv -a^n \quad (\mod a+b)$ for odd $n$. Therefore, $a^n + b^n \equiv 0 \quad (\mod a+b)$.

[copied from a comment to 2^33+3^33 (“Cálculos Auxiliares”)]
http://calcauxprobteor.wordpress.com/2009/05/23/233333/

• NELSON diz:


text:
# Thread: Separating variables in an equation?

1. ## Separating variables in an equation?

Out of these equations: which one(s) are the variables not separable? Now I think II and III cannot be separated. I've gotten a little help on this question already but then the activity dwindled down and I didn't really get a complete answer. I appreciate that help though! What I have come up with is that you can obviously separate option I and you cannot separate option III. However I'm not sure if you can separate II or not. I've tried and I can't but maybe that's just because I'm doing something wrong? My answer would be D.II & III cannot be separated but I'm not sure about II. Any help? Thanks!

2. ## Re: Separating variables in an equation?

This is the same question as in this thread: Separable equations (variables)

- Hollywood


text:
### Combining Functions

Building blocks

If $f(x)=\dfrac{1}{x}$, for $x\ne 0$, what is $ff(x)$?
By $ff(x)$ we mean the composition of $f$ with itself, sometimes written as $f^2(x)$.


text:
# hankel_qwe#

empymod.transform.hankel_qwe(zsrc, zrec, lsrc, lrec, off, ang_fact, depth, ab, etaH, etaV, zetaH, zetaV, xdirect, htarg, msrc, mrec)[source]#

Quadrature-With-Extrapolation was introduced to geophysics by [Key12]. It is one of many so-called ISE methods to solve Hankel Transforms, where ISE stands for Integration, Summation, and Extrapolation.

Following [Key12], but without going into the mathematical details here, the QWE method rewrites the Hankel transform of the form

(1)#$F(r) = \int^\infty_0 f(\lambda)J_v(\lambda r)\ \mathrm{d}\lambda$

as a quadrature sum which form is similar to the DLF (equation 15),

(2)#$F_i \approx \sum^m_{j=1} f(x_j/r)w_j g(x_j) = \sum^m_{j=1} f(x_j/r)\hat{g}(x_j) \ ,$

but with various bells and whistles applied (using the so-called Shanks transformation in the form of a routine called $$\epsilon$$-algorithm ([Shan55], [Wynn56]; implemented with algorithms from [Tref00] and [Weni89]).

This function is based on get_CSEM1D_FD_QWE.m, qwe.m, and getBesselWeights.m from the source code distributed with [Key12].

In the spline-version, hankel_qwe checks how steep the decay of the wavenumber-domain result is, and calls QUAD for the very steep interval, for which QWE is not suited.

The function is called from one of the modelling routines in empymod.model. Consult these modelling routines for a description of the input and output parameters.

Returns
fEMarray

Returns frequency-domain EM response.

kcountint

Kernel count.

convbool

If true, QWE/QUAD converged. If not, htarg might have to be adjusted.


text:
Region I and II are separated by a spherical surface
Question:

Region I and II are separated by a spherical surface of radius $25 \mathrm{~cm}$. An object is kept in region $\mathrm{I}$ at a distance of $40 \mathrm{~cm}$ from the surface. The distance of the image from the surface is :

1. $55.44 \mathrm{~cm}$

2. $9.52 \mathrm{~cm}$

3. $18.23 \mathrm{~cm}$

4. $37.58 \mathrm{~cm}$

Correct Option: , 4

Solution:

$\frac{\mu_{2}}{\mathrm{~V}}-\frac{\mu_{1}}{\mathrm{u}}=\frac{\mu_{2}-\mu_{1}}{\mathrm{R}}$

$\frac{1.4}{v}-\frac{1.25}{-40}=\frac{1.4-1.25}{-25}$

$\frac{1.4}{v}=-\frac{0.15}{25}-\frac{1.25}{40}$

$\mathrm{v}=-37.58 \mathrm{~cm}$

Hence option (4)


text:
# What do “real values” refer to in supervised classification?

I'm using supervised classification algorithms from mlpy to classify things into two groups for a question-answering system. I don't really know how these algorithms work, but they seem to be doing vaguely what I want.

I would like to get some measure of confidence out of the classifiers. I can get "real-valued predictions" from the classifiers. These appear to be values of what I would call a link function. Here's some sample output from my system.

Predictions as to whether an answer is correct
for random data from various models

Results for one run
----------------------------------------------
Model Result Confidence? ("Real value")
----- ------ ---------------------------------
SVM  [True, 0.10396502611075412]
FDA  [True, 3.3052963597375227]
SRDA  [False, 0.34205901959526142]
PDA  [True, 3.8857018468328794]
----------------------------------------------

Results for another run
----------------------------------------------
Model Result Confidence? ("Real value")
----- ------ ---------------------------------
SVM  [False, -0.0059697528841203369]
FDA  [False, -0.15660355802446979]
SRDA  [False, 1.2465697042600801]
PDA  [True, 0.23122963338708608]
----------------------------------------------

The real values are generally more positive for classifications as "True" and more negative for classifications as "False", but the link is a bit more complex than that. Can I turn these real values into confidence measures? If so, how?

And I'm playing with the following classifiers.

• Support Vector Machines (SVMs)
• K Nearest Neighbor (KNN)
• Fisher Discriminant Analysis (FDA)
• Spectral Regression Discriminant Analysis (SRDA)
• Penalized Discriminant Analysis (PDA)
• Diagonal Linear Discriminant Analysis (DLDA)

Update: Having thought about this more, realize that I just need the rank of the confidence actually. Does it seem right the answers with the highest real values be the ones that are most confidently categorized in the True group? I'd still like to understand this a bit better, but an answer to that would be nice in the short term.

• I suggest to change "real values" in the question header to "scores" or "confidences", since "real values" is a rather arbitrary term (as explained in my response). – steffen May 6 '11 at 11:21
• I think I should keep "real values" because I might not have had the question had the documentation used less arbitrary terms. – Thomas Levine May 6 '11 at 12:57
• good point – steffen May 6 '11 at 14:31

## 1 Answer

Regarding the "Real Values"

The "Real Values" are better called "confidences" or (from my pov the most common term) "scores".

Such scores are often normalized so that they sum up to 1 for all classes. They represent a measure how, well, confident the model is that the presented example belongs to a certain class. They are highly dependent on the general strategy and the properties of the algorithm. For example in KNN the score for a class i is calculated by averaging the distance to those examples which both belong to the k-nearest-neighbors and have class i. Then the score is sum-normalized across all classes.

Regarding your question

I suppose with "converting into confidences" you actually mean "probability estimates". E.g. if an example has probability 0.3 for class "1", then 30% of all examples with similar values should belong to class "1" and 70% should not.

As far as I know, his task is called "calibration". For this purpose some general methods exist (e.g. binning the scores and mapping them to the class-fraction of the corresponding bin) and some classifier-dependent (like e.g. Platt Scaling which has been invented for SVMs). A good point to start is:

Bianca Zadrozny, Charles Elkan: Transforming Classifier Scores into Accurate Multiclass Probability Estimates

EDIT after Question-Edit: @Thomas wrote: Does it seem right the answers with the highest real values be the ones that are most confidently categorized in the True group?

Yes, in general this is correct (with the same argument as above). I suggest to create a ROC - plot to see if this also applies to mlpy - package. I suggest ROCR for this purpose.


text:
# Calculation of non-overlapping set (ordering set ) of minimum spanning trees

I am interested in calculating a set of non-overlapping minimum spanning trees of a weighted graph. For example to calculate the set of size 3. I calculate the maximum spanning tree, remove its edges and repeating.

When I use EdgeDelete, it takes an eternity (the graph is huge around 30,000 nodes and 40 millions of edges). So currently, I calculate it in the following manner

SeedRandom[1]
arrayR = Append[Thread[RandomSample[Tuples[Range[1000], {2}], 5000] ->
RandomReal[1, 5000]], {_, _} -> 0];

weG = weightedGraph;
Table[minST = FindSpanningTree[weG];
SparseArray[
Most@ArrayRules[
1000}, \[Infinity]]];, {3}];

Any suggestion on how to speed up the calculation

• "I am interested in calculating a set of non-overlapping minimum spanning trees of a weighted graph." I don't get what your aim is. Would you please elaborate? – Henrik Schumacher Dec 16 '18 at 16:13
• @HenrikSchumacher Thank you.I have a graph, and I interested in calculating a forest of k nonoverlapping trees (maybe each tree is a forest too, but for simplicity, I will call it a tree). The order of each tree in this set equal to its weight (the minimum spanning tree is the first, the second one is a minimum spanning tree in the original graph after removing the edges of the minimum spanning tree... – Kiril Danilchenko Dec 16 '18 at 16:26

Very interesting. What took so long was the processing of ArrayRules; this generates an unpacked array of rules and this cannot be processed as quickly as the packed arrays of nonzero positions and nonzero values (see also how I generate the initial weighted adjacency matrix A0 below).

Moreover, I observed that you reconstruct the sparse array only to set the default values to ∞; this is seemingly required by WeightedAdjacencyGraph because it will generate a complete graph. As I just found out by pure chance, WeightedAdjacencyGraph, when called with a SparseArray as first argument allows for a second argument that allows us to specify that edges with weight 0. shall be treated as nonexistent. Hence, we may use SparseArrays without any ∞ as follows:

SeedRandom[1]
A0 = SparseArray[
RandomSample[Tuples[Range[1000], {2}], 5000] -> RandomReal[1, 5000],
{1000, 1000}
];

G = G0;

graphs = Table[
A = (SparseArray[

Usually, I prefer to avoid Graphs at all and stick to adjacency matrices. The undocumented routine SparseArraySpanningTree can compute spanning trees directly from a SparseArray; unfortunately, it seems to be unable to compute a minimal spanning tree...
• Have also a look into Szabolcs' "IGraphM" package. There is another algorithm IGSpanningTree` that seems to be faster (but ignores direction of edges). – Henrik Schumacher Dec 16 '18 at 17:50