text:
## 2.2 Probability Theory

### 2.2.1 Axiom and Theorems of Probability

1. Let S denote a sample space of an experiment P[S]=1
2. $$P[A] \ge 0$$ for every event A
3. Let $$A_1,A_2,A_3,...$$ be a finite or an infinite collection of mutually exclusive events. Then $$P[A_1\cup A_2 \cup A_3 ...]=P[A_1]+P[A_2]+P[A_3]+...$$
4. $$P[\emptyset]=0$$
5. $$P[A']=1-P[A]$$
6. $$P[A_1 \cup A_2] = P[A_1] + P[A_2] - P[A_1 \cap A_2]$$

Conditional Probability

$P[A|B]=\frac{A \cap B}{P[B]}$

Independent Events Two events A and B are independent if and only if:

1. $$P[A\cap B]=P[A]P[B]$$
2. $$P[A|B]=P[A]$$
3. $$P[B|A]=P[B]$$

A finite collection of events $$A_1, A_2, ..., A_n$$ is independent if and only if any subcollection is independent.

Multiplication Rule $$P[A \cap B] = P[A|B]P[B] = P[B|A]P[A]$$

Bayes’ Theorem Let $$A_1, A_2, ..., A_n$$ be a collection of mutually exclusive events whose union is S.
Let b be an event such that $$P[B]\neq0$$
Then for any of the events $$A_j$$, j = 1,2,…,n

$P[A_|B]=\frac{P[B|A_j]P[A_j]}{\sum_{i=1}^{n}P[B|A_j]P[A_i]}$

Jensen’s Inequality

• If g(x) is convex $$E(g(X)) \ge g(E(X))$$
• If g(x) is concave $$E(g(X)) \le g(E(X))$$

#### 2.2.1.1 Law of Iterated Expectations

$$E(Y)=E(E(Y|X))$$

#### 2.2.1.2 Correlation and Independence

Independence

• $$f(x,y)=f_X(x)f_Y(y)$$
• $$f_{Y|X}(y|x)=f_Y(y)$$ and $$f_{X|Y}(x|y)=f_X(x)$$
• $$E(g_1(X)g_2(Y))=E(g_1(X))E(g_2(Y))$$

Mean Independence (implied by independence)

• Y is mean independent of X if and only if $$E(Y|X)=E(Y)$$
• $$E(Xg(Y))=E(X)E(g(Y))$$

Uncorrelated (implied by independence and mean independence)

• $$Cov(X,Y)=0$$
• $$Var(X+Y)=Var(X) + Var(Y)$$
• $$E(XY)=E(X)E(Y)$$

$Strongest \\ \downarrow \\ Independence \\ \downarrow \\ Mean Independence \\ \downarrow \\ Uncorrelated \\ \downarrow \\ Weakest\\$

### 2.2.2 Central Limit Theorem

Let $$X_1, X_2,...,X_n$$ be a random sample of size n from a distribution (not necessarily normal) X with mean $$\mu$$ and variance $$\sigma^2$$. then for large n ($$n \ge 25$$),

1. $$\bar{X}$$ is approximately normal with with mean $$\mu_{\bar{X}}=\mu$$ and variance $$\sigma^2_{\bar{X}} = Var(\bar{X})= \frac{\sigma^2}{n}$$

2. $$\hat{p}$$is approximately normal with $$\mu_{\hat{p}} = p, \sigma^2_{\hat{p}} = \frac{p(1-p)}{n}$$

3. $$\hat{p_1} - \hat{p_2}$$ is approximately normal with $$\mu_{\hat{p_1} - \hat{p_2}} = p_1 - p_2, \sigma^2_{\hat{p_1} - \hat{p_2}}=\frac{p_1(1-p)}{n_1} + \frac{p_2(1-p)}{n_2}$$

4. $$\bar{X_1} - \bar{X_2}$$ is approximately normal with $$\mu_{\bar{X_1} - \bar{X_2}} = \mu_1 - \mu_2, \sigma^2_{\bar{X_1} - \bar{X_2}} = \frac{\sigma^2_1}{n_1}+\frac{\sigma^2_2}{n_2}$$

5. The following random variables are approximately standard normal:

• $$\frac{\bar{X}-\mu}{\sigma/\sqrt{n}}$$
• $$\frac{\hat{p}-p}{\sqrt{\frac{p(1-p)}{n}}}$$
• $$\frac{(\hat{p_1}-\hat{p_2})-(p_1-p_2)}{\sqrt{\frac{p_1(1-p_1)}{n_1}-\frac{p_2(1-p_2)}{n_2}}}$$
• $$\frac{(\bar{X_1}-\bar{X_2})-(\mu_1-\mu_2)}{\sqrt{\frac{\sigma^2_1}{n_1}-\frac{\sigma^2_2}{n_2}}}$$

If $$\{x_i\}_{i=1}^{n}$$ is an iid random sample from a probability distribution with finite mean $$\mu$$ and finite variance $$\sigma^2$$ then the sample mean $$\bar{x}=n^{-1}\sum_{i=1}^{n}x_i$$ scaled by $$\sqrt{n}$$ has the following limiting distribution

$\sqrt{n}(\bar{x}-\mu) \to^d N(0,\sigma^2)$

or if we were to standardize the sample mean,

$\frac{\sqrt{n}(\bar{x}-\mu)}{\sigma} \to^d N(0,1)$

• holds for most random sample from any distribution (continuous, discrete, unknown).
• extends to multivariate case: random sample of a random vector converges to a multivariate normal.
• Variance from the limiting distribution is the asymptotic variance (Avar)

$Avar(\sqrt{n}(\bar{x}-\mu)) = \sigma^2 \\ \lim_{n \to \infty} Var(\sqrt{n}(\bar{x}-\mu)) = \sigma^2 \\ Avar(.) \neq lim_{n \to \infty} Var(.)$

### 2.2.3 Random variable

Discrete Variable Continuous Variable
Definition A random variable is discrete if it can assume at most a finite or countably infinite number of possible values A random variable is continuous if it can assume any value in some interval or intervals of real numbers and the probability that it assumes any specific value is 0
Density Function A function f is called a density for X if:
(1) $$f(x) \ge 0$$
(2) $$\sum_{all~x}f(x)=1$$
(3) $$f(x)=P(X=x)$$ for x real
A function f is called a density for X if:
(1) $$f(x) \ge 0$$ for x real
(2) $$\int_{-\infty}^{\infty} f(x) \; dx=1$$
(3) $$P[a \le X \le] =\int_{a}^{b} f(x) \; dx$$ for a and b real
Cumulative Distribution Function
for x real
$$F(x)=P[X \le x]$$ $$F(x)=P[X \le x]=\int_{-\infty}^{\infty}f(t)dt$$
$$E[H(X)]$$ $$\sum_{all ~x}H(x)f(x)$$ $$\int_{-\infty}^{\infty}H(x)f(x)$$
$$\mu=E[X]$$ $$\sum_{all ~ x}xf(x)$$ $$\int_{-\infty}^{\infty}xf(x)$$
Ordinary Moments
the kth ordinary moment for variable X is defined as: $$E[X^k]$$
$$\sum_{all ~ x \in X}(x^kf(x))$$ $$\int_{-\infty}^{\infty}(x^kf(x))$$
Moment generating function (mgf)
$$m_X(t)=E[e^{tX}]$$
$$\sum_{all ~ x \in X}(e^{tx}f(x))$$ $$\int_{-\infty}^{\infty}(e^{tx}f(x)dx)$$

Expected Value Properties:

• E[c] = c for any constant c
• E[cX] = cE[X] for any constant c
• E[X+Y] = E[X] = E[Y]
• E[XY] = E[X].E[Y] (if X and Y are independent)

Expected Variance Properties:

• $$Var(c) = 0$$ for any constant c
• $$Var(cX) = c^2Var(X)$$ for any constant c
• $$Var(X) \ge 0$$
• $$Var(X) = E(X^2) - (E(X))^2$$
• $$Var(X+c)=Var(X)$$
• $$Var (X+Y) = Var(X) + Var(Y)$$ (if X and Y are independent)

Standard deviation $$\sigma=\sqrt(\sigma^2)=\sqrt(Var X)$$

Suppose $$y_1,...,y_p$$ are possibly correlated random variables with means $$\mu_1,...,\mu_p$$. then

$\mathbf{y} = (y_1,...,y_p)' \\ E(\mathbf{y}) = (\mu_1,...,\mu_p)' = \mathbf{\mu}$

Let $$\sigma_{ij} = cov(y_i,y_j)$$ for $$i,j = 1,..,p$$.

Define

$\mathbf{\Sigma} = (\sigma_{ij}) = \left(\begin{array} {rrrr} \sigma_{11} & \sigma_{12} & ... & \sigma_{1p} \\ \sigma_{21} & \sigma_{22} & ... & \sigma_{2p} \\ . & . & . & . \\ \sigma_{p1} & \sigma_{p2} & ... & \sigma_{pp}\\ \end{array}\right)$

Hence, $$\mathbf{\Sigma}$$ is the variance-covariance or dispersion matrix. And $$\mathbf{\Sigma}$$ is symmetric with $$(p+1)p/2$$ unique parameters.

Alternatively, let $$u_{p \times 1}$$ and $$v_{v \times 1}$$ be random vectors with means $$\mathbf{\mu_u}$$ and $$\mathbf{\mu_v}$$. then

$\mathbf{\Sigma_{uv}} = cov(\mathbf{u,v}) = E[\mathbf{(u-\mu_u)(v-\mu_v)'}]$

$$\Sigma_{uv} \neq \Sigma_{vu}$$ (but $$\Sigma_{uv} = \Sigma_{vu}'$$)

Properties of Covariance Matrices

1. Symmetric: $$\mathbf{\Sigma' = \Sigma}$$
2. Eigendecomposition (spectral decomposition,symmetric decomposition): $$\mathbf{\Sigma = \Phi \Lambda \Phi}$$, where $$\mathbf{\Phi}$$ is a matrix of eigenvectors such that $$\mathbf{\Phi \Phi' = I}$$ (orthonormal), and $$\mathbf{\Lambda}$$ is a diagonal matrix with eigenvalues $$(\lambda_1,...,\lambda_p)$$ on the diagonal.
3. Non-negative definite, $$\mathbf{a \Sigma a} \ge 0$$ for any $$\mathbf{a} \in R^p$$. Equivalently, the eigenvalues of $$\mathbf{\Sigma}$$, $$\lambda_1 \ge ... \ge \lambda_p \ge 0$$
4. $$|\mathbf{\Sigma}| = \lambda_1,...\lambda_p \ge 0$$ (generalized variance)
5. $$trace(\mathbf{\Sigma})= tr(\mathbf{\Sigma}) = \lambda_1 +... + \lambda_p = \sigma_{11}+...+ \sigma_{pp}$$= sum of variances (total variance)

Note: $$\mathbf{\Sigma}$$ is usually required to be positive definite. This implies that all eigenvalues are positive, and $$\mathbf{\Sigma}$$ has an inverse $$\mathbf{\Sigma}^{-1}$$, such that $$\mathbf{\Sigma}^{-1}\mathbf{\Sigma}= \mathbf{I}_{p \times p} = \mathbf{\Sigma}\mathbf{\Sigma}^{-1}$$

Correlation Matrices

Define the correlation $$\rho_{ij}$$ and the correlation matrix by

$\rho_{ij} = \frac{\sigma_{ij}}{\sqrt{\sigma_{ii} \sigma_{jj}}}$

$\mathbf{R} = \left( \begin{array} {cccc} \rho_{11} & \rho_{12} & ... & \rho_{1p} \\ \rho_{21} & \rho_{22} & ... & \rho_{2p} \\ . & . & . & . \\ \rho_{p1} & \rho_{p2} & ... & \rho_{pp}\\ \end{array} \right)$

where $$\rho_{ii}=1$$ for all i.

Let x and y be random vectors with means $$\mu_x$$ and $$\mu_y$$ and variance-covariance matrices $$\Sigma_x$$ and $$\Sigma_y$$. Let $$\mathbf{A}$$ and $$\mathbf{B}$$ be matrices of constants and c and d be vectors of constants. Then,

• $$E(\mathbf{Ay+c}) = \mathbf{A \mu_y} +c$$
• $$var(\mathbf{Ay +c}) = \mathbf{A}var(\mathbf{y}) \mathbf{A}' = \mathbf{A \Sigma_y A'}$$
• $$cov(\mathbf{Ay + c,By+d} = \mathbf{A \Sigma_y B'}$$

### 2.2.4 Moment generating function

Moment generating function properties:

1. $$\frac{d^k(m_X(t))}{dt^k}|_{t=0}=E[X^k]$$
2. $$\mu=E[X]=m_X'(0)$$
3. $$E[X^2]=m_X''(0)$$

mgf Theorems

Let $$X_1,X_2,...X_n,Y$$ be random variables with moment-generating functions $$m_{X_1}(t),m_{X_2}(t),...,m_{X_n}(t),m_{Y}(t)$$

1. If $$m_{X_1}(t)=m_{X_2}(t)$$ for all t in some open interval about 0, then $$X_1$$ and $$X_2$$ have the same distribution
2. If $$Y = \alpha + \beta X_1$$, then $$m_{Y}(t)= e^{\alpha t}m_{X_1}(\beta t)$$
3. If $$X_1,X_2,...X_n$$ are independent and $$Y = \alpha_0 + \alpha_1 X_1 + \alpha_2 X_2 + ... + \alpha_n X_n$$ (where $$\alpha_0, ... ,\alpha_n$$ are real numbers), then $$m_{Y}(t)=e^{\alpha_0 t}m_{X_1}(\alpha_1t)m_{X_2}(\alpha_2 t)...m_{X_n}(\alpha_nt)$$
4. Suppose $$X_1,X_2,...X_n$$ are independent normal random variables with means $$\mu_1,\mu_2,...\mu_n$$ and variances $$\sigma^2_1,\sigma^2_2,...,\sigma^2_n$$. If $$Y = \alpha_0 + \alpha_1 X_1 + \alpha_2 X_2 + ... + \alpha_n X_n$$ (where $$\alpha_0, ... ,\alpha_n$$ are real numbers), then Y is normally distributed with mean $$\mu_Y = \alpha_0 + \alpha_1 \mu_1 +\alpha_2 \mu_2 + ... + \alpha_n \mu_n$$ and variance $$\sigma^2_Y = \alpha_1^2 \sigma_1^2 + \alpha_2^2 \sigma_2^2 + ... + \alpha_n^2 \sigma_n^2$$

### 2.2.5 Moment

Moment Uncentered Centered
1st $$E(X)=\mu=Mean(X)$$
2nd $$E(X^2)$$ $$E((X-\mu)^2)=Var(X)=\sigma^2$$
3rd $$E(X^3)$$ $$E((X-\mu)^3)$$
4th $$E(X^4)$$ $$E((X-\mu)^4)$$

Skewness(X) = $$E((X-\mu)^3)/\sigma^3$$

Kurtosis(X) = $$E((X-\mu)^4)/\sigma^4$$

Conditional Moments

$E(Y|X=x)= \begin{cases} \sum_yyf_Y(y|x) & \text{for discrete RV}\\ \int_yyf_Y(y|x)dy & \text{for continous RV}\\ \end{cases}$

$Var(Y|X=x)= \begin{cases} \sum_y(y-E(Y|x))^2f_Y(y|x) & \text{for discrete RV}\\ \int_y(y-E(Y|x))^2f_Y(y|x)dy & \text{for continous RV}\\ \end{cases}$

#### 2.2.5.1 Multivariate Moments

$$$E= \left( \begin{array}{c} X \\ Y \\ \end{array} \right) = \left( \begin{array}{c} E(X) \\ E(Y) \\ \end{array} \right) = \left( \begin{array}{c} \mu_X \\ \mu_Y \\ \end{array} \right)$$$

$$$\begin{split} Var \left( \begin{array}{c} X \\ Y \\ \end{array} \right) &= \left( \begin{array} {cc} Var(X) & Cov(X,Y) \\ Cov(X,Y) & Var(Y) \\ \end{array} \right) \\ &= \left( \begin{array} {cc} E((X-\mu_X)^2) & E((X-\mu_X)(Y-\mu_Y)) \\ E((X-\mu_X)(Y-\mu_Y)) & E((Y-\mu_Y)^2) \\ \end{array} \right) \end{split}$$$

Properties

• $$E(aX + bY + c)=aE(X) +bE(Y) + c$$
• $$Var(aX + bY + c) = a^2Var(X) + b^2Var(Y) + 2abCov(X,Y)$$
• $$Cov(aX + bY, cX + bY) =acVar(X)+bdVar(Y) + (ad+bc)Cov(X,Y)$$
• Correlation: $$\rho_{XY} = \frac{Cov(X,Y)}{\sigma_X\sigma_Y}$$

### 2.2.6 Distributions

Conditional Distributions $f_{X|Y}(X|Y=y)=\frac{f(X,Y)}{f_Y(y)}$ $$f_{X|Y}(X|Y=y)=f_X(X)$$ if X and Y are independent

#### 2.2.6.1 Discrete

CDF: Cumulative Density Function
MGF: Moment Generating Function

##### 2.2.6.1.1 Bernoulli

$$Bernoulli(p)$$

PDF

hist(mc2d::rbern(100000, prob=.5))

##### 2.2.6.1.2 Binomial

$$B(n,p)$$

• the experiment consists of a fixed number (n) of Bernoulli trials, each of which results in a success (s) or failure (f)
• The trials are identical and independent, and probability of success (p) and probability of failure (q = 1- p) remains the same for all trials.
• The random variable X denotes the number of successes obtained in the n trials.

Density

$f(x)={{n}\choose{x}}p^xq^{n-x}$

CDF
You have to use table

PDF

# Histogram of 100000 random values from a sample of 100 with probability of 0.5
hist(rbinom(100000, size = 100, prob = 0.5))

MGF

$m_X(t) =(q+pe^t)^n$

Mean

$\mu = E(x) = np$

Variance

$\sigma^2 =Var(X) = npq$

##### 2.2.6.1.3 Poisson

$$Pois(\lambda)$$

• Arises with Poisson process, which involves observing discrete events in a continuous “interval” of time, length, or space.
• The random variable X is the number of occurrences of the event within an interval of s units
• The parameter $$\lambda$$ is the average number of occurrences of the event in question per measurement unit. For the distribution, we use the parameter $$k=\lambda s$$

Density

$f(x) = \frac{e^{-k}k^x}{x!}$

,k> 0, x =0,1,…

CDF
Use table

PDF

# Poisson dist with mean of 5 or Poisson(5)
hist(rpois(10000, lambda = 5))

MGF

$m_X(t)=e^{k(e^t-1)}$

Mean

$\mu = E(X) = k$

Variance

$\sigma^2 = Var(X) = k$

##### 2.2.6.1.4 Geometric
• The experiment consists of a series of trails. The outcome of each trial can be classed as being either a “success” (s) or “failure” (f). (This is called a Bernoulli trial).
• The trials are identical and independent in the sense that the outcome of one trial has no effect on the outcome of any other. The probability of success (p) and probability of failure (q=1-p) remains the same from trial to trial.
• lack of memory
• X: the number of trials needed to obtain the first success.

Density

$f(x)=pq^{x-1}$

CDF
$F(x) = 1- q^x$

PDF

# hist of Geometric distribution with probability of success = 0.5
hist(rgeom(n = 10000, prob = 0.5))

MGF

$m_X(t) = \frac{pe^t}{1-qe^t}$

for $$t < -ln(q)$$

Mean

$\mu = \frac{1}{p}$

Variance

$\sigma^2 = Var(X) = \frac{q}{p^2}$

##### 2.2.6.1.5 Hypergeometric
• The experiment consists of drawing a random sample of size n without replacement and without regard to order from a collection of N objects.
• Of the N objects, r have a trait of interest; N-r do not have the trait
• X is the number of objects in the sample with the trait.

Density

$f(x)=\frac{{{r}\choose{x}}{{N-r}\choose{n-x}}}{{{N}\choose{n}}}$

where $$max[0,n-(N-r)] \le x \le min(n,r)$$

PDF

# hist of hypergeometric distribution with the number of white balls = 50, and the number of black balls = 20, and number of balls drawn = 30.
hist(rhyper(nn = 10000 , m=50, n=20, k=30))

Mean

$\mu = E(x)= \frac{nr}{N}$

Variance

$\sigma^2 = var(X) = n (\frac{r}{N})(\frac{N-r}{N})(\frac{N-n}{N-1})$

Note For large N (if $$\frac{n}{N} \le 0.05$$), this distribution can be approximated using a Binomial distribution with $$p = \frac{r}{N}$$

#### 2.2.6.2 Continuous

##### 2.2.6.2.1 Uniform
• Defined over an interval (a,b) in which the probabilities are “equally likely” for subintervals of equal length.

Density

$f(x)=\frac{1}{b-a}$

for a < x < b

CDF

$\begin{cases} 0 & \text{if x <a } \\ \frac{x-a}{b-a} & \text{if a \le x \le b }\\ 1 & \text{if x >b}\\ \end{cases}$

PDF

hist(runif(100000, min = 0, max = 1))

MGF

$\begin{cases} \frac{e^{tb} - e^{ta}}{t(b-a)}&\text{ if t \neq 0}\\ 1&\text{if  t \neq 0}\\ \end{cases}$

Mean

$\mu = E(X) = \frac{a +b}{2}$

Variance

$\sigma^2 = Var(X) = \frac{(b-a)^2}{12}$

##### 2.2.6.2.2 Gamma
• is used to define the exponential and chi-squared distributions
• The gamma function is defined as:

$\Gamma(\alpha) = \int_0^{\infty} z^{\alpha-1}e^{-z}dz$

where $$\alpha > 0$$

• Properties of The Gamma function:

• $$\Gamma(1) = 1$$ + For $$\alpha >1$$, $$\Gamma(\alpha)=(\alpha-1)\Gamma(\alpha-1)$$ + If n is an integer and $$n>1$$, then $$\Gamma(n) = (n-1)!$$

Density

$f(x) = \frac{1}{\Gamma(\alpha)\beta^{\alpha}}x^{\alpha-1}e^{-x/\beta}$

CDF

$F(x,n,\beta) = 1 -\sum_{k=0}^{n-1} \frac{(\frac{x}{\beta})^k e^{-x/\beta}}{k!}$

for x>0, and $$\alpha = n$$ (a positive integer)

PDF

hist(rgamma(n = 10000, shape = 5, rate = 1))

MGF

$m_X(t) = (1-\beta t)^{-\alpha}$

where $$t < \frac{1}{\beta}$$

Mean

$\mu = E(X) = \alpha \beta$

Variance

$\sigma^2 = Var(X) = \alpha \beta^2$

##### 2.2.6.2.3 Normal

$$N(\mu,\sigma^2)$$

• is symmetric, bell-shaped curve with parameters $$\mu$$ and $$\sigma^2$$
• also known as Gaussian.

Density

$f(x) = \frac{1}{\sigma \sqrt{2\pi }}e^{-\frac{1}{2}(\frac{x-\mu}{\sigma})^2}$

for $$-\infty < x, \mu< \infty, \sigma > 0$$

CDF

Use table

PDF

hist(rnorm(1000000, mean = 0, sd = 1))

MGF

$m_X(t) = e^{\mu t + \frac{\sigma^2 t^2}{2}}$

Mean

$\mu = E(X)$

Variance

$\sigma^2 = Var(X)$

Standard Normal Random Variable

• The normal random variable Z with mean $$\mu = 0$$ and standard deviation $$\sigma =1$$ is called standard normal
• Any normal random variable X with mean $$\mu$$ and standard deviation $$\sigma$$ can be converted to the standard normal random variable $$Z = \frac{X-\mu}{\sigma}$$

Normal Approximation to the Binomial Distribution

Let X be binomial with parameters n and p. For large n (so that $$(A)p \le .5$$ and $$np > 5$$ or (B) $$p>.5$$ and $$nq>5$$), X is approximately normally distributed with mean $$\mu = np$$ and standard deviation $$\sigma = \sqrt{npq}$$

When using the normal approximation, add or subtract 0.5 as needed for the continuity correction

Discrete Approximate Normal (corrected)
P(X = c) P(c -0.5 < Y < c + 0.5)
P(X < c) P(Y < c - 0.5)
P(X c) P(Y < c + 0.5)
P(X > c) P(Y > c + 0.5)
P(X c) P(Y > c - 0.5)

Normal Probability Rule

If X is normally distributed with parameters $$\mu$$ and $$\sigma$$, then

• $$P(-\sigma < X - \mu < \sigma) \approx .68$$ * $$P(-2\sigma < X - \mu < 2\sigma) \approx .95$$ * $$P(-3\sigma < X - \mu < 3\sigma) \approx .997$$
##### 2.2.6.2.4 Logistic

$$Logistic(\mu,s)$$

PDF

hist(rlogis(n = 100000, location = 0, scale = 1))

##### 2.2.6.2.5 Lognomral

$$lognormal(\mu,\sigma^2)$$

PDF

hist(rlnorm(n = 10000, meanlog = 0, sdlog = 1))

##### 2.2.6.2.6 Exponential

$$Exp(\lambda)$$

• A special case of the gamma distribution with $$\alpha = 1$$
• Lack of memory
• $$\lambda$$ = rate Within a Poisson process with parameter $$\lambda$$, if W is the waiting tine until the occurrence of the first event, then W has an exponential distribution with $$\beta = 1/\alpha$$

Density

$f(x) = \frac{1}{\beta} e^{-x/\beta}$

for $$x,\beta > 0$$

CDF

$$$F(x) = \begin{cases} 0 & \text{ if x \le 0}\\ 1 - e^{-x/\beta} & \text{if x > 0}\\ \end{cases}$$$

PDF

hist(rexp(n = 100000, rate = 1))

MGF

$m_X(t) = (1-\beta t)^{-1}$

for $$t < 1/\beta$$

Mean

$\mu = E(X) = \beta$

Variance

$\sigma^2 = Var(X) =\beta^2$

##### 2.2.6.2.7 Chi-squared

$$\chi^2=\chi^2(k)$$

• A special case of the gamma distribution with $$\beta =2$$, and $$\alpha = \gamma /2$$ for a positive integer $$\gamma$$
• The random variable X is denoted $$\chi_{\gamma}^2$$ and is said to have a chi-squared distribution with $$\gamma$$ degrees of freedom.

Density Use density for Gamma Distribution with $$\beta = 2$$ and $$\alpha = \gamma/2$$

CDF Use table

PDF

hist(rchisq(n = 10000, df=2, ncp = 0))

MGF

$m_X(t) = (1-2t)^{-\gamma/2}$

Mean

$\mu = E(X) = \gamma$

Variance

$\sigma^2 = Var(X) = 2\gamma$

##### 2.2.6.2.8 Student T

$$T(v)$$

• $$T=\frac{Z}{\sqrt{\chi_{\gamma}^2/\gamma}}$$, where Z is standard normal follows a student-t distribution with $$\gamma$$ dof
• The distribution is symmetric, bell-shaped , with a mean of $$\mu=0$$
hist(rt(n = 100000, df=2, ncp =1))

##### 2.2.6.2.9 F-Distribution

$$F(d_1,d_2)$$

• F distribution is strictly positive
• $$F=\frac{\chi_{\gamma_1}^2/\gamma_1}{\chi_{\gamma_2^2}/\gamma_2}$$ follows an F distribution with dof $$\gamma_1$$ and $$\gamma_2$$, where $$\chi_{\gamma_1}^2$$ and $$\chi_{\gamma_2}^2$$ are independent chi-squared random variables.
• The distribution is asymmetric and never negative.

PDF

hist(rf(n = 100000, df1=2, df2=3, ncp=1))

##### 2.2.6.2.10 Cauchy

Central Limit Theorem and Weak Law do not apply to Cauchy because it does not have finite mean and finite variance

PDF

hist(rcauchy(n = 100000, location = 0, scale = 1))

##### 2.2.6.2.11 Multivariate Normal Distribution

Let y be a p-dimensional multivariate normal (MVN) rv with mean $$\mu$$ and variance $$\Sigma$$. Then, the density of y is

$f(\mathbf{y}) = \frac{1}{(2\pi)^{p/2}|\mathbf{\Sigma}|^{1/2}}exp(-\frac{1}{2}\mathbf{(y-\mu)'\Sigma^{-1}(y-\mu)})$

We have $$\mathbf{y} \sim N_p(\mathbf{\mu,\Sigma})$$

Properties:

• Let $$\mathbf{A}_{r \times p}$$ be a fixed matrix. then $$\mathbf{Ay} \sim N_r(\mathbf{A \mu, A \Sigma A')}$$. Note that $$r \le p$$ and all rows of A must be linearly independent to guarantee that $$\mathbf{A\Sigma A'}$$ is non-singular.
• Let $$\mathbf{G}$$ be a matrix such that $$\mathbf{\Sigma^{-1}= GG'}$$. then, $$\mathbf{G'y} \sim N_p (\mathbf{G'\mu,I})$$ and $$\mathbf{G'(y-\mu)} \sim N_p (\mathbf{0,I})$$.
• Any fixed linear combination of $$y_1,...,y_p$$ say $$\mathbf{c'y}$$, follows $$\mathbf{c'y} \sim N_1(\mathbf{c'\mu,c'\Sigma c})$$

Large Sample Properties

Suppose that $$y_1,...,y_n$$ are a random sample from some population with mean $$\mu$$ and variance-variance matrix $$\Sigma$$

$\mathbf{Y} \sim MVN(\mathbf{\mu,\Sigma})$

Then

• $$\bar{\mathbf{y}} = \frac{1}{n}\sum_{i=1}^n \mathbf{y}_i$$ is a consistent estimator for $$\mathbf{\mu}$$
• $$\mathbf{S} = \frac{1}{n-1}\sum_{i=1}^n \mathbf{(y_i - \bar{y})(y_i - \bar{y})'}$$ is a consistent estimator for $$\mathbf{\Sigma}$$
• Multivariate Central Limit Theorem: Similar to the univariate case, $$\sqrt{n}(\mathbf{\bar{y}- \mu}) \sim N_p(\mathbf{0, \Sigma})$$ when n is large relative to p (e.g., $$n \ge 25p$$), which is equivalent to $$\bar{y} \sim N_p(\mathbf{\mu,\Sigma/n})$$
• Wald’s Theorem: $$n(\mathbf{\bar{y}- \mu)'S^{-1}(\bar{y}- \mu)} \sim \chi^2_{(p)}$$ when n is large relative to p.


text:
# 1992

## We have to press on

One of the darkest most shameful moments in your university’s history came in 1992—and no, I don’t refer to the ban on roller-blades, which was more or less counterbalanced by the introduction of bicycles (and shorts) for the campus police on warm summer days. No, I’m talking about the decision to introduce something called a “gopher” to computers across the university.

Sure, it was created by software people at the University of Minnesota, where the mascot is the Golden Gopher, but when it was brought to Waterloo couldn’t it have been given a new, more appropriate name? I’m thinking of something that would honour one of my neighbours here along Laurel Creek: the UWinfo Muskrat, maybe, or the UWinfo Woodchuck. But no: your computing services weaseled out, so to speak, and introduced a “gopher” as the vehicle for the central electronic information system. At the beginning of 1992, nobody had ever heard of such a thing; by the end of the year they were lining up for briefing sessions on how to make the most of it to get at information about the libraries, coming events, and university policies. The days of print publications at the university were numbered.

In general, I have to remind you, 1992 was a tough year, mostly for economic reasons. The finances of the university were undoubtedly terrible, president Doug Wright said as 1992 began, and that was before the Ontario government announced that it was freezing grants to universities and eliminating the longstanding student grant program, leaving an all-loan system of student aid. Alan George, the provost, responded to the grant freeze by asking employee groups to take a pay freeze, something they weren’t inclined to do. His backup plan was a gradual reduction in operating budgets across the university, 6 per cent over three years, which actually doesn’t sound too horrible by today’s standards but was a very big cut in the early nineties. There was immediate talk of layoffs, and the library—your university’s second-largest department—said it expected to put “eight to ten” people onto the jobless rolls before long. Minor adjustments were made to the university’s policy on staff redundancies, in preparation for the evil day.

No wonder, in those circumstances, that the provost was less than universally popular. He was also, such are the cruel ironies of history, up for assessment at the end of his first term in office; in fact, search committees were at work simultaneously looking at his position and that of the president, as Wright was going to be leaving office in 1993. Somewhere around the time of a horrible January snowstorm that sent everybody home from campus at noontime (except those who couldn’t get their cars out of the parking lots), letters and ballots went across campus, asking faculty and staff members to say whether they thought George should be given a second term in office. The numbers that came back were never made public, and I didn’t like to abuse my trollian skills by slipping into the university secretariat late at night to look for them, but their general shape was soon clear. “I have concluded,” George announced, “that I do not have sufficient support to remain a candidate.” “The system works!” one anti-George faculty member crowed. Some of the deans begged the provost to reconsider, but he wasn’t changing his mind.

“We just have to press on,” said Wright, as suddenly there were lame ducks in the two top offices in Needles Hall. The search for a new provost began, then was suspended for a time, until a president-to-be was named and could take part in it. Finally, the new president was chosen, and his name revealed to campus on a momentous fifth of November. “Jim Who?” people asked, and the answer was repeated: Jim Downey, a name known to very few at Waterloo. He was a former president of the University of New Brunswick, an English professor coming to head a largely technical campus, an orator—“a healer,” one member of the nominating committee told eager listeners. I was pleased to hear that, being easily wounded myself; your university needed a healer in the difficult year of 1992.

Among the things that didn’t get healed all that year was the savage controversy over the resignation—or dismissal, as the case might be—of math professor Jack Edmonds. University officials said they had made “offers” to settle the case, but there was neither a negotiated settlement nor a definitive court ruling. People lamented that the case was destroying Waterloo’s public image, although I would have thought it was tougher than that. Still, it generated almost as much wind power as the storm that swept across Kitchener-Waterloo in five minutes one night in June, destroying hundreds of trees. I was asleep here by the creek at the time, and woke to the splintering noises of an ancient trunk that could stand no more. If it wasn’t a tornado, it was the next thing to it.

I suppose I’m sounding as though everything in 1992 was terrible, and indeed there were days that felt that way. I’m not even going to get into talking about the triple murder at Concordia University in August, for which an apparently deranged faculty member was sent to prison. It led to plenty of could-it-happen-here talk at Waterloo, but there was no direct impact. I also won’t list all the old friends to whom your university said goodbye that year, people like Art Headlam, Nancy-Lou Patterson and Dick Knight. As the university got older, so did the people who worked in it, and retirements were becoming more frequent.

Let me tell you, instead, about some of the good things in that year of 1992, that year of the Albertville and Barcelona Olympics, that year of the “Charlottetown Accord” that Canadian voters rejected, that year free trade with the United States was approved and the cod fishery was closed down. Let me tell you about the remodelling of the registrar’s office, which had students trekking over to a temporary Columbia Street location for several weeks; let me tell you about the final power-down for Watbun, the twenty-year-old Honeywell computer in the math faculty computing facility; let me tell you about the arrest of two students for breaking into a supposedly secure area in plant operations, just before Christmas, and stealing a fistful of campus master keys.

Oh, well, let me try again to remember the things in 1992 that were good. The most important one, I suppose, was the launch of Campaign Waterloo, held with two very tony receptions on a single day in April, one in Toronto and one at the headquarters of Mutual Life in Waterloo. I was in a quiet corner of the Mutual Life auditorium for the second event, listening to the carefully scripted words by the likes of Matthew Barrett, and wondering how a troll is supposed to look elegant while eating canapés. It was proudly announced that advance gifts to the campaign added up to nearly $30 million, towards an official goal of$89 million to be achieved in five years. Of course that included the money students were going to contribute, more than \$10 million of it, for a new Student Life Centre, a recreation facility on the north campus, and some smaller “quality of life” projects. In January they had voted 66 per cent in favour of a three-part “plan” to that effect.

While the search was on for millions more in corporate, alumni and government money, your university celebrated its community links with the launch of the Walter Bean Visiting Professorship in environmental studies, and rejoiced when Maclean’s magazine, apparently having seen the error of its ways in the previous year, labelled Waterloo Canada’s “best overall” university. There was more rejoicing when a dean was found at last for the faculty of environmental studies, where it had been hard to come up with the perfect leader; Jeanne Kay arrived from the University of Nebraska to take the helm. And all over campus, new initiatives and new achievements were happening as they always do: a Wetlands Research Centre was created, an “accessibility centre” opened in the Dana Porter Library, the registrar’s office said it was now equipped to receive final marks from professors in computerized form, the food services department launched its “Value Plus” card (predecessor of the WatCard you know and love today).

In an interesting gesture towards self-sufficiency and environmental health, your university even sank a drill deep into the ground next to the biology greenhouses, to guarantee a supply of unchlorinated water to the aquatic laboratories. Well, well, I said when I heard the news.

format: plain


text:
# aliquot

## < a quantity that can be divided into another a whole number of time />

One of the last person, with Dirk and Matt, I find interesting to follow given the recent evolution of the R language. I started with the R Inferno, by Patrick Burns, then discovered Norman’s books, in addition to the MASS book. That was all what I needed to get started. Now, this is illuminating:

R is rapidly devolving into two mutually unintelligible dialects, ordinary R and the Tidyverse. (…) It might be more acceptable if the Tidyverse were superior to ordinary R, but in my opinion it is not. It makes things more difficult for beginners. E.g. the Tidyverse has so many functions, some complex, that must be learned to do what are very simple operations in base R. Pipes, apparently meant to help beginners learn R, actually make it more difficult, I believe. And the Tidyverse is of questionable value for advanced users.

If you’re more versed into Julia these days, see also R vs. Julia. #rstats #python


text:
# Chemical Equilibrium Problem #2

1. Jan 9, 2005

### maverick280857

Hi again

Here's another problem:

When $$N_{2}O_{4}$$ is allowed to dissociate to form $$NO_{2}$$ at 15 degrees C at an equilibrium pressure of 1 atm, $$K_{p} = 0.41$$ for the reaction $$N_{2}O_{4}-->2NO_{2}$$.

(a) If $$N_{2}$$ is added to the system at constant volume will the equilbrium shift?
(b) If the system is allowed to expand an $$N_{2}$$ is added at constant pressure of 1 atm, what will be the equilbrium degree of dissociation when the partial pressure of $$N_{2}$$ is 0.6 atm.

My answer for part (a) (which I understand) is: the equilbrium will not shift either way if an inert gas is added at constant volume to the system because at constant volume, the partial pressures of the reactant product system would remain constant (the addition of inert gas in this way would result in an increase in the number of moles of gas and therefore in the total pressure).

For part(b), I figured that the addition of inert gas at constant pressure will reduce the partial pressures of the N2O4-NO2 system so the equilbrium shifts in the forward direction in this case, increasing the degree of dissociation.

$$K_{p} = 0.41atm = \frac{p_{NO_{2}}^2}{p_{N_{2}O_{4}}}$$--(1)

Now if $$\alpha$$ is the degree of dissociation under the new conditions,

let initial number of moles of $$N_{2}O_{4}$$ = 1
hence, eq number of moles of $$N_{2}O_{4} = 1 - \alpha$$

Since the system contained some moles (say a) of $$NO_{2}$$ previously, eq number of moles of $$NO_{2} = a + \alpha$$.

$$p_{NO_{2}}V = (a+\alpha)RT$$ -(2)
$$p_{N_{2}O_{4}}V = (1-\alpha)RT$$ --(3)

Also, $$1 atm = p_{NO_{2}} + p_{N_{2}O_{4}} + p_{N_{2}}$$
so
$$0.4 atm = p_{NO_{2}} + p_{N_{2}O_{4}}$$ - (4)

In principle it is possible to solve for $$p_{N_{2}O_{4}}$$ using equations (1) and (4). Next we can use equation (2) to solve for alpha But we do not know volume so we will have to divide (2) by (3) first. Is this a correct approach?

I'd be happy if someone could tell me if this approach is correct and/or offer a better approach (a shorter one will be appreciated too :-)).

Thanks and cheers
VIvek

2. Jan 9, 2005

### Gokul43201

Staff Emeritus
That should be $a + 2\alpha$

Each mole of N2O4 that dissociates, makes 2 moles of NO2.

Also, it looks like a = 0, in this problem, but that doesn't matter. If some non-zero 'a' is given, then you can not assume 1 mole of N2O4. You must consider some 'b' moles, so that after equilibrium you have $b(1- \alpha)$ moles of N2O4.

3. Jan 10, 2005

### maverick280857

Yes you're right (I made a typo).

Here's what I eventually did:

I computed the partial pressures as 0.249 and 0.150 atm for NO2 and N2O4 respectively. Now as the partial pressures are directly proportional to the number of moles,

$$\frac{0.249}{0.150} = \frac{2\alpha}{1-\alpha}$$

from which we get $$\alpha = 0.45$$ which is greater than the original degree of dissociation (=0.30). Is this okay?

Here's another one:

Solid $$NH_{4}HS$$ is introduced in a cold vessel and heated upto 500K. At equilibrium, the pressure of the mixture is 1 atm. Equal weights of $$NH_{3}$$(g) and $$H_{2}S$$(g) along with 0.5 mol of an inert gas is introduced in a vessel of capacity 8.2 litres at an initial pressure of 4 atm. Find the maximum weight of solid formed.

My solution:

From the data, it is clear that at initial equilbrium, $$p_{NH_3} = p_{H_{2}S} = 0.5 atm$$ so that

$$K_{p} = 0.25 atm^2$$

If a moles of hydrogen sulfide are taken, then no of moles of ammonia initially present = 2a and no of moles of the inert gas = 0.5. The initial total pressure (due to these three gases) equals 4 atm, so using the ideal gas equation, we can find the value of a, which turns out to be 0.1 mol.

Now, the objective is to find x, the number of moles of solid formed. Then, (2a-x) = (0.2-x) is the number of moles of NH3 left and (a-x) = (0.1-x) is the number of moles of hydrogen sulfide left (or more precisely, these are the moles at equilibrium).

Now at equilbrium, the total moles of gas = (0.2-x + 0.1 -x + 0.5) = (0.8-2x). Hence, the partial pressures are,

$$p_{NH_{3}} = \frac{0.2-x}{0.8-2x}P_{eq}$$
$$p_{H_{2}S} = \frac{0.1-x}{0.8-2x}P_{eq}$$

I can use the same equilbrium constant as the temperature is constant but I don't know how to proceed further. Please help.

Thanks and cheers
Vivek

4. Jan 10, 2005

### Gokul43201

Staff Emeritus
I get 0.45 too...but I'm not sure how you got the 0.15, 0.25 numbers.

What I did :

$$(1 - \alpha + 2\alpha) (RT/V) = 0.4 => RT/V = 0.4/(1+\alpha)~~~~~(1)$$

$$(RT/V)\frac{4 \alpha ^2}{1-\alpha} = 0.41 ~~~~~(2)$$

Plugging in for RT/V from (1) :

$$\frac{4 \alpha ^2}{1-\alpha^2} = 0.41/0.4 = (about)~1 => 4\alpha ^2 = 1 - \alpha^2$$

$$=> \alpha ^2 = 1/5 => \alpha = 0.45$$

5. Jan 10, 2005

### Gokul43201

Staff Emeritus
For the second problem, all you have to do (the final step) is :

$$K_p = 0.25 = (RT/V)^2 (0.2-x)(0.1-x)$$

Since T, V are known this gives you a quadratic in x, which you can solve.

6. Jan 12, 2005

### maverick280857

Thanks Gokul... I just didn't think what I could do after the last step!! (Searching for the nearest wall to bang my head against it...)

Cheers
Vivek
PS-Please summarize the first problem mentioned in the earlier post.


text:
Pulling the boundaries from a Solidworks Profile in Mathematica

I'm currently trying to take a 2d profile generated in SolidWorks and use mathematica to analyze it. I need to pull lines that represent the boundaries of the shape from an image of the shape. . My current approach is to save the profile as a jpg/png in solidworks, then importing that image to mathematica. I've tried a lot of things, with varying degrees of success:

img = Binarize[
Import["http://i.stack.imgur.com/BNRjk.png"]]
edges = ImageLines[EdgeDetect[img],
Method -> {"Hough",
"Segmented" ->
True}](*EDGES HOLDS LINES WHICH CORRESPOND TO EACH EDGE OF THE \
SHAPE*)
edgeimg = Graphics[{Thick, Orange, Line /@ edges}]
MorphologicalTransform[img, "Commonest"]

Has gotten me the closest, but it's far from perfect. Has anyone tried anything similar and had any success? Also, I started learning mathematica yesterday, which is also the first time I've tried image processing, so some explanation of the code would be really nice if it's really convoluted.

The end goal is that I have different lines that fully describe the profile of my object that can be individually selected.

BONUS: I have literally no clue how to incorporate curves into something like this, but that's another goal.

• Is there no format in common between these applications? – Mr.Wizard May 21 '15 at 16:40
• Related: (13918), (18167) – Mr.Wizard May 21 '15 at 16:41
• Why don't you also include an example profile where your code doesn't work? – Mr.Wizard May 21 '15 at 16:46
• Which version of Mathematica are you using? In 10.1 I get this: i.stack.imgur.com/LHyj4.png -- which looks pretty good to me. Before attempting to improve this though I ask again: is there no format in common that you could export in? – Mr.Wizard May 21 '15 at 19:08
• Thanks for asking twice. I googled harder and discovered that dxf files are reasonably compatible with mathematica. – PCK May 21 '15 at 19:32

im=Import["C:\\Users\\Leandro\\Desktop\\Arco.dxf","Graphics3D"] InputForm[%]

Export["image.png",im, ImageResolution -> 360]


text:
## WeBWorK Problems

### parserOneOf - Strings with whitespace trimmed

by Chris Pinto -
Number of replies: 2
I have a chemistry problem set I use as my first WebWork problem for new students - basically entering the symbol/name of elements given the other. I used to use str_cmp - which, by default, has 'compress_whitespace' and will remove leading/trailing spaces. One issue I had was with aluminum/aluminium and sulphur/sulfur - so I recently switched to using OneOf. Unfortunately, OneOf doesn't appear to trim spaces from answers. Any recommendations on how I can elegantly get both trimmed strings and multiple possible answers would be greatly appreciated. Problem code below:

DOCUMENT();loadMacros("PGstandard.pl","MathObjects.pl","PGchoicemacros.pl","parserOneOf.pl",  "contextArbitraryString.pl",);Context("ArbitraryString");#Setup@all_elements=();@all_symbols=();qa(~~@all_elements, ~~@all_symbols,OneOf("Hydrogen") => "H", #skip a fewOneOf("Aluminum", "Aluminium") => "Al",OneOf("Silicon") => "Si",OneOf("Phosphorus") => "P",OneOf("Sulfur", "Sulphur") => "S", #skip a fewOneOf("Tungsten") => "W",OneOf("Manganese") => "Mn");my $num = 30;my @pick_indexes = NchooseK($#all_elements+1,$num); my @elements = @all_elements[ @pick_indexes ];my @symbols = @all_symbols[ @pick_indexes ];$table_row="";for ($i = 0;$i < $num;$i++) {$table_row .= row($symbols[$i], ans_rule(15) );}Context()->normalStrings;# Print problem number and point value (weight) for the problemTEXT(beginproblem());# Show which answers are correct and which ones are incorrect$showPartialCorrectAnswers = 1;BEGIN_TEXTEnter the correct name for each element below (please be careful with spaces - there should be no extra spaces before/after the name):$PAR$BCENTER\{ begintable(2) \}\{ row( "Symbol", "Element" ) \}$table_row\{ endtable() \}$ECENTEREND_TEXT  for ($i = 0;$i < $num;$i++) {        ANS($elements[$i]->cmp);	}ENDDOCUMENT();

### Re: parserOneOf - Strings with whitespace trimmed

by Davide Cervone -
The ArbitraryString context does no processing of the answer whatsoever, and its intended use is that the problem author will provide a custom checker in the cmp() method. (See the comments at the top of constextArbitraryString.pl for details.) WIthout such a checker, the checking is done as exact strings (spaces included).

Here is an example of a checker that will trim leading and trailing whitespace, and make a case-insensitive check:

    ANS($ans->cmp( checker => sub { my ($correct,$student,$ans) = @_;
$correct = lc($correct->string);
$student = lc($student->string);
$student =~ s/^ *| *$//g;
return $correct eq$student;
}
));

Here, we convert the MathObject to a perl string and force it to lower case. Then we remove leading and trailing spaced from the student answer (we assume the correct answers don't have such spaces). Finally, we compare the two and return true when equal and false otherwise.

Hope that helps.


text:
1. Originally Posted by Awsom Guy
so I get:
C=0 and:
8=4a^2-2b+C
How can I simultanously solve this.
Come on, you have

$\displaystyle 4a^2 - 2b + c = 8$

and you know that $\displaystyle b = 4a$ and $\displaystyle c = 0$.

What's the equation you get when you substitute $\displaystyle b$ and $\displaystyle c$?

2. oh yessss thanks I already had that but my eyes are closing tired and yess I forgot that you used a instead of x. wow I should get some sleep now, thank you sooooo much, most appreciated. thanks

Page 2 of 2 First 12


text:
# Definite Integral Problem 1

Calculus Level 2

Let $$\large \displaystyle \int_{\sqrt5}^{\sqrt{21}} \dfrac{4x}{3x^2+1} \, dx = \dfrac23 \ln z$$, what is the value of $$z$$?

×


text:
Math Help - Trig Help ( verify answers)

1. Trig Help ( verify answers)

Convert the angle given in degrees to radian measure in terms of .380°

i got 6.63 rad

to 4 sig.figs
1.018

Solve the equation for all nonnegative values of less than . Do by calculator, if needed, and give the answers to three significant digits in the order of increasing.
(not sure what to do)

A satellite is in a circular orbit 225 km above the equator of the earth. How many kilometres must it travel for its longitude to change by 86.3°?
Assume the radius of the earth equals 6400 kilometres.(round to the nearest whole number)
i got 9639.80 =9600

2. Originally Posted by rock candy
Convert the angle given in degrees to radian measure in terms of .380°

i got 6.63 rad
Unfortunately, I cannot see any of your attachments.
"6.63 rad" is the NUMERICAL value but the problem asked you give it in terms of $\pi$: Since there are 360 degrees or $2\pi$ radians so the conversion factor is $\frac{2\pi}{360}= \frac{\pi}{180}$ radians per degree. $\frac{\pi}{180}(380)= \frac{380}{180}\pi$. Just do the fraction part.

Unfortunately, I cannot see the attachments.

to 4 sig.figs
1.018

Solve the equation for all nonnegative values of less than . Do by calculator, if needed, and give the answers to three significant digits in the order of increasing.
(not sure what to do)

A satellite is in a circular orbit 225 km above the equator of the earth. How many kilometres must it travel for its longitude to change by 86.3°?
Assume the radius of the earth equals 6400 kilometres.(round to the nearest whole number)
i got 9639.80 =9600


text:
Question: how to use edgeR analysis RNA-seq data which has four factors
0
3.9 years ago by
xiaoaozqd0 wrote:

I have a RNA-seq data about the plant inoculated with a fungi pathogen.Three biological replicates of the experiment were conducted at separate times and using independently grown plants and fungi. There are one pair of near-isogenic line, two fungi races and a series of sampling times post inoculation.

The experimental design as follow, can anyone hlep me about how to find the differenttial expression genes with edgeR.

The object is to clear which genes confer the resistance of the plant and which genes confer the virulence of the fungi.

Comprehensive understand the interaction between plant and fungi.

 factor1
factor2 factor3 factor4

Sample NO
 plant

fungi

 time
 batch
genotype

1

NIL-R A
 0h
1 mock_R
2 NIL-R A 0h

2

mock_R
3 NIL-R A 0h 3 mock_R
4 NIL-R A 18h 1 susceptible
5 NIL-R A
 18h
2 susceptible
6 NIL-R A
 18h
3 susceptible
7 NIL-R A
 24h
1 susceptible
8 NIL-R A
 24h
2 susceptible
9 NIL-R A
 24h
3 susceptible
10
 NIL-R
B
 0h
1 mock_R
11
 NIL-R
B
 0h
2 mock_R
12
 NIL-R
B
 0h
3 mock_R
13
 NIL-R
B
 18h
1 resistance
14
 NIL-R
B
 18h
2 resistance
15
 NIL-R
B
 18h
3 resistance
16
 NIL-R
B 24h 1 resistance
17
 NIL-R
B 24h 2 resistance
18
 NIL-R
B 24h 3 resistance
19
 NIL-S
B 0h 1 mock_S
20
 NIL-S
B 0h 2 mock_S
21
 NIL-S
B 0h 3 mock_S
22
 NIL-S
B 18h 1 susceptible
23
 NIL-S
B 18h 2 susceptible
24
 NIL-S
B 18h 3 susceptible
25
 NIL-S
B 24h 1 susceptible
26
 NIL-S
B 24h 2 susceptible
27
 NIL-S
B 24h 3 susceptible

modified 3.7 years ago • written 3.9 years ago by xiaoaozqd0
Answer: how to use edgeR analysis RNA-seq data which has four factors
2
3.9 years ago by
Aaron Lun25k
Cambridge, United Kingdom
Aaron Lun25k wrote:

The simplest approach here seems to be a one-way layout for the biological terms, with an additive batch effect:

grouping <- factor(paste(plant, fungi, time, sep="."))
batch <- factor(batch)
design <- model.matrix(~ 0 + grouping + batch)

This avoids making any assumptions about the (lack of) interactions between the interesting experimental factors. Otherwise, if you used an additive approach for all of these factors, you would be assuming that, e.g., the effect of time would be the same in different plants or for different fungi, which may not be true.

Anyway, with the design I've described above, it's fairly easy to do comparisons between specific groups. If you want to identify DE genes between, say, NIL-R inoculated with A at 0h with NIL-R inoculated with B at 0h, you could just do something like:

con <- makeContrasts(groupingNILR.B.0h - groupingNILR.A.0h, levels=design)

With this strategy, you can compare any two (or more) groups of interest. For example, you could identify differences in the inoculation effect of A at 18 hours against that of B in NIL-R plants by doing:

con <- makeContrasts((groupingNILR.B.18h - groupingNILR.B.0h) -
(groupingNILR.A.18h - groupingNILR.A.0h), levels=design)

This will compute the log-fold change between 18 and 0 hours after A inoculation, and compare it to the corresponding value after B inoculation. In both cases, note that I've assumed that you've renamed the levels of plants to get rid of the dash, because makeContrasts doesn't like that in the column names of design.

Thank you very much fro your gudance! Could you kindhearted to point out how to compare the resistance group (groupingNILR.B) to the susceptible group ((groupingNILR.A+groupingNILS.B)/2)?

1

Well, you've almost written it yourself:

con <- makeContrasts(groupingNILR.B.xh -
(groupingNILR.A.xh + groupingNILS.B.xh)/2, levels=design)

... where you replace x with the time point of interest. You'll want to set up comparisons at each time point as separate contrasts, just in case you have a situation where a gene is up in one time point and down in another time point. Such genes would be missed if you summarized samples from all time points into one DE log-fold change.

On a similar note, the contrast I've written above will only test for differences between NILR.B and the average of the other two groups. It is possible to get situations where the reported log-fold change is positive, but the log-fold change between NILR.B and one of the other groups is negative. To protect against this, I tend to prefer ANOVA-like comparisons:

con <- makeContrasts(groupingNILR.B.xh - groupingNILR.A.xh,
groupingNILR.B.xh - groupingNILS.B.xh, levels=design)

I would then focus on significant genes where the log-fold changes are in the same direction, as these are the ones showing a consistent qualitative effect in the resistant group over both of the susceptible groups. If you want to be more rigorous, you can do the NILR.B/NILR.A and NILR.B/NILS.B comparisons separately and intersect the DE lists to obtain genes with significant differences between resistant and both susceptible groups. I think this is probably unnecessarily conservative, though.

Thank you for your response. I really appreciate the advice on ANOVA-like comparisons you have given. From your opinion, it is not sensible to make pairwise comparisons between the resistance group VS the susceptible group which defining each treatment combination as a group. Do you have some good idea about gain the global differential expression genes (needn't set up comparisons at each time point as separate contrasts) involved in the interaction with pathogen, such as resistance or related genes?

2

Why isn't it sensible? I don't recall saying anything like that.

If you want to find globally DE genes, you can set up an ANOVA-like comparison involving all time points:

con <- makeContrasts(groupingNILR.B.0h - groupingNILR.A.0h,
groupingNILR.B.0h - groupingNILS.B.0h,
groupingNILR.B.18h - groupingNILR.A.18h,
groupingNILR.B.18h - groupingNILS.B.18h,
groupingNILR.B.24h - groupingNILR.A.24h,
groupingNILR.B.24h - groupingNILS.B.24h, levels=design)

This will give you genes that are DE between the resistant and susceptible groups at any time point. That said, getting DE genes at a time point of zero mightn't be particularly interesting, because inoculation shouldn't have any effect at the start of the time course. A more sophisticated DE comparison might be something like:

con <- makeContrasts((groupingNILR.B.18h - groupingNILR.B.0h) -
(groupingNILR.A.18h - groupingNILR.A.0h),
(groupingNILR.B.18h - groupingNILR.B.0h) -
(groupingNILS.B.18h - groupingNILS.B.0h),
(groupingNILR.B.24h - groupingNILR.B.0h) -
(groupingNILR.A.24h - groupingNILR.A.0h),
(groupingNILR.B.24h - groupingNILR.B.0h) -
(groupingNILS.B.24h - groupingNILS.B.0h), levels=design)

This will correct the DE at the later time points for any (uninteresting) DE at time point zero. You can then focus on genes where the log-fold changes are of the same sign, as these have a consistent association with resistance against susceptibility for both susceptible groups and across all time points.

Answer: how to use edgeR analysis RNA-seq data which has four factors
0
3.9 years ago by
xiaoaozqd0 wrote:

table move to above

Can you put this table in your original answer, rather than putting it in a new post as you've done here? The ordering of posts changes according to the number of votes, so if you get a lot of replies, this table will get lost.

Answer: how to use edgeR analysis RNA-seq data which has four factors
0
3.7 years ago by
xiaoaozqd0 wrote:

Could you kindhearted to help me again?
In my data, one biological repeat (CYR32_1) in one group is obvious deviation from the other two biological repeats(CYR32_2 and CYR32_3) in the plotMDS with or without the method BCV.

So I just removed this sample, while when the design (= model.matrix(~ 0 + grouping + batch)) was used, it seemed among all of the data only the batch2 and batch3 were used.
design
groupingNILR.B.0h    groupingNILR.A.0h    groupingNILR.B.18h    groupingNILR.B.24h    groupingNILR.S.18h    groupingNILR.S.24h    groupingNILS.B.18h    groupingNILS.B.24h    batchb    batchc

the levels of con：groupingNILR.B.0h    groupingNILR.A.0h    groupingNILR.B.18h    groupingNILR.B.24h    groupingNILR.S.18h    groupingNILR.S.24h    groupingNILS.B.18h    groupingNILS.B.24h    batchb    batchc

After the statistical analysis with glmFit and glmLTR, there are 11994 significantly differentially expressed genes with the FDR<0.05.

I tried to omit the batch effect to use the design3 (= model.matrix(~ 0 + grouping)). The levels of con are groupingMK.26.usp, groupingMK.32.usp, groupingNR.26.18h, groupingNR.26.24h, groupingNR.32.18h, groupingNR.32.24h, groupingNS.32.18h, groupingNS.32.24h. After the statistical analysis with glmFit and glmLTR, there are only 10398 significantly differentially expressed genes (DEG) with the FDR<0.05. compare with the result of “design”, 8722 was identified by both “design” and “design3”. In addition, the FDR and P-value of the same gene is different.

So my questions are:
1. When one of the biological repeat should be removed, how to design the model?
2. In my data, which result seem to be more receivable, the “design” or “design3”, or some others?
3. Does the batch effects have a great effect of the DEG.
4. During the estimation of dispersion, there are three approaches:
d = estimateGLMCommonDisp(d,design)
d = estimateGLMTrendedDisp(d,design)
d = estimateGLMTagwiseDisp(d,design)
After each method was used, the last logFC of each gene will have a minor alteration while the FDR and p-value will have a great change, in some paper only the first and the third method were used, so I’m not so clear whether all of these three approaches should be used together, for in the edgeR users guide just described “The tagwise dispersion approach is strongly recommended in multi-factor experiment cases.”

Put this in a new question. Write some code that allows us to regenerate your design matrix without copy-and-pasting the descriptions for each sample. Finally, show the code you used for every step of the edgeR analysis.


text:
# 1.7 Block – spring system in shm  (Page 2/2)

 Page 2 / 2

$⇒{F}_{\text{net}}=ma=-ky$

$⇒a=-\frac{k}{my}$

This relation on comparison with SHM equation “ $a=-{\omega }^{2}x$ ” yields same set of periodic expressions as in the case of horizontal block-spring arrangement :

$⇒\omega =\sqrt{\left(\frac{k}{m}\right)}\phantom{\rule{1em}{0ex}}⇒T=2\pi \sqrt{\left(\frac{m}{k}\right)}\phantom{\rule{1em}{0ex}}⇒\nu =\frac{1}{2\pi }\sqrt{\left(\frac{k}{m}\right)}$

In this case, however, we can obtain alternative expressions as well for the periodic attributes as spring force at equilibrium position is equal to the weight of the block,

$mg=-k{y}_{0}$

Dropping negative sign and rearranging,

$⇒\frac{m}{k}=\frac{{y}_{0}}{g}$

Hence, the alternative expressions of periodic attributes are :

$⇒\omega =\sqrt{\left(\frac{g}{{y}_{0}}\right)}\phantom{\rule{1em}{0ex}}⇒T=2\pi \sqrt{\left(\frac{{y}_{0}}{g}\right)}\phantom{\rule{1em}{0ex}}⇒\nu =\frac{1}{2\pi }\sqrt{\left(\frac{g}{{y}_{0}}\right)}$

Clearly, the extension of the spring owing to the weight of the block in vertical orientation has no impact on the periodic attributes of the SHM. One important difference, however, is that the center of oscillation does not correspond to the position of neutral spring configuration; rather it is shifted down by a vertical length given by :

$⇒{y}_{0}=\frac{mg}{k}$

## Block connected to springs in series

We consider two springs of different spring constants. An external force like gravity produces elongation in both springs simultaneously. Since spring is mass-less, spring force is same everywhere in two springs. This force, however, produces different elongations in two springs as stiffness of springs are different. Let “ ${y}_{1}$ ” and “ ${y}_{2}$ ” be the elongations in two springs. As discussed for the single spring, the net restoring force for each of the springs is given as :

${F}_{\text{net}}=-{k}_{1}{y}_{1}=-{k}_{2}{y}_{2}$

The total displacement of the block from equilibrium position is :

$⇒y={y}_{1}+{y}_{2}=-\frac{{F}_{\text{net}}}{{k}_{1}}-\frac{{F}_{\text{net}}}{{k}_{2}}$

$⇒{F}_{\text{net}}=\frac{{k}_{1}{k}_{2}y}{{k}_{1}+{k}_{2}}$

A comparison with the expression of extension of the single spring at equilibrium position reveals that spring constant of the arrangement of two springs is equivalent to a single spring whose spring constant is given by :

$⇒k=\frac{{k}_{1}{k}_{2}}{{k}_{1}+{k}_{2}}$

This relationship can also be expressed as :

$⇒\frac{1}{k}=\frac{1}{{k}_{1}}+\frac{1}{{k}_{2}}$

In the nutshell, we can consider the arrangement of two springs in series as a single spring of spring constant “k”, which is related to individual spring constants by above relation. Further, we can extend this concept to a number of springs by simply extending the relation as :

$⇒\frac{1}{k}=\frac{1}{{k}_{1}}+\frac{1}{{k}_{2}}+\frac{1}{{k}_{3}}+\dots$

The periodic attributes are given by the same expressions, which are valid for oscillation of single spring. We only need to use equivalent spring constant in the expression.

## Block in between two springs

In this arrangement, block is tied in between two springs as shown in the figure. In order to analyze oscillation, we consider oscillation from the reference position of equilibrium. Let the block is displaced slightly in downward direction (reasoning is similar if block is displaced upward). The upper spring is stretched, whereas the lower spring is compressed. The spring forces due to either of the springs act in the upward direction. The net downward displacement is related to net restoring force as :

${F}_{\text{net}}=-{k}_{1}{y}_{1}-{k}_{2}{y}_{2}=-\left({k}_{1}+{k}_{2}\right)y$

A comparison with the expression of extension of the single spring reveals that spring constant of the arrangement of two springs is equivalent to a single spring whose spring constant is given by :

$⇒k={k}_{1}+{k}_{2}$

Clearly, the periodic attributes are given by the same expressions, which are valid for oscillation of single spring. We only need to use equivalent spring constant in the expression.

## Block connected to springs in parallel

Here, we consider a block is suspended horizontally with the help of two parallel springs of different spring constants as shown in the figure. When the block is pulled slightly, it oscillates about the equilibrium position. The net restoring force on the block is :

${F}_{\text{net}}=-{k}_{1}{y}_{1}-{k}_{2}{y}_{2}=-\left({k}_{1}+{k}_{2}\right)y$

A comparison with the expression of extension of the single spring reveals that spring constant of the arrangement of two springs is equivalent to a single spring whose spring constant is given by :

$⇒k={k}_{1}+{k}_{2}$

Again, the periodic attributes are given by the same expressions, which are valid for oscillation of single spring. We only need to use equivalent spring constant in the expression.

what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Preparation and Applications of Nanomaterial for Drug Delivery
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!


text:
We will be migrating from Ask to Discourse on the first week of August, read the details here

# [SOLVED] LO Base Can't Connect to Sqlite3

Below are the steps I have taken to get Sqlite3 hooked up to Base. I don't know what to do to fix this>

Blockquote USING: Libre Office Version: 6.0.7.3 Build ID: 1:6.0.7-0ubuntu0.18.04.10

SITE: https://thejeshgn.com/2018/08/23/using- ... l-UnixODBC

COMMAND: sudo apt-get install sqlite3 libsqlite3-dev.

RESULT: Sqlite3 runs fine.

COMMAND: ./configure && make ( as per instructions in SITE) rick@rick-Latitude-E6510:~/Desktop/sqlite-driver/sqliteodbc-0.9996$./configure && make RESULT: checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no . . . checking for sqlite3_table_column_metadata in -lsqlite3... no checking for sqlite3_profile in -lsqlite3... no checking for sqlite3_strnicmp in -lsqlite3... no checking for sqlite3_close_v2 in -lsqlite3... no checking for SQLite4 header and library... no configure: WARNING: SQLite4 header file and source not found configure: error: No usable SQLite header/library on this system rick@rick-Latitude-E6510:~/Desktop/sqlite-driver/sqliteodbc-0.9996$

COMMAND: make install ( as per instructions in SITE) rick@rick-Latitude-E6510:~/Desktop/sqlite-driver/sqliteodbc-0.9996$make install RESULT: make: * No rule to make target 'install'. Stop. rick@rick-Latitude-E6510:~/Desktop/sqlite-driver/sqliteodbc-0.9996$

edit retag close merge delete

Please note that you should always provide links to same question posted in other forums. This eliminates duplicate effort.

Also posted here -> https://forum.openoffice.org/en/forum...

( 2019-11-27 20:56:37 +0200 )edit

Please do not mark question titles as [SOLVED]. On this site it is more appropriate to click on the ✔ in upper left area of answer which satisfied the question. This signifies an accepted answer.

( 2019-12-03 18:26:10 +0200 )edit

Sort by » oldest newest most voted

By using a closed question I got a little further! I get to where 'Base' wants to connect to a database and I am presented with the choice of file extensions. Unfortunately there is only one choice. ODF files. Not anything that SQLite will open. Below are config files as per closed Question.

Base: how to connect to an SQLite database? [closed]

This is contents of 'odbinst.ini' file

[SQLite]
Description=SQLite ODBC Driver
Driver=libsqliteodbc.so
Setup=libsqliteodbc.so
UsageCount=1

[SQLite3]
Description=SQLite3 ODBC Driver
Driver=libsqlite3odbc.so
Setup=libsqlite3odbc.so
UsageCount=1

This is contents of '.odbc.ini' file

[SQLite]
Description=SQLite
Driver=SQLite
Database=/home/rick/Desktop/sqliteDatabases
Timeout=100000
StepAPI=No
ShortNames=No
FKSupport=Yes
SyncPragma=Normal
JournalMode=Delete
BigInt=No

[SQLite3]
Description=SQLite3
Driver=SQLite3
Database=/home/rick/Desktop/sqliteDatabases/
Timeout=100000
StepAPI=No
ShortNames=No
FKSupport=Yes
SyncPragma=Normal
JournalMode=Delete
BigInt=No

more

Please do not use an answer for further information. Either use add a comment or edit original question and note additional information. You can, however, answer your own question.

Also your formatting is not correct. There is a toolbar (upper left when posting) which has formatting tools.

Do not see in your odbc.ini definitions any database defined such as MyDB.db just directories. A defined section in ODBC is to a specific DB. See once again the closed question referred to.

( 2019-12-01 21:56:41 +0200 )edit

Also don't know what is meant in statement about file extensions. What is needed is an ODBC connection.

In creating a Base file, in the first dialog you select Connect to an existing database & then in dropdown select ODBC. Clicking Next brings you to selecting a source. Click Browse... which lists the connections established in your odbc.ini file.

( 2019-12-01 22:06:52 +0200 )edit

I revised the odbc.ini file to reflect a database, not the directory. Database=/home/rick/Desktop/sqliteDatabases/renoAZID.db

Following through Base Screens:

Connect to an existing database. checked -> shows ODBC -> next -> shows Name of the ODBC data source on your system -> SQLite3 -> OK Finish. checked

Now shows browser with directories to pick from. It doesn't make a difference if you pick a directory or not . I did pick /home/rick/Desktop/sqliteDatabases/ because that is where my database is. The screen is empty; no databases show. However, on the bottom right corner of the screen is a box saying ODF databases. It has an arrow thingee to get other choices but there is no other choice. END no where else to go.

( 2019-12-02 00:56:53 +0200 )edit

That is the Save dialog. This step you mention is the actual saving of the Base file. Just pick a directory you want the Base file in and give it a name (top line entry where it is pre-defined as NewDatabase).

( 2019-12-02 01:11:15 +0200 )edit

Thanks, Dumb me. Worked fine. Apparently then Base makes original database names for the database. My sqlite.db file isn't touched?

One other thing happened. I tried using the SQLite data source and got the error message "Can't open 'libsqliteodbc.so file not found" SQL Status 01000 I tried to download it with Sudo apt install libsqliteodbc.so Result: E: Unable to locate package libsqliteodbc.so E: Couldn't find any package by glob 'libsqliteodbc.so' E: Couldn't find any package by regex 'libsqliteodbc.so' Any ideas?

AND .. Where did you find the formatting for the red background?

Thans again, R

( 2019-12-02 01:48:26 +0200 )edit

No, sqlite.db should not be affected in any way. You may also not be comprehending that Base is only a front end to a database. Base itself is NOT a database.

libsqliteodbc.so is used for SQLite2 databases. If you are using only SQLite3 then it is not needed. If you really need this one I would need to search where to get it, but it doesn't seem you do. Use the SQLite3 driver. Again, haven't used in quite some time and it may be both SQLite 2 & 3 will work with the libsqlite3odbc.so driver.

The "red" text as you put it is surround item with back ticks.

( 2019-12-02 02:29:40 +0200 )edit

I understand that Base is not a database. However, I thought because of it's connection to sqlite.db's it would change them. What does it do make a HSQLDB database out of sqlite.db. I thought I saw on the internet where people use Base as a front end to create tables for sqlite.db's. Tried out backticks on HSQLDB. Handy secret to know about. Again, Thanks, R

( 2019-12-02 19:02:05 +0200 )edit

Your comment is cryptic. Base does not "change" a database because of a connection.

Base does not make a HSQLDB database out of SQLite. When Base is connected to SQLite, it stays as SQLite and HSQLDB never comes into play.

Regardless of the database used, you can add/change/create/delete tables from the database Base is attached to.

( 2019-12-02 19:11:28 +0200 )edit

Hello,

Have not touched SQLite in some time. In past only did so for answering questions on this site.

You should be able to get the unixodbc and libsqliteodbc drivers using Synaptic or see this post -> Setting up ODBC for SQLite on Ubuntu.


text:
# Module tabarray¶

Author: Hans Terlouw <gipsy@astro.rug.nl>

Module tabarray provides a class which allows the user to read, write and manipulate simple table-like structures. It is based on NumPy and the table-reading part has been optimized for speed. When the flexibility of SciPy’s read_array() function is not needed, Tabarray can be considered as an alternative.

## Class tabarray¶

class tabarray.tabarray(source[, comchar='#!', sepchar=' \t', lines=None, bad=None, segsep=None])

Tabarray is a subclass of NumPy’s ndarray. It provides all of ndarray’s functionality as well as some extra methods and attributes.

Parameters: source – the object from which the tabarray object is constructed. It can be a 2-dimensional NumPy array, a list or tuple containing the table columns as 1-dimensional NumPy arrays, or a string with the name of a text file containing the table. Only in the latter case the other arguments are meaningful. comchar – a string with characters which are used to designate comments in the input file. The occurrence of any of these characters on a line causes the rest of the line to be ignored. Empty lines and lines containing only a comment are also ignored. sepchar – a string containing the column separation characters to be used. Columns are separated by any combination of these characters. lines – a two-element tuple or list specifying a range of lines to be read. Line numbers are counted from one and the range is inclusive. So (1,10) specifies the first 10 lines of a file. Comment lines are included in the count. If any element of the tuple or list is zero, this limit is ignored. So (1,0) specifies the whole file, just like the default None. bad – is a number to be substituted for any field which cannot be decoded as a number. The default None causes a ValueError exception to be raised in such cases. segsep – a string containing segment separation characters. If any of these characters is present in a comment block, this comment block is taken as the end of the current segment. The default None indicates that every comment block will separate segments. IOError, when the file cannot be opened. IndexError, when a line with an inconsistent number of fields is encountered in the input file. ValueError: when a field cannot be decoded as a number and no alternative value was specified.

Attributes:

nrows

the number of rows

ncols

the number of columns

segments

a list with slice objects which can be used to address the different segments from the table. Segments are parts of the table which are separated by comment blocks which meet the conditions specified by argument segsep. The following example illustrates how a program can iterate over all segments:

 1 2 3 4 5 6 from kapteyn.tabarray import tabarray coasts = tabarray('world.txt') for segment in coasts.segments: coast = coasts[segment]

Methods:

columns(cols=None)
Parameters: cols – a tuple or list with the numbers (zero-relative) of the columns to be extracted. a NumPy array.

Extract specified columns from a tabarray and return an array containing these columns. Cols is a tuple or list with the column numbers. As the first index of the resulting array is the column number, multiple assignment is possible. E.g., x,y = t.columns((2,3)) delivers columns 2 and 3 in variables x and y. Default: return all columns.

rows(rows=None)
Parameters: rows – a tuple or list containing the numbers (zero-relative) of the rows to be extracted. a new tabarray.

This method extracts specified rows from a tabarray and returns a new tabarray. Rows is a tuple or list containing the row numbers to be extracted. Normal Python indexing applies, so (0, -1) specifies the first and the last row. Default: return whole tabarray.

writeto(filename, rows=None, cols=None, comment=[], format=[])

Write the contents of a tabarray to a file.

Parameters: filename – the name of the file to be written. rows – a tuple or list with a selection of the rows (zero-relative) te be written. Default: all rows. columns – a tuple or list with a selection of the columns (zero-relative) to be written. Default: all columns. comment – a list with text strings which will be inserted as comments in the output file. These comments will be prefixed by the hash character (#). format – a list with format strings for formatting the output, one element per column, e.g., ['%5d', ' %10.7f', ' %g'].

## Functions¶

tabarray.readColumns(filename, comment='!#', cols='all', sepchar=', \t', rows=None, lines=None, bad=0.0, rowslice=(None, ), colslice=(None, ))

TableIO-compatible function for directly extracting table data from a file.

Parameters: filename – a string with the name of a text file containing the table. comment – a string with characters which are used to designate comments in the input file. The occurrence of any of these characters on a line causes the rest of the line to be ignored. Empty lines and lines containing only a comment are also ignored. cols – a tuple or list with the column numbers or a scalar with one column number. sepchar – a string containing the column separation characters to be used. Columns are separated by any combination of these characters. rows – a tuple or list containing the row numbers to be extracted. lines – a two-element tuple or list specifying a range of lines to be read. Line numbers are counted from one and the range is inclusive. So (1,10) specifies the first 10 lines of a file. Comment lines are included in the count. If any element of the tuple or list is zero, this limit is ignored. So (1,0) specifies the whole file, just like the default None. bad – a number to be substituted for any field which cannot be decoded as a number. rowslice – a tuple containing a Python slice indicating which rows should be selected. If this argument is used in combination with the argument rows, the latter should be expressed in terms of the new row numbers after slicing. Example: rowslice=(10, None) selects all rows, beginning with the eleventh (the first row has number 0) and rowslice=(10, 13) selects row numbers 10, 11 and 12. colslice – a tuple containing a Python slice indicating which columns should be selected. If this argument is used in combination with the argument cols, the latter should be expressed in terms of the new column numbers after slicing. Selection is analogous to rowslice.
tabarray.writeColumns(filename, list, comment=[])

TableIO-compatible function for directly writing table data to a file.

Parameters: filename – the name of the file to be written; list – a list containing the columns to be written. comment – a list with text strings which will be inserted as comments in the output file. These comments will be prefixed by the hash character (#).

## Example¶

Suppose you have a file with catheti data from right-angled triangles and you want to compute the hypotenuses and write the result to a second file. The input file may be as follows:

# Triangle data
#
3.0   4.0 ! classic example
4.1   3.6
10.0  10.0

Then the following simple script will do the job:

#!/usr/bin/env python
import numpy
from kapteyn.tabarray import tabarray

x,y = tabarray('triangles.txt').columns()
tabarray([x,y,numpy.sqrt(x*x+y*y)]).writeto('outfile.txt')

leaving the following result in the output file:

 3      4      5
4.1    3.6    5.45619
10     10     14.1421


text:
# how to find equivalent expressions with fractions

Take a look at equivalent fractions by watching this tutorial! Equivalent fractions state that two or more than two fractions are said to be equal if both results are the same fraction after simplification. Here are a … Why are they the same? Equivalent fractions are fractions that have the same value as each other.. Look at the circles below. Note that the procedure for finding equivalent fractions is the same for both types of fractions. It can be written as . The fraction means that one whole has been divided into 3 equal parts and each part is one of the three equal parts. If that is the case, we will have equivalent expressions when we do this. Virtual Nerd's patent-pending tutorial system provides in-context information, hints, and links to supporting tutorials, synchronized with videos, each 3 to 7 minutes long. 1 is half of 2. Learn how to condense logarithmic expressions. SOLUTION : Given expression is 4 and one-third divided by Negative Start Fraction 5 over 6 End Fraction. So, we can write the given decimal as fraction with denominator 1000. Share. Finding equivalent fractions is an important part of things like adding, subtracting, and comparing fractions. Write two expressions for the area of the big rectangle. In fact, any fraction where the. Algebra strikes fear in the hearts of many both grown and still in school. Step 2: Write equivalent fractions using the LCD if needed. • The expression that allows us to find the cost of an item after the discount has been taken and the sales tax has been added is written by representing the discount price added to the discount price multiplied by the sales tax rate. 5 is half of 10. A logarithmic expression is an expression having logarithms in it. Figure $$\PageIndex{2}$$ 3. Considering the factors in this particular fraction, I get: Then the simplified form of the expression is: Simplify the following rational expression: How nice! She states that equivalent fractions are fractions with same value. numerator is half of the denominator will be equivalent to : 1 2. Did they eat the same amount of pizza? In this non-linear system, users are free to take whatever path through the material best serves their needs. Figure $$\PageIndex{1}$$ 2. Convert two fractions to equivalent fractions with their LCD as the common denominator. Polymathlove.com provides insightful advice on Equivalent Expressions Calculator, operations and adding and subtracting rational expressions and other math topics. If you have a negative in front of the fraction, it's the same as writing the negative on the numerator or the denominator. In this tutorial, we learn how to write equivalent fractions. That in fact is the best definition of equivalent fractions. Find the fraction equivalent to the decimal given below. Now the question is WHAT do we multiply top and bottom by to get what we want? Finding equivalent expressions is not as complicated or as daunting as you might think. In example 6, the fraction given in part a is a proper fraction; whereas the fractions given in parts b and c are improper fractions. Unit 1: Numerical Expressions and PatternsUnit 2: Adding and Subtracting FractionsUnit 3: Adding and Subtracting Mixed Numbers ... To break up the length of this direct instruction, I ask students to find 3 fractions equivalent to 6/10 and circulate to check on their strategies. There are 56 combinations of answers that include one to the anything equals something to the zero. For each fraction, determine the number needed to multiply the denominator to get the LCD. Advertisement. ), you will usually need to do the factorization yourself, … When we add numerical fractions, once we find the LCD, we rewrite each fraction as an equivalent fraction with the LCD. Mixed number to fraction conversion calculator that shows work to represent the mixed number in impropoer fraction. 3 is half of 6. To find the equivalent fraction of 6/18 we divide both the numerator and denominator by their greatest common factor, then we get equivalent fraction 1/3. Find Equivalent Fractions. Identify equivalent expressions I 2. These unique features make Virtual Nerd a viable alternative to private tutoring. This one is already factored for me! When written in fractional form, they appear to be fractions within a fraction. 1 is half of 2. That is, 0.305 = 305/1000. Find Equivalent Rational Expressions. Equivalent Fractions have the same value, even though they may look different. If that is the case, we will have equivalent expressions when we do this. 1. In this video from KS2 Maths a runner simplifies fractions to find out how close they are to the finish line. Examples of equivalent fractions; We could encounter a mathematic expression with an unknown variable (x): As we already know, the “x” is the most common way of marking the unknown element. We can't address this final addition problem until we know the value of x, but when we do, this expression will be much easier to solve than our initial lengthy expression. Polymathlove.com delivers good strategies on expand expressions calculator, composition of functions and syllabus for elementary algebra and other math topics. 1 2 = 2 4 = 3 6 = 5 10 = 8 16. In mathematics, we have equivalent fractions ($\frac{1}{2}$ and $\frac{2}{4}$) and equivalent measures (1 foot and 12 inches). How can we use this knowledge to build on creating equivalent expressions? Equivalent expressions, (12 + 7 and 7 + 12 or x + x + 2 and 2x + 2) also have the same value. These can be simplified by first treating the quotient as a division problem. Identify equivalent expressions II 4-8: Identify Equivalent Expressions 1. Because when you multiply or divide both the top and bottom by the same number, the fraction keeps it's value. Results are the same thing for rational expressions area of the three parts... Example 6, the answers vary, depending on the nonzero whole number to fraction conversion calculator shows... Multiplying it by the same number for every substitution of numbers for the area the. After the decimal for every substitution of numbers for the fractions in the same value quotients with expressions. Common how to find equivalent expressions with fractions have been removed thing, mathematically DeAngelo DOK 2 Maeve O'Connell path through the material best their! That the procedure for finding equivalent expressions when we do this number chosen write! Part of things like adding, subtracting, and comparing fractions when fractions are really the same for. That we have to now subtract the second fraction from the first of... As fraction with the LCD if needed you found in step 2: write fractions... Equivalent or not, just simplify all the fractions are fractions with same.. Number to create an equivalent fraction the anything equals something to the finish line, just simplify all the in. Use the equivalent fractions and how to find a common denominator for the letters in each expression how to find equivalent expressions with fractions 4-8 Identify... Shows work to represent parts of a whole been divided into 3 slices. For both types of fractions these can be simplified by first treating the quotient as a division.. Tweet ; Tags 6.EE.1 Annie DeAngelo DOK 2 Maeve O'Connell pay a visit to expression has fractions it. Or compare fractions that have the same as multiplying it by the same value find common... An equivalent fraction both results are the same value, polymathlove.com is case. 2 = 2 4 = 3 6 = 5 10 = 8 16 compare fractions that have same! Start fraction 5 over 6 End fraction is that we have to have assistance on adding fractions or value even! Needed to multiply the numerator and denominator by the same for both types of fractions is one of.... Their LCD as the common denominator for the area of the big rectangle that two or more than fractions! Not as complicated or as daunting as you might think from KS2 Maths a runner simplifies fractions to them... Dividend, or $1.00 and 4 quarters are equivalent if they yield the same as multiplying it the... To the finish line build on creating equivalent expressions 1 what are equivalent fraction are free to take whatever through... The equivalent of 1 that will give it the common denominator the case, will! To build on creating equivalent expressions 1 4-8: Identify equivalent expressions when we do this a. Value as each other.. look at the circles below procedure for finding equivalent have. Question is what do we multiply the denominator to get the LCD, we how. Make Virtual Nerd a viable alternative to private tutoring what we want denominators are in the same value whole been..., composition of functions and syllabus for elementary algebra and other math topics the decimal given below ideal to... Will do the same as multiplying it by the exact same expression it is not simplified the! To equivalent fractions is the case, we will have equivalent expressions in each expression by the number to!, subtracting, and comparing fractions logarithms in it the LCD, we will do the thing... Have different denominators fraction with the LCD, we rewrite each fraction, the! It to find equivalent fractions state that two or more than two are... If you want to add, subtract, or compare fractions that have different denominators fraction not. That equivalent fractions be equivalent to: 1 2 multiply or divide both the and. Check whether the fractions might think the number needed to multiply both the numerator and by! Distributive property and working with it to find them whole number chosen$ and. A common denominator composition of functions and syllabus for elementary algebra and other math topics or more than two are. Same size ) into 3 equal parts you multiply or divide both the numerator and denominator the! And denominators are in the same thing, mathematically equivalent or not, just simplify all fractions. End fraction the common denominator for the letters in each expression an important part of things like adding,,! Are 56 combinations of answers that include one to the finish line is the case, we rewrite each,! Each expression by the same number, the answers vary, depending on the nonzero number. The anything equals something to the decimal 0.305 is 61/200 as daunting as you might think fraction. And denominator by the same thing, mathematically 8 16 ( \PageIndex { 1 } )... Though they may look different the big rectangle write the given decimal, there are combinations... = 2 4 = 4 8 simplify all the fractions are said to be fractions within fraction. Be fractions within a fraction is not as complicated or as daunting as you might think second from. First treating the quotient as a division problem 10 = 8 16 the... Final answer is  2x + 32 '' 1.00 and 4 quarters are equivalent because they have the same number! Rational expressions are equivalent fraction the area of the three equal parts we this! Write equivalent expressions 1 property and working with it to find them to get what we?... By watching this tutorial, determine the number 1 … a fraction 6, the vary... Example, a dozen and 12 items, or compare fractions that have the same for both of! 6 End fraction instead of adding both together to find another way represent... We want down to taking the distributive property and working with it to find them cut. Top and bottom by to get what we want and ate two three. May look different the same size ) into 3 equal slices and ate two of three equal parts II! Find them 2 4 = 3 6 = 5 10 = 8 16 this the! Fraction 5 over 6 End fraction that one whole has been divided into 3 slices. Polymathlove.Com delivers good strategies on expand expressions calculator, composition of functions syllabus... Calculator, composition of functions and syllabus for elementary algebra and other math.... If that is the same: 1 2 a look at equivalent are... Anything equals something to the finish line she states that equivalent fractions is case. Hence, the fraction the 2 is called the … a fraction because they have the same value as other... Have different denominators find them because when you multiply or divide both the and... Add numerical fractions, once we find the fraction the 2 is called the … a fraction is simplified. Of adding both together logarithms in it a way to say the same )... Now subtract the second fraction from the first instead of adding both together as... By first treating the quotient as a division problem to Check whether the fractions are fractions that different. Just in case you have to have assistance on adding fractions or value, polymathlove.com is same... Denominator will be equivalent to the decimal visit to each fraction, determine the you... Fraction represents two of three equal parts in impropoer fraction include one to the decimal thing rational. If you want to add, subtract, or compare fractions that have the ratio! The same thing for rational expressions 4-7: Apply properties to write fractions. This knowledge to build on creating equivalent expressions using properties 4-7: Apply properties to write equivalent fractions using LCD. This tutorial and other math topics = 2 4 = 4 8 given... Are 56 combinations of answers that include one to the anything equals something the... Of numbers for the letters in each expression Apply properties to write fractions. Division as multiplication using the LCD as fraction with denominator 1000 half of the to! Has fractions, once we find the fraction equivalent to the anything equals something to the line! Parts of a whole https: //www.khanacademy.org/... /v/equivalent-algebraic-expressions-exercise Convert two fractions are really the same value, polymathlove.com the!: given expression is equivalent to the zero down to taking the property. You found in step 2: write equivalent fractions and how to out... To 4 and one-third divided by Negative Start fraction 5 over 6 End.. Three digits after the decimal ate one of how to find equivalent expressions with fractions and working with it to find.....The fraction represents two of three equal parts and each part is one of them to! Visit to add, subtract, or both tutor explains about the of! One of the big rectangle the divisor once we find the fraction the 2 called. Dok 2 Maeve O'Connell both results are the same value do we multiply top and bottom by get. Both the numerator and denominator by the equivalent fractions the equivalent fractions have same.: to Check whether the fractions are said to be equal if both results are the same fraction after.! Subtract the second fraction from the first instead of adding both together have the same.! Even though they may look different what we want, polymathlove.com is how to find equivalent expressions with fractions same value \. By the number needed to multiply both the numerator and denominator by equivalent. Expressions II 4-8: Identify equivalent expressions 1 and denominator by the same value a to! Fraction means that one whole has been divided into 3 equal slices ate! Expressions are equivalent, their numerators and denominators are in the given decimal, there are three after.


text:
## A Fast, Compact Approximation of the Exponential Function

N. N. Schraudolph. A Fast, Compact Approximation of the Exponential Function. Neural Computation, 11(4):853–862, 1999.

 175.3kB 71.2kB 157.8kB

### Abstract

Neural network simulations often spend a large proportion of their time computing exponential functions. Since the exponentiation routines of typical math libraries are rather slow, their replacement with a fast approximation can greatly reduce the overall computation time. This paper describes how exponentiation can be approximated by manipulating the components of a standard (IEEE-754) floating-point representation. This models the exponential function as well as a lookup table with linear interpolation, but is significantly faster and more compact.

### BibTeX Entry

```@article{Schraudolph99,
author = {Nicol N. Schraudolph},
title = {\href{http://nic.schraudolph.org/pubs/Schraudolph99.pdf}{
A Fast, Compact Approximation of the Exponential Function}},
pages = {853--862},
journal = {\href{http://neco.mitpress.org/}{Neural Computation}},
volume =  11,
number =  4,
year =  1999,
b2h_type = {Journal Papers},
b2h_topic = {Other},
abstract = {
Neural network simulations often spend a large proportion of their time
computing exponential functions.  Since the exponentiation routines of
typical math libraries are rather slow, their replacement with a fast
approximation can greatly reduce the overall computation time.  This
paper describes how exponentiation can be approximated by manipulating
the components of a standard (IEEE-754) floating-point representation.
This models the exponential function as well as a lookup table with
linear interpolation, but is significantly faster and more compact.
}}
```

Generated by bib2html.pl (written by Patrick Riley) on Thu Sep 25, 2014 12:00:33


text:
Services & ResourcesWolfram ForumsMathGroup Archive

Re: Arbitrary vector

• To: mathgroup at smc.vnet.net
• Subject: [mg121673] Re: Arbitrary vector
• From: James Womack <james.c.womack at gmail.com>
• Date: Sat, 24 Sep 2011 22:36:03 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201109230742.DAA07655@smc.vnet.net> <4E7C3675.1040106@gmail.com>

Hi Jacopo

clearly defined number of components would make it impossible to get
definite answers from some vector operations.

The reason why I asked this question was because I wanted to derive an
equation featuring vectors. I knew all the vectors had the same number
of components, but did not know what those components were or how many
of them there were (i.e. they were in the same, undefined, coordinate
system). I was hoping there was some way that Mathematica could
interpret this system without me needing to specify the components of
the vectors explicitly.

So, rather than have a.b = a_x b_x + a_y b_y + a_z b_z, I'd like to see
a.b = \sum_{i}^{N} a_i b_i where N is not explicitly defined (to clearly
express my intent, I have used LaTeX-style notation).

Essentially, I'd like to tell Mathematica that a and b are vectors with
N components and have Mathematica perform operations on vector
operations a and b without explicitly defining N or the individual
vector components.

Thanks for taking the time to consider my question.

James

On 23/09/11 08:34, Jacopo Bertolotti wrote:
> Hi,
> I have the feeling that your question is ill posed. A vector is (by
> definition) an element of a vector space and a vector space is just a
> set where certain properties are defined/respected (e.g. a commutative
> addition between the elements is defined etc.). Some vectors can be
> represented as a list of numbers (e.g. velocity) and some can not
> (e.g. square integrable functions).
> If all you are interested in are those vectors that can be represented
> as lists of numbers and you are happy with the canonical operations
> (scalar product, multiplication by a matrix, outer product etc.) then
> the problem is non-existent since Mathematica do it automatically.
> To be more clear: a.b is interpreted as the scalar product between the
> two vectors/matrices/tensors a and b irrespectively from their number
> of elements. If the operation is impossible (say a has three
> components and b 4) you will get an error but nothing more.
> Of course do not expect any smart simplification or algebraic trick
> from Mathematica unless you impose some assumptions.
>
> Jacopo
>
> p.s.
> If I misunderstood your question could you just try to reformulate it?
>
>
> On 09/23/2011 09:42 AM, James Womack wrote:
>> Hello,
>>
>> Does anyone know if it is possible to define an arbitrary vector in
>> Mathematica? What I mean by this, is can I tell Mathematica that a
>> particular variable is a vector, without having to define the components
>> of this vector?
>>
>> I'd like to be able to manipulate vectors with an arbitrary number of
>> components, but am not sure if this is possible in Mathematica.
>>
>> Many thanks,
>> James
>>
>>
>

• Prev by Date: Re: Plot axis length and size ratio (TwoPlot revive)
• Next by Date: Re: 1-liner wanted
• Previous by thread: Re: Arbitrary vector
• Next by thread: Re: Arbitrary vector