text:
# Background

In the last few months before writing this post, there seems to be a sort of a breakthrough in bringing Transformers into the world of Computer Vision.

If I can make a prediction for 2021 - in the next year we are going to see A LOT of papers about using Transformers in vision tasks (feel free to comment here in one year if I’m wrong).

But what is going on inside Vision Transformers? How do they even work? Can we poke at them and dissect them into pieces to understand them better?

“Explainability” might be an ambitious and over-loaded term that means different things to different people, but when I say Explainability I mean the next things:

• (useful for the developer) What’s going on inside when we run the Transformer on this image? Being able to look at intermediate activation layers. In computer vision - these are usually images! These are kind of interpretable since you can display the different channel activations as 2D images.

• (useful for the developer) What did it learn? Being able to investigate what kind of patterns (if any) did the model learn. Usually this is in the form of the question “What input image maximizes the response from this activation?” , and you can use variants of “Activation Maximization” for that.

• (useful for both the developer and the user) What did it see in this image? Being able to Answer “What part of the image is responsible for the network prediction”, sometimes called “Pixel Attribution”.

So we are going to need this for Vision Transformers as well!

In this post we will go over my attempt to do this for Vision Transformers.

Everything here is going to be done with the recently released ‘Deit Tiny’ model from Facebook, i.e:

model = torch.hub.load('facebookresearch/deit:main', 'deit_tiny_patch16_224', pretrained=True)

And we are going to assume 224xx224 input images to make it easier follow the shapes, although it doesn’t have to be.

Python code is released here: https://github.com/jacobgil/vit-explain

The rest of this post assumes you understand how Vision Transformers work.

They are basically vanilla transformers, but the images are split into 14x14 different tokens, where every token represents a 16x16 patch from the image.

Before continuing, you might want to read the two papers given above, and these blog posts about them:

# Q, K, V and Attention.

A Vision Transformer is composed of a few Encoding blocks, where every block has:

• A few attention heads, that are responsible, for every patch representation, for fusing information from other patches in the image.
• An MLP that transforms every patch representation into a higher level feature representation.
• Both have residual connections. And we will see them in action!

It’s as simple as this, taken from Ross Wightman’s Amazing Pytorch Image Models package implementation of vision transformers:

    def forward(self, x):
x = x + self.drop_path(self.attn(self.norm1(x)))
x = x + self.drop_path(self.mlp(self.norm2(x)))
return x

Inside every attention head (the ‘Deit Tiny’ model has 3 attention heads in every layer), the players are Q,k and V.

The shape of each of these are - 3x197x64

• There are 3 attention heads.

• Each attention heads sees 197 tokens.

• Every token has a feature representation of length 64.

Among these 197 tokens, 196 represent the original image 14x14=196 image patches, and the first token represents a class token that flows through the Transformer, and will be used at the end to make the prediction.

If for every attention head separately, we look inside the second dimension with 197 tokens, we can peek at the last 14x14=196 tokens.

This gives us an image of size 14x14x64 which we can then visualize.

The rows of Q and K, are 64 length feature that represents a location in the image.

We can then think of Q, K and V in the next way: For every image patch with $$q_i$$, Information is going to flow from locations in the image that have keys $$k_j$$ that are similar to that $$q_i$$.

image from http://jalammar.github.io/illustrated-transformer

# Visual Examples of K and Q - different patterns of information flowing

Lets look at an example.

The input to the network is this image of a plane:

We can now look at the Q and K images in different layers, and visualize them for one of the 64 channels c.

This activation vector is going to be a 14x14 image, with positive and negative values, that seem to be in the range [-5, 5].

• $$q_{ic}$$ is the value of the Query feature vector for one of the locations i in the image, in channel c.
• $$k_{jc}$$ is the value of the Key feature vector for one of the locations j in the image, in channel c.

Here is a tricky part:

For every location j in K (remember that it comes from one of the 14x14 patches in the original image), we can ask “how is that location going to spread information to other parts of the image?”

Since we take the dot product between the token vectors (every $$q_{i}$$ and $$k_{j}$$), there are two scenarios:

• Two tokens, in the same channel c, $$q_{ic}$$ and $$k_{jc}$$, have the same sign (both are positive or negative)- their multiplication is positive.

This means that the image location j and channel c - $$k_{jc}$$ - is going to contribute to flowing information into that image location $$q_{i}$$.

• Two tokens, in the same channel c, $$q_{ic}$$ and $$k_{jc}$$, have different signs (one is positive and one is negative)- their multiplication is negative.

This means that the image j location and channel c - $$k_{jc}$$ - is NOT going to contribute to flowing information into that image location $$q_{i}$$.

To contrast the negative and positive pixels, we’re going to pass every image through a torch.nn.Sigmoid() layer (the bright values are positive, the dark values are negative).

From looking at the Q,K visualizations for different channels I think there are kind of two patterns that emerge.

## Pattern 1 - The information flows in one direction

Layer 8, channel 26, first attention head:

Query image Key image Original
• The key image highlights the Airplane.
• The query image highlights all the image.

For most locations in the Query image, since they are positive, information is going to flow to them only from the positive locations in the Key image - that come from the Airplane.

Q, K here are telling us -

We found an airplane, and we want all the locations in the image to know about this!

## Pattern 2 - The information flows in two directions

Layer 11, channel 59, first attention head:

Query image Key image Original
• The Query image highlights mainly the bottom part of the Airplane.
• The Key image is negative in the top part of the Airplane.

The information flows in two directions here:

• The top part of the plane (negative values in the Key) is going to spread into all the image (negative values in the Query).

Hey we found this plane, lets tell the rest of the image about it.

• Information from the “Non Plane” parts of the image (positive values in the Key) is going to flow into the bottom part of the Plane (positive values in the Query).

Lets tell the plane more about what's around it.

# How do the Attention Activations look like for the class token throughout the network?

Another thing we can do is visualize how the attention flows for the class token, in different layers in the network.

Since we have multiple attention heads, to keep it simple we will just look at the first one.

The attention matrix ($$Q*K^T$$) has a shape of 197x197.

If we look at the first row (shape 197), and discard the first value (left with shape 196=14x14) that’s how the information flows from the different locations in the image to the class token.

Here is how the class attention activations looks like through the layers:

It looks like from layer 7 the network was able to segment the plane pretty well.

However - if we look at consecutive layers, some plane parts are lost, and then re-appear again:

And we can thank the residual connections for this!

Although the attention suddenly discarded parts of the plane (the middle image above), we don’t loose that information since we have a residual connection from the previous layer.

# Attention Rollout

The images above show us how individual activations look like, but they don’t show us how the attention flows from the start to the end throughout the Transformer.

To quantify this we can use a technique called “Attention Rollout” from Quantifying Attention Flow in Transformers, by Samira Abnar and Willem Zuidema

This is also what the authors at An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale suggested.

At every Transformer block we get an attention Matrix $$A_{ij}$$ that defines how much attention is going to flow from token j in the previous layer to token i in the next layer.

We can multiply the Matrices between every two layers, to get the total attention flow between them.

However - we also have the residual connections (like we saw in the previous section).

We can model them by adding the identity matrix I to the layer Attention matrices: $$A_{ij} + I$$.

#### We have multiple attention heads. What do we do about them?

The Attention rollout paper suggests taking the average of the heads. As we will see, it can make sense using other choices: like the minimum, the maximum, or using different weights.

Finally we get a way to recursively compute the Attention Rollout matrix at layer L:

$AttentionRollout_{L} = (A_L + I ) \dot AttentionRollout_{L-1}$

We also have to normalize the rows, to keep the total attention flow 1.

# Modifications to get Attention Rollout working with Vision Transformers

I implemented this and ran this on the recent ‘Data Efficient’ models from Facebook, but the results weren’t quite as nice as in the An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale, paper.

Results were very noisy, and the attention doesn’t seem to focus only on the interesting part of the image.

Trying to get this to work, I noticed two things:

## The way we fuse the attention heads matters

For example, here is how the result looks if we take minimum value among the attention heads, instead of the mean value as suggested in the Attention Rollout paper:

Image Mean Fusion Min Fusion

Different attention heads look at different things, so I guess taking the minimum removes noise by finding their common denominator.

However, combined with discarding low attention pixels (next section), fusing the attention heads with the maximum operator seems to work best.

## We can focus only on the top attentions, and discard the rest

Discarding the lowest attention values has a huge effect in how the results look like.

Here is it how it looks as we increase the portion of attention pixels we discard:

As you can see, the more pixels we remove, we are able to better isolate the salient object in the image.

Finally, here is how it looks like for a few different images:

Image Vanilla Attention Rollout With discarding lowest pixels + max fusion

# Gradient Attention Rollout for Class Specific Explainability

Edit - it turns out there is another technique out there about this!

Apart from what I implemented below, I refer you to Hila Chefer’s Transformer Interpretability Beyond Attention Visualization and their github repo.

Another question we can ask is - “What in the image contributes to a higher output score in category 42?”

Or in other words, Class Specific Explainability.

When fusing the attention heads in every layer, we could just weight all the attentions (in the current implementation it’s the attentions after the softmax, but maybe it makes sense to change that) by the target class gradient, and then take the average among the attention heads.

$A_{ij} * grad_{ij}$

# What Activation Maximization Tells us

Another thing we can do, is apply Activation Maximization, to find the kind of image inputs that maximize different parts in the network.

In Vision Transformers the images are split into 14x14 independent patches (that represent 16x16 pixels).

We also see this in the Activation Maximization result below- instead of getting a continuous image, we get 14x14 patches.

Since the positional embeddings are added to the inputs, nearby patches should get more similar outputs.

I think you can see this in the image below - many neighboring patches look similar, but they also have a discontinuity between them.

I guess future work can be about using some kind of a spatial continuity constraint between the patches here (and maybe also incorporate that into how the transformers process the images).

# Summary

In this post we applied Explainability techniques for Vision Transformers.

This was my attempt to try to better understand how are they working and what’s going on inside them.

You can access the code here: https://github.com/jacobgil/vit-explain

I hope you enjoyed.

format: plain


text:
# Finding the maximum likelihood estimator

Given a sample of size $n$ from $Ber(\theta)$ distribution, where $0\leq\theta\leq\frac{1}{2}$, we need to find the maximum likelihood estimator for $\theta$.

Now, the solution says $\hat{\theta}=min\{\bar{x},\frac{1}{2}\}$.

But I beg to differ, and I'll try to explain why below, please correct me if I am wrong !

The likelihood function goes as follows :

$L(x_1,x_2,....,x_n;\theta)=\theta^{\sum x_i}(1-\theta)^{n-\sum{x_i}}$

Take $log$ both sides :

$log(L(x_1,x_2,....,x_n;\theta))=\sum x_i log(\theta)+(n-\sum{x_i})log(1-\theta)$

So we kinda want to maximize this function for $\theta$,

Let $h(\theta)=\sum x_i log(\theta)+(n-\sum{x_i})log(1-\theta)$

Differentiate w.r.t $\theta$ :

$h'(\theta)=\dfrac{\sum x_i}{\theta}-\dfrac{(n-\sum{x_i})}{(1-\theta)}=\dfrac{\sum x_i}{\theta(1-\theta)}-\dfrac{n}{(1-\theta)}=\dfrac{1}{1-\theta}(\dfrac{\sum x_i}{\theta}-n)=\dfrac{n}{1-\theta}(\dfrac{\bar{x}}{\theta}-1)$

So, the function increases when $h'(\theta)>0$, i.e $(\dfrac{\bar{x}}{\theta}-1)>0$ or $\theta<\bar{x}$, so, in case of the likelihood function increasing, $\hat{\theta}=max(\frac{1}{2},\bar{x})$ maximizes it.

Whereas, when $h'(\theta)<1$, we have $\theta>\bar{x}$ and in case of such a decreasing function, the function is maximized at the lowest value of $\theta$, which is $\bar{x}$, hence $\hat{\theta}=\bar{x}$.

I don't really know where I went wrong here, can anyone help ?

• – StubbornAtom May 10 '18 at 20:55

You have already figured out that the log-likelihood $\ell(\theta)$ is increasing for $0 \leqslant \theta < \bar{x}$ and then decreasing for $\bar{x} < \theta \leqslant 1$. This means that when you look at the function over the whole range $0 \leqslant \theta \leqslant 1$ you see that it is maximised at $\theta = \bar{x}$ and decreases on either side of this.
Now, let's impose your parameter constraint $0 \leqslant \theta \leqslant \tfrac{1}{2}$. If $\bar{x} \leqslant \tfrac{1}{2}$ then the global maximising value (in the unconstrained problem) is in the parameter range and so you have MLE $\hat{\theta} = \hat{x}$. If $\bar{x} > \tfrac{1}{2}$ then the log-likelihood function is strictly increasing over the parameter range, but it never gets to the global maximising value in the unconstrained problem. In this case the maximum occurs at the right-boundary, so you have MLE $\hat{\theta} = \tfrac{1}{2}$. Putting these together you have:
$$\hat{\theta} = \begin{cases} \bar{x} & \text{if }\bar{x} \leqslant \tfrac{1}{2} \\ \tfrac{1}{2} & \text{if }\bar{x} > \tfrac{1}{2} \end{cases} = \min (\bar{x}, \tfrac{1}{2}).$$


text: • Yep, also check if normals are pointing in a consistent way, or try to fix them by selecting all faces in edit mode and recalculating normals with Ctrl+N – Duarte Farrajota Ramos May 15 '17 at 17:55


text:
# How do you factor the expression 2n^2 + 15n + 7?

Dec 3, 2015

Factor y = 2n^2 + 15n + 7

Ans: (2n + 1)(n + 7)

#### Explanation:

y = 2n^2 + 15n + 7 = 2(x + p)(x + q)
I use the new AC Method to factor trinomials (Socratic Search).
Converted trinomial: y' = x^2 + 15n + 14 = (x + p')(x + q').
Factor pairs of (14) --> (1, 14). This sum is (1 + 14 = 15 = b). Then, p' = 1 and q' = 14.
Therefor: p = (p'/a) = 1/ 2 and q = (q')/a = 14/2 = 7.
Factored form: y = 2(n + 1/2)(n + 7) = (2n + 1)(n + 7).


text:
# 6.3 Properties of the ctfs

 Page 1 / 1
An introduction to the general properties of the Fourier series

## Introduction

In this module we will discuss the basic properties of the Continuous-Time Fourier Series. We will begin by refreshing your memory of our basic Fourier series equations:

$f(t)=\sum_{n=()}$ c n ω 0 n t
${c}_{n}=\frac{1}{T}\int_{0}^{T} f(t)e^{-(i{\omega }_{0}nt)}\,d t$
Let $ℱ(·)$ denote the transformation from $f(t)$ to the Fourier coefficients $ℱ(f(t))=\forall n, n\in \mathbb{Z}\colon {c}_{n}$ $ℱ(·)$ maps complex valued functions to sequences of complex numbers .

## Linearity

$ℱ(·)$ is a linear transformation .

If $ℱ(f(t))={c}_{n}$ and $ℱ(g(t))={d}_{n}$ . Then $\forall \alpha , \alpha \in \mathbb{C}\colon ℱ(\alpha f(t))=\alpha {c}_{n}$ and $ℱ(f(t)+g(t))={c}_{n}+{d}_{n}$

Easy. Just linearity of integral.

$ℱ(f(t)+g(t))=\forall n, n\in \mathbb{Z}\colon \int_{0}^{T} (f(t)+g(t))e^{-(i{\omega }_{0}nt)}\,d t=\forall n, n\in \mathbb{Z}\colon \frac{1}{T}\int_{0}^{T} f(t)e^{-(i{\omega }_{0}nt)}\,d t+\frac{1}{T}\int_{0}^{T} g(t)e^{-(i{\omega }_{0}nt)}\,d t=\forall n, n\in \mathbb{Z}\colon {c}_{n}+{d}_{n}={c}_{n}+{d}_{n}$

## Shifting

Shifting in time equals a phase shift of Fourier coefficients

$ℱ(f(t-{t}_{0}))=e^{-(i{\omega }_{0}n{t}_{0})}{c}_{n}$ if ${c}_{n}=\left|{c}_{n}\right|e^{i\angle ({c}_{n})}$ , then $\left|e^{-(i{\omega }_{0}n{t}_{0})}{c}_{n}\right|=\left|e^{-(i{\omega }_{0}n{t}_{0})}\right|\left|{c}_{n}\right|=\left|{c}_{n}\right|$ $\angle (e^{-(i{\omega }_{0}{t}_{0}n)})=\angle ({c}_{n})-{\omega }_{0}{t}_{0}n$

$ℱ(f(t-{t}_{0}))=\forall n, n\in \mathbb{Z}\colon \frac{1}{T}\int_{0}^{T} f(t-{t}_{0})e^{-(i{\omega }_{0}nt)}\,d t=\forall n, n\in \mathbb{Z}\colon \frac{1}{T}\int_{-{t}_{0}}^{T-{t}_{0}} f(t-{t}_{0})e^{-(i{\omega }_{0}n(t-{t}_{0}))}e^{-(i{\omega }_{0}n{t}_{0})}\,d t=\forall n, n\in \mathbb{Z}\colon \frac{1}{T}\int_{-{t}_{0}}^{T-{t}_{0}} f(\stackrel{~}{t}())e^{-(i{\omega }_{0}n\stackrel{~}{t})}e^{-(i{\omega }_{0}n{t}_{0})}\,d t=\forall n, n\in \mathbb{Z}\colon e^{-(i{\omega }_{0}n\stackrel{~}{t})}{c}_{n}$

## Parseval's relation

$\int_{0}^{T} \left|f(t)\right|^{2}\,d t=T\sum_{n=()}$ c n 2
Parseval's relation tells us that the energy of a signal is equal to the energy of its Fourier transform.
Parseval tells us that the Fourier series maps $L(\left[0 , T\right])^{2}$ to $l(\mathbb{Z})^{2}$ .

For $f(t)$ to have "finite energy," what do the ${c}_{n}$ do as $n\to$ ?

$\left|{c}_{n}\right|^{2}$ for $f(t)$ to have finite energy.

If $\forall n, \left|n\right|> 0\colon {c}_{n}=\frac{1}{n}$ , is $f\in L(\left[0 , T\right])^{2}$ ?

Yes, because $\left|{c}_{n}\right|^{2}=\frac{1}{n^{2}}$ , which is summable.

Now, if $\forall n, \left|n\right|> 0\colon {c}_{n}=\frac{1}{\sqrt{n}}$ , is $f\in L(\left[0 , T\right])^{2}$ ?

No, because $\left|{c}_{n}\right|^{2}=\frac{1}{n}$ , which is not summable.

The rate of decay of the Fourier series determines if $f(t)$ has finite energy .

## Even signals

• $f\left(t\right)=f\left(-t\right)$
• $\parallel {c}_{n}\parallel =\parallel {c}_{-n}\parallel$
• ${c}_{n}=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt+\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(-t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt+\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(-t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)\left[exp,\left(ı{\omega }_{0}nt\right),\phantom{\rule{0.166667em}{0ex}},d,t,+,exp,\left(-ı{\omega }_{0}nt\right)\right]\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)2cos\left({\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$

## Odd signals

• $f\left(t\right)=\mathrm{-f}\left(\mathrm{-t}\right)$
• ${c}_{n}={c}_{-n}$ *
• ${c}_{n}=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt+\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt-\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(-t\right)exp\left(ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=-\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)\left[exp,\left(ı{\omega }_{0}nt\right),\phantom{\rule{0.166667em}{0ex}},d,t,-,exp,\left(-ı{\omega }_{0}nt\right)\right]\phantom{\rule{0.166667em}{0ex}}dt$
• $=-\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)2ısin\left({\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$

## Real signals

• $f\left(t\right)=f$ * $\left(t\right)$
• ${c}_{n}={c}_{-n}$ *
• ${c}_{n}=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt+\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{\frac{T}{2}}\phantom{\rule{-0.166667em}{0ex}}f\left(-t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt+\frac{1}{T}{\int }_{\frac{T}{2}}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(-t\right)exp\left(-ı{\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)\left[exp,\left(ı{\omega }_{0}nt\right),\phantom{\rule{0.166667em}{0ex}},d,t,+,exp,\left(-ı{\omega }_{0}nt\right)\right]\phantom{\rule{0.166667em}{0ex}}dt$
• $=\frac{1}{T}{\int }_{0}^{T}\phantom{\rule{-0.166667em}{0ex}}f\left(t\right)2cos\left({\omega }_{0}nt\right)\phantom{\rule{0.166667em}{0ex}}dt$

## Differentiation in fourier domain

$(ℱ(f(t))={c}_{n})\implies (ℱ(\frac{d f(t)}{d t}})=in{\omega }_{0}{c}_{n})$

Since

$f(t)=\sum_{n=()}$ c n ω 0 n t
then
$\frac{d f(t)}{d t}}=\sum_{n=()}$ c n t ω 0 n t n c n ω 0 n ω 0 n t
A differentiator attenuates the low frequencies in $f(t)$ and accentuates the high frequencies. It removes general trends and accentuates areas of sharpvariation.
A common way to mathematically measure the smoothness of a function $f(t)$ is to see how many derivatives are finite energy.
This is done by looking at the Fourier coefficients of thesignal, specifically how fast they decay as $n\to$ .If $ℱ(f(t))={c}_{n}$ and $\left|{c}_{n}\right|$ has the form $\frac{1}{n^{k}}$ , then $ℱ(\frac{d^{m}f(t)}{dt^{m}})=(in{\omega }_{0})^{m}{c}_{n}$ and has the form $\frac{n^{m}}{n^{k}}$ .So for the ${m}^{\mathrm{th}}$ derivative to have finite energy, we need $\sum \left|\frac{n^{m}}{n^{k}}\right|^{2}$ thus $\frac{n^{m}}{n^{k}}$ decays faster than $\frac{1}{n}$ which implies that $2k-2m> 1$ or $k> \frac{2m+1}{2}$ Thus the decay rate of the Fourier series dictates smoothness.

## Integration in the fourier domain

If

$ℱ(f(t))={c}_{n}$
then
$ℱ(\int_{()} \,d \tau )$ t f τ 1 ω 0 n c n
If ${c}_{0}\neq 0$ , this expression doesn't make sense.

Integration accentuates low frequencies and attenuates high frequencies. Integrators bring out the general trends in signals and suppress short term variation (which is noise in many cases). Integrators are much nicer than differentiators.

## Signal multiplication and convolution

Given a signal $f(t)$ with Fourier coefficients ${c}_{n}$ and a signal $g(t)$ with Fourier coefficients ${d}_{n}$ , we can define a new signal, $y(t)$ , where $y(t)=f(t)g(t)$ . We find that the Fourier Series representation of $y(t)$ , ${e}_{n}$ , is such that ${e}_{n}=\sum_{k=()}$ c k d n - k . This is to say that signal multiplication in the time domainis equivalent to signal convolution in the frequency domain, and vice-versa: signal multiplication in the frequency domain is equivalent to signal convolution in the time domain.The proof of this is as follows

${e}_{n}=\frac{1}{T}\int_{0}^{T} f(t)g(t)e^{-(i{\omega }_{0}nt)}\,d t=\frac{1}{T}\int_{0}^{T} \sum_{k=()} \,d t$ c k ω 0 k t g t ω 0 n t k c k 1 T t 0 T g t ω 0 n k t k c k d n - k
for more details, see the section on Signal convolution and the CTFS

## Conclusion

Like other Fourier transforms, the CTFS has many useful properties, including linearity, equal energy in the time and frequency domains, and analogs for shifting, differentation, and integration.

 Property Signal CTFS Linearity $ax\left(t\right)+by\left(t\right)$ $aX\left(f\right)+bY\left(f\right)$ Time Shifting $x\left(t-\tau \right)$ $X\left(f\right){e}^{-j2\pi f\tau /T}$ Time Modulation $x\left(t\right){e}^{j2\pi f\tau /T}$ $X\left(f-k\right)$ Multiplication $x\left(t\right)y\left(t\right)$ $X\left(f\right)*Y\left(f\right)$ Continuous Convolution $x\left(t\right)*y\left(t\right)$ $X\left(f\right)Y\left(f\right)$

is the law of independent assortment same as the law of dominance?
explain the process of digestion in animal
discuss the ueses of human cell
what is hormone
they are liquid substance which are essential for different body functions
Ed
the meaning of warm classroom
How is an image formed at the retina
what is gland
what's cells?
hi santino Cells is a basic unit of life
Yohannes
the structural and functional units of life is known as cell
Rathod
good night all friends
Rathod
u too
Papaye
y do plants have a single respiratory system?
Papaye
hey
Chinwe
Chinwe
what is a meiosis
what is a mitosis
Mercy
meiosis is a cell division that produces 4 daughter cell that doesn't look alike
Damilola
mitosis is a cell division that produces two daugther cell that looks alik
Damilola
what is call division
mitosis
Damilola
what are the effects of transpiration
Are extraterrestrials mostly sited on land or in the sea also?
what's sperm
what is gaseous exchange
what is respiration
Lubna
hi lubna respiration is the breakdown of food with or without the use of oxygen to produce energy, carbon dioxide and water and it takes place in cells
caleb
fart😥😂
Golden
what is the structure of a cell
cell membrane, nucleus and cytoplasm lie upon the two
Jamiu
is a cell membrame
KIHEMBO
types of diffusion
KIHEMBO
two types of transpiration
KIHEMBO
Passive and active transport
Dillenia
nidhi
Nidhi
Got questions? Join the online conversation and get instant answers!


text:
# All

## Signatures of Many-Particle Interference. (arXiv:1908.08370v1 [quant-ph])

This Tutorial will introduce the mathematical framework for describing
systems of identical particles, and explain the notion of indistinguishability.
We will then focus our attention on dynamical systems of free particles and
formally introduce the concept of many-particle interference. Its impact on
many-particle transition probabilities is computationally challenging to
evaluate, and it becomes rapidly intractable for systems with large numbers of
identical particles. Hence, this Tutorial will build up towards alternative,

## Scalable Emulation of Stoquastic Hamiltonians with Room Temperature p-bits. (arXiv:1810.07144v3 [quant-ph] UPDATED)

The growing field of quantum computing is based on the concept of a q-bit
which is a delicate superposition of 0 and 1, requiring cryogenic temperatures
for its physical realization along with challenging coherent coupling
techniques for entangling them. By contrast, a probabilistic bit or a p-bit is
a robust classical entity that fluctuates between 0 and 1, and can be
implemented at room temperature using present-day technology. Here, we show
that a probabilistic coprocessor built out of room temperature p-bits can be

## Flexible S-money token schemes. (arXiv:1908.08143v1 [quant-ph])

S-money [Proc. R. Soc. A 475, 20190170 (2019)] schemes define virtual tokens
designed for networks with relativistic or other trusted signalling
constraints. The tokens allow near-instant verification and guarantee
unforgeability without requiring quantum state storage. We present refined two
stage S-money schemes. The first stage, which may involve quantum information
exchange, generates private user token data. In the second stage, which need
only involve classical communications, users determine the valid presentation

## Structure and efficiency in bacterial photosynthetic light-harvesting. (arXiv:1908.08373v1 [physics.bio-ph])

Photosynthetic organisms use networks of chromophores to absorb sunlight and
deliver the energy to reaction centres, where charge separation triggers a
cascade of chemical steps to store the energy. We present a detailed model of
the light-harvesting complexes in purple bacteria, including explicit
processes; and dephasing and thermalizing effects of coupling to a vibrational
bath. An important feature of the model is that we capture the effect of slow

## Fluctuation Theorems for a Quantum Channel. (arXiv:1810.03150v2 [quant-ph] UPDATED)

We establish the general framework of quantum fluctuation theorems by finding
the symmetry between the forward and backward transitions of any given quantum
channel. The Petz recovery map is adopted as the reverse quantum channel, and
the notion of entropy production in thermodynamics is extended to the quantum
regime. Our result shows that the fluctuation theorems, which are normally
considered for thermodynamic processes, can be a powerful tool to study the

## Exact results for the boundary energy of one-dimensional bosons. (arXiv:1908.08172v1 [cond-mat.quant-gas])

We study bosons in a one-dimensional hard wall box potential. In the case of
contact interaction, the system is exactly solvable by Bethe ansatz, as first
shown by Gaudin in 1971. Although contained in the exact solution, the boundary
energy for this problem is only approximately calculated by Gaudin at the
leading order at weak repulsion. Here we derive an exact integral equation that
enables one to calculate the boundary energy in the thermodynamic limit at an

## Supervised learning with a quantum classifier using a multi-level system. (arXiv:1908.08385v1 [quant-ph])

We propose a quantum classifier, which can classify data under the supervised
learning scheme using a quantum feature space. The input feature vectors are
encoded in a single qu$N$it (a $N$ level quantum system), as opposed to more
commonly used entangled multi-qubit systems. For training we use the much used
quantum variational algorithm -- a hybrid quantum-classical algorithm -- in
which the forward part of the computation is performed on a quantum hardware

## Generation of NOON states in waveguide arrays. (arXiv:1904.00470v2 [quant-ph] UPDATED)

We present a method to generate NOON states with three photons by injecting
photons in an array of three waveguides. Conditional measurements project the
wave function in a given (desired) state. In passing, we show how the array of
three waveguides, that effectively reproduces the interaction of three fields,
may be reduced to the interaction of two fields.

## Weak Gravitational Field Effects on Optical Bell Tests. (arXiv:1908.08179v1 [quant-ph])

The technological refinement of experimental techniques has recently allowed
the generation of two-photon polarization entangled states at low Earth orbit,
which have been subsequently applied to quantum communications. This
achievement paves the way to study the interplay between General Relativity and
Quantum Mechanics in new setups. Here, we study the generation of two-photon
entangled states via large scale Franson and Hugged interferometric arrays in
the presence of a weak gravitational field. We show that for certain

## Exact annihilation energy and proper decay time solution of a para-positronium system. (arXiv:1908.08388v1 [quant-ph])

Para positronium composed by an electron-antielectron pair is an unstable
system decaying into two high energetic gamma photons via self annihilation
process, due to the conservation of the charge conjugation parity in
electromagnetically interacting systems. Therefore, the spectrum covering all
fundamental properties of the para-positronium system includes an imaginary
part corresponding to the proper decay time besides the real parts
corresponding to the total annihilation energy and binding energy,


text:
# Number Theory problem

Number Theory Level 5

What is the smallest integer value of $$n$$ such that $$2^n$$ starts with $$\overline{999999999}$$?

×


text:
Skip to main content

## PrefaceFor Instructors

If you are adopting this text in your class, please fill out this short form 5  so we can track usage, let you know about updates, etc.

forms.gle/Ktfbma6iBn2gN1W78


text:
Compiling a spatial predator-prey model and optimising it for speed

I just made a spatial predator-prey model but it runs a little slow and I am seeking some advice on how to compile it to optimise it for speed.

I first define matrix with 0 for an empty site, 1 for a predator and 2 for a prey present:

e = 0;r = 1;y = 2;
initSpace[n_] := RandomInteger[{0, 2} , {n, n}];
space = initSpace[10];

I then defined a getCell function which looks for a neighbour at cell position $(i,j)$ in a matrix sp with a certain value x, and returns the coordinates of that cell; if it doesn't find a cell with that value it returns coordinates $(i,j)$.

getCell =
Compile[{{sp, _Integer,
2}, {i, _Integer}, {j, _Integer}, {x, _Integer}},
Block[{n, m, k2, l2, cells}, {n, m} = Dimensions[sp];
cells = {{i, j}};
Do[k2 = Mod[i + k, n, 1]; (* This is the neighborhood *)
l2 = Mod[j + l, m, 1];
If[(k2 != i || l2 != j) && sp[[k2, l2]] == x,
AppendTo[cells, {k2, l2}]], {l, -1, 1}, {k, -1, 1}];
If[Length[cells] == 1, {i, j}, RandomChoice[Rest[cells]]]],
CompilationTarget -> "C", Parallelization -> True,
RuntimeOptions -> "Speed"]

I then define a module step which calculates the space matrix in the next time step based on a given birth rate b and death rate mu after one event at a random location in the space.

step[b_, mu_] := Block[{i, j, k, l, dim},
dim = Dimensions[space];
i = Random[Integer, {1, dim[[1]]}];
j = Random[Integer, {1, dim[[2]]}];
Which[
(* Predator *)
space[[i, j]] == r,
If[Random[Real] < mu,
(* Predator dying *)
space[[i, j]] = e,
(* Predator eating *)
{k, l} = getCell[space, i, j, y];
space[[k, l]] = r;
],
(* Prey *)
space[[i, j]] == y,
If[Random[Real] < b,
(* Prey reproducing *)
{k, l} = getCell[space, i, j, e];
space[[k, l]] = y
]
]
]

Finally, I do many iterations

 gridsize = 200;
space = initSpace[gridsize];
nrsteps = 100;
stepsize = 5000;
b = 0.9; mu = 0.4;
population = Table[0, {nrsteps}];
Do[Do[step[b, mu];, {stepsize}];
population[[i]] = space;
, {i, 1, nrsteps}];
Animate[
ArrayPlot[population[[i]], ColorRules -> {e -> Black, r -> Red, y -> Blue}],
{i, 1, nrsteps/stepsize, 1}, AnimationRepetitions -> 1,
AnimationRunning -> False]

Ideally I would like to have the latter two modules compiled as well, but when I tried to put Compile[] around them I got a bunch of errors. Does anyone know what I might be doing wrong? Or have any other advice on how I should optimise my code for speed? Or should I try to put everything in a single compiled Module?

-
If you indent your code blocks by 4 spaces (or select it and press the {} button inside the text box on this site), then it gets formatted as code with pretty syntax highlighting. –  rm -rf Nov 16 '12 at 23:46
thx for letting me know - I'm new here as you probably gathered :-) –  Tom Wenseleers Nov 16 '12 at 23:49
No problem; I hope you have fun on this site :) Just for reference, here's a list of editing tips. –  rm -rf Nov 17 '12 at 0:23

Because random number generator requires initialization, multiple calls to RandomInteger result in much slower execution than a single call to generate many samples:

In[18]:= Table[RandomInteger[{1, 10}], {10^7}]; // AbsoluteTiming

Out[18]= {1.300000, Null}

In[19]:= RandomInteger[{1, 10}, 10^7]; // AbsoluteTiming

Out[19]= {0.210000, Null}

This is what happens in your code, since each of the numerous calls to function step generate 3 calls to random number generator. You code can be sped-up by a factor of 2 by replacing Do[ step[b,mu], {stepsize}] with a call to steps[b, mu, stepsize], where steps is as follows:

steps[b_, mu_, rep_] := Block[{i, j, k, l, dim, q, is, js, qs, val},
dim = Dimensions[space];
is = RandomInteger[{1, dim[[1]]}, rep];
js = RandomInteger[{1, dim[[2]]}, rep];
qs = RandomReal[1, rep];
Do[
i = Part[is, p]; j = Part[js, p]; q = Part[qs, p];
val = space[[i, j]];
Which[
(*Predator*)val == r,
If[q < mu,
(*Predator dying*)space[[i, j]] = e,
(*Predator eating*){k, l} = getCell[space, i, j, y];
space[[k, l]] = r;
],
(*Prey*)val == y,
If[q < b,(*Prey reproducing*)
{k, l} = getCell[space, i, j, e];
space[[k, l]] = y]], {p, 1, rep}]
]

-
Many thx for this - that goes quite a bit faster! Is there also a possibility to Compile the steps function though? When I tried it strangely enough ends up going more slowly than the uncompiled version. Any ideas why that migtht be the case? –  Tom Wenseleers Nov 17 '12 at 8:18

I think a big part of your problem are the many global variables. Avoiding this and using @Sasha's suggestions, you can compile the step function. Note the use of CompilationOptions that inlines your getCell function.

step = Compile[{{b, _Real}, {mu, _Real}, {rep, _Integer}, {y,  _Integer},
{r, _Integer}, {e, _Integer}, {space, _Integer, 2}},
Block[{i, j, k, l, dim, q, is, js, qs, val, spaceCopy = space},
dim = Dimensions[space];
is = RandomInteger[{1, dim[[1]]}, rep];
js = RandomInteger[{1, dim[[2]]}, rep];
qs = RandomReal[1, rep];
Do[i = Part[is, p]; j = Part[js, p]; q = Part[qs, p];
val = spaceCopy[[i, j]];
Which[(*Predator*)val == r,
If[q < mu,(*Predator dying*)
spaceCopy[[i, j]] = e,(*Predator eating*){k, l} =
getCell[spaceCopy, i, j, y];
spaceCopy[[k, l]] = r;],(*Prey*)val == y,
If[q < b,(*Prey reproducing*){k, l} =
getCell[spaceCopy, i, j, e];
spaceCopy[[k, l]] = y]], {p, 1, rep}];
spaceCopy],
CompilationOptions -> "InlineExternalDefinitions" -> True];

You can then re-write your simulation as follows.

sim[y_: 2, r_: 1, e_: 0, gridsize_: 200, nrsteps_: 100,
stepsize_: 5000, b_: 0.9, mu_: 0.4] :=
Block[{space = initSpace[gridsize], population = InternalBag[]},
Do[InternalStuffBag[population,
space = step[b, mu, stepsize, y, r, e, space], 2], {nrsteps}];
Partition[#, gridsize] & /@
Partition[InternalBagPart[population, All], gridsize*gridsize]
]

This is now fairly fast (though I'm sure additional improvements could be made).

AbsoluteTiming[population = sim[];]

(*{0.6708012, Null}*)

Animate[ArrayPlot[population[[i]],
ColorRules -> {e -> Black, r -> Red, y -> Blue}], {i, 1,
stepsize/nrsteps, 1}, AnimationRepetitions -> 2,
AnimationRunning -> False]
`

-
Thanks so much - wow that was a lot faster indeed! –  Tom Wenseleers Nov 17 '12 at 21:41


text:
Band edge filter for raised cosine impulse

I'm hoping to use an implementation of a frequency-locked loop for rough frequency synchronization in a PSK31 demodulator. The approach is to define a filter that is the derivative of the matched filter in the frequency domain. A couple slides from fred harris illustrate the idea:

I've found implementations for the typical case of a root-raised-cosine pulse shaping filter. However, PSK31 is a bit "special" in that it uses a raised cosine impulse. AKA, the Hann function:

$$h(t) = {1 \over 2}\, (1+\cos(\pi t))\, \Pi(t/2)$$

Where $\Pi$ is the rectangle function.

How can I calculate the appropriate band-edge filter in this case?

• The derivative of the the Fourier transform of $h(t)$ should result in something like $i\omega h(t)$. Look up the derivative theorems of the Fourier transform you're using. Also, I don't understand the $t/t$ argument of the rectangle function, as how it differs from 1. – Andy Walls Jul 6 '17 at 1:40
• @AndyWalls Sorry, the t/t thing was a typo. Fixed. – Phil Frost Jul 6 '17 at 1:45
• Oops that should probably be $-ith(t)$. – Andy Walls Jul 6 '17 at 1:49

It looks like the filter you want is indeed $-ith(t)$. Here is some Octave code to get a visualization in the frequency domain:

t = [-1:0.01:1];
h = 0.5*(1+cos(pi*t));
hd = -i*t*0.5.*(1+cos(pi*t));
H=fftshift(fft(h,512));
HD=fftshift(fft(hd,512));
v = [-256:255];
plot(v, 20*log10(abs(H/512)), v, 20*log10(abs(HD/512)))

BTW, when plotting $h(t)$ in the time domain, your provided $h(t)$ appears to be normalized, spanning from $t = -1$ to $t = 1$. So, I'm guessing your normalized symbol period is $T = 1$ with some ISI, or $T = 2$ with no ISI.

• Wow, that's profoundly simple! I'm doing some work to validate, then I'll accept. Regarding ISI, it's the case with PSK31 that the transmitted waveform has zero ISI, but then of course after matched filtering in the receiver there is again ISI. I'm not sure why the designer of this modem didn't just use a RRC filter. So I think with $T=1$, the $h(t)$ from the question should be correct, because the magnitude is zero at the previous and next symbol: $t(-1) = t(1) = 0$, right? – Phil Frost Jul 6 '17 at 14:42
• So, yeah, the pulse filter meets the Nyquist criterion for being 0 at the optimal sampling point of the next symbol and previous symbol. So no ISI until the receiver filters start introducing it. – Andy Walls Jul 6 '17 at 14:51
• BTW, the derivative property was taken from #107 in the table here: en.wikipedia.org/wiki/… . You may need to consider #104 in conjunction with #107 when you scale the time axis to actual symbol period durations. The devil is in the details. :) – Andy Walls Jul 6 '17 at 14:54
• Regarding the simplicity: yeah, the Fourier ( and Laplace) transform turns calculus in one domain, into algebra in the other. That's why we use the Laplace transform to solve basic passive circuit problems in EE10X classes. $V = I sL$ is easier to handle than $v= L \dfrac {di}{dt}$. :) – Andy Walls Jul 6 '17 at 22:28


text:
## Osaka Journal of Mathematics

### Hyperelliptic surfaces with $K^{2} < 4\chi - 6$

#### Abstract

Let $S$ be a smooth minimal surface of general type with a (rational) pencil of hyperelliptic curves of minimal genus $g$. We prove that if $K_{S}^{2} < 4\chi(\mathcal{O}_{S})-6$, then $g$ is bounded. The surface $S$ is determined by the branch locus of the covering $S \to S/i$, where $i$ is the hyperelliptic involution of $S$. For $K_{S}^{2} < 3\chi(\mathcal{O}_{S})-6$, we show how to determine the possibilities for this branch curve. As an application, given $g > 4$ and $K_{S}^{2}-3\chi(\mathcal{O}_{S}) < -6$, we compute the maximum value for $\chi(\mathcal{O}_{S})$. This list of possibilities is sharp.

#### Article information

Source
Osaka J. Math., Volume 52, Number 4 (2015), 929-947.

Dates
First available in Project Euclid: 18 November 2015

https://projecteuclid.org/euclid.ojm/1447856026

Mathematical Reviews number (MathSciNet)
MR3426622

Zentralblatt MATH identifier
1343.14036

Subjects
Primary: 14J29: Surfaces of general type

#### Citation

Rito, Carlos; Sánchez, María Martí. Hyperelliptic surfaces with $K^{2} < 4\chi - 6$. Osaka J. Math. 52 (2015), no. 4, 929--947. https://projecteuclid.org/euclid.ojm/1447856026

#### References

• T. Ashikaga and K. Konno: Algebraic surfaces of general type with $c\sp 2\sb 1 = 3p\sb g-7$, Tohoku Math. J. (2) 42 (1990), 517–536.
• W.P. Barth, K. Hulek, C.A.M. Peters and A. Van de Ven: Compact Complex Surfaces, second edition, Springer, Berlin, 2004.
• G. Borrelli: The classification of surfaces of general type with nonbirational bicanonical map, J. Algebraic Geom. 16 (2007), 625–669.
• C. Ciliberto and M. Mendes Lopes: On surfaces with $p_{g} = q = 2$ and non-birational bicanonical maps, Adv. Geom. 2 (2002), 281–300.
• K. Konno: Algebraic surfaces of general type with $c_{1}^{2} = 3p_{g} - 6$, Math. Ann. 290 (1991), 77–107.
• C. Rito: Involutions on surfaces with $p_{g} = q = 1$, Collect. Math. 61 (2010), 81–106.
• G. Xiao: Fibered algebraic surfaces with low slope, Math. Ann. 276 (1987), 449–466.
• G. Xiao: Hyperelliptic surfaces of general type with $K^{2} < 4\chi$, Manuscripta Math. 57 (1987), 125–148.
• G. Xiao: Degree of the bicanonical map of a surface of general type, Amer. J. Math. 112 (1990), 713–736.


text:
# Voltage Divider

## Introduction

Voltage dividers are commonly used circuits that split an applied overall voltage into a smaller desired voltage level.

Figure 1 shows a simple voltage divider using fixed resistors to illustrate its functionality. For this illustration, we assume that the resistors are connected in series, and all current flowing out of the 5V voltage source, flows directly through R1 into R2, and then back to the voltage source (no current detours out the Vout wire).

In the “ Button Controlled LEDs” project we briefly mentioned Kirchhoff's voltage law (KVL), which states that the sum of voltage drops (the difference in potential energy across a component) in a circuit loop must equal zero. We will use this property to determine the voltage drops across the individual components in our example circuit.

Figure 2 shows a simplified block diagram of the same voltage divider circuit. Going in a clockwise loop around the circuit, we can write down the voltage drop of each component as a term in a governing equation. The sign of the term is determined by the terminal. For example, going clockwise from the start point, the first component reached is the voltage source. The sign of the term is negative since we entered the negative terminal of the voltage source. (There is a link to Kirchhoff's voltage law as well as active/passive sign convention if this seems unfamiliar).

So overall the governing equation is:

• $\large -5V + V_{R1} + V_{R2} = 0V$

The voltage drop across $R_{1}$ and $R_{2}$ are unknown, so we designate them as $V_{R1}$ and $V_{R2}$ accordingly. This leaves us an equation with two unknown variables.

Using Ohm's law, $(V = IR)$, we can simplify and reduce the equation to just one unknown variable.

• $\large-5V + R_{1}I + R_{2}I = 0V$

(Remember the resistors are in series, so the current that flows through $R_{1}$ is the same as $R_{2}$).

Rearranging the equation:

• $I = \large5V * \frac{1}{R_{1} + R_{2}}$

This tells us the exact value of the current flowing through each resistor. With this value we can find an individual voltage drop by simply multiplying the current value times the components resistance value (another application of Ohm's law).

Therefore:

• $\large V_{R2} = I * R2 = 5V * \frac{R2}{R1 + R2}$
• $\large V_{R1} = I * R1 = 5V * \frac{R1}{R1 + R2}$

Referring back to Fig. 2, $V_{OUT}$ is the voltage drop across $R_{2}$ (with resistance values as follows.)

• $R_{2} = 2k\Omega$
• $R_{1} = 1k\Omega$
• $\large\frac{2k\Omega}{1k\Omega + 2k\Omega}* 5V = Vout = 3.3V$

In general, a closed form equation can be used to determine the output of a voltage dividers.

• $\large V_{out} = V_{source} \frac{R_{out}}{ R_{1} + R_{2} … R_{n}}$

Where $R_{1} + R_{2} … R_{n}$ is any number of resistors connected in series (there can be more than just two), and $R_{out}$ is the resistor whose voltage drop you are measuring as the output of the circuit. (It is also important to note that this equation is only valid for resistors connected in series).


text:
HomeEnglishClass 12PhysicsChapterRay Optics

A hemispherieal paper weight c...

# A hemispherieal paper weight contains a small flower on its axis of symmetry at a distance of 4 cm from its flat surface. Where is the flower appears to an observer when he looks at it along the axis of symmetry from the top? (Index of refraction of glass = 1.5)

 A.15 cm from top B.20 cm from top C.5 cm from top D.25 cm from top

Updated On: 17-04-2022

Get Answer to any question, just click a photo and upload the photo
and get the answer completely free,

Watch 1000+ concepts & tricky questions explained!

Text Solution

15 cm from top20 cm from top5 cm from top 25 cm from top

C
Solution :
(c ) we have, mu_(2)/v=mu_(1)/u-(mu_(2)-mu_(1))/R
 1/v=1.5/(-6)-(1-1.5)/(-10)
 therefore v=-5 cm


text:
# Fabrication of Polymersomes using Double-Emulsion Templates in Glass-Coated Stamped Microfluidic Devices

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Birgit Hausmann

## Keywords

double emulsions, glass-coatings, PDMS microfluidics, polymersomes

## Overview

Since copolymer precipitates cannot be easily removed during emulsion generation a microfluidic design that combines the ability to form double emulsions with the ability to inject and mix two organic solvents is desirable. A convenient fabrication technique is soft lithography using poly(dimethylsiloxane) (PDMS) and depositing a glasslike coating using sol-gel chemistry can prevent the PDMS from swelling when it comes in contact with organic solvents. This paper presents double-emulsion-templated polymersomes in stamped microfluidic devices.

## Results and Discussion

Devices are evenly coated with a sol–gel to produce a durable glasslike layer with tailored surface properties which increases the resistance of the channel walls against organic solvents. Two streams of organic solvents can be injected to form the shell of the double emulsion in the presented device configuration which 1) prevents clogging and 2) enables controlling the ratio of the solvents having different volatilities and thus controlling the evaporation rate of the solvents. Double emulsions are produced in an array of three flow-focusing cross-junctions with different wettability. The first two junctions allow for injection of solvents enabling manipulation of the composition of the shell phase of double emulsions. Drops formed in the first two junctions enter the third junction where they are encapsulated to create double emulsions (Fig. 1). In this way formation of copolymer-stabilized double emulsions is guaranteed. Diblock copolymers are dissolved in the organic solvent stream injected at the first junction. The second organic solvent injected at the second crossjunction is miscible with the copolymer-loaded solvent. Scanning electron micrographs of the glass coated microchannels are shown in Figure 2. The glass coating provides also the ability to spatially control the wettability of the surface by functionalizing the intrinsically hydrophobic sol–gel with photoreactive silanes and subsequent conversion of the surface chemistry to hydrophilicity via using a photochemical surface treatment. The first and second cross-junctions are made hydrophobic while the third junction is made hydrophilic; this allows water drops to be dispersed in a continuous phase of organic solvents at the first and second junctions, while the continuous water phase required for the double emulsion is injected at the third, hydrophilic junction. Poly(ethylene-glycol)-$b$-poly(lactid acid),PEG$_{5000}-b$-PLA$_{5000}$, polymer vesicles are formed in this way. Diblock copolymers are first dissolved in the organic solvent chloroform (first junction). In order to lower the density of the organic phase, toluene is added to the copolymer containing chloroform as a second organic solvent. Balancing osmolarities of the inner and outer phases of the double-emulsion template is guaranteed via adding glucose to the inner phase and polyvinyl alcohol (PVA) to the outer phase of the double emulsion. Thus, toluene is added at the second droplet making junction while PVA is used for emulsifying the organic solvent phase that contains aqueous inner drops at the third junction.The three phases are fed into the device shown in Figure 2a.

Since sol–gel coatings often consist of a nanoporous structure chloroform and toluene can overcome the sol–gel barrier into the PDMS. But chloroform evaporates faster, resulting in a lower chloroform fraction in the solvent mixture. As the solubility of PEG-$b$-PLA in toluene is significantly lower than in chloroform, the diblock copolymer forms precipitates after the more volatile chloroform starts to evaporate in the microfluidic device which leads to a buildup of a thick layer of copolymers on the channel walls (Fig. 2b) and can even result in destabilization of the double-emulsion drops (Fig. 2c). Even in this new device geometry, where chloroform with PEG-b-PLA and toluene are injected separately precipitation of the copolymer can still take place at the chloroform/toluene interface if sufficient diffusive mixing is allowed. Thus, elevated flow rates are used, and the microchannel between the second nozzle, and the third cross-junction is shortened. Optimal flow rates were 1000$\mathrm{\mu L/h}$ for toluene and 500$\mathrm{\mu L/h}$ for chloroform. The different wetting states of the double emulsion are shown in Figure 3. First, the organic solvent mixture wets the entire inner drop and is homogenously distributed on its surface, (Fig. 3a,b). Second, it dewets from the inner phase due to evaporation of the volatile organic solvents as well as due to the relative high surface energy between the inner and outer phase (Fig. 3c). The result is a state of partial wetting where the double emulsions adopt an acornlike, asymmetric structure. Having the optimized volumetric ratio of toluene and chloroform, the diblock copolymer molecules at the two interfaces of the shell self-assemble into a membrane. Upon dewetting, the bulb of the acornlike dewetted drop which contains the excess diblock copolymer and homo polymer, remains on the surface of the polymersome. After evaporation of the organic solvents, a polymeric aggregate of these polymers remains attached to the surface of the polymersomes, as shown in Figure 3d. The aggregate can also detach from the polymersome (Fig. 3e). Double-emulsion templates of approximately 100–150mm in diameter, corresponding to a polymersome diameter of approximately 50–100 mm were formed.


text:
# Can long run variance of a time series be used to test mean of the series?

Let $$Y_t$$ be a stationary time series with $$Y_t \sim N(\mu, \gamma_0) \,\, \forall t$$.

Further define, $$\bar Y_T \equiv (1/T)\sum\limits_{t=1}^TY_t$$

Further, let $$\sigma^2_l$$ be the long-run variance this time series. From this answer, I think we can say:

$$\lim_{T \to \infty} \frac{\bar Y_T-\mu}{\sigma_l/\sqrt{T}} \sim N(0,1)$$

This is because $$\bar Y_T$$ is a sum of $$T$$ normal random variables with (unconditional) mean $$\mu$$. Now say we have a consistent estimate of $$\sigma^2_l, \hat \sigma^2_l$$. Can we use the following statistic to test for hypothesis such as $$H_0: \mu = \mu_0$$?

I feel that if the true dependence structure of the time series was known (say for example, we know that $$Y_t$$ follows $$AR(p)$$), then the standard error of the residuals of the $$AR(p)$$ model, estimated using MLE, is nothing but an estimate of long-run variance. If true, then the above allows us to test for mean without having to fit a model (although the bandwidth selection is perhaps a similar exercise?).

• In the limit, divide by standard deviation, not variance. Mar 1, 2021 at 12:36
• @RichardHardy: thanks for pointing out the error. Corrected now. Mar 1, 2021 at 12:41

Basically, yes and yes - you can replace the long-run variance with a consistent estimator thereof and, by Slutzky's theorem, the test statistic will still be standard normal under the null.

And indeed, kernel-based long-run variance estimators are sometimes also referred to as nonparametric estimators that do not (there still are some assumptions, of course) require you to postulate a parametric model for the dependence.

That said, indeed, if you knew that your series follows a specific structure, you could exploit that. Why if in OLS the autocorrelation between residuals is positive, it will lead to inflated t-stats? discusses that the long-run variance of an AR(1) is $$\sigma^2/(1-\phi)^2,$$ which you could estimate parametrically.

And indeed, as discussed for example in Newey-West t-stats and critical values, there is a price to pay for the above nonparametric inference, namely relatively poor finite-sample performance.

• Thanks for including some imp details in the answer. On your comment about exploiting dependence structure if it's known, I have had a related question here which unfortunately remains unanswered. Although the finite sample performance be poor, I am inclined to use this for practical reasons. Model selection while fitting a time series is often based on information criteria which often selects model with insignificant coefficients (which maybe good for forecasting though). When the interest is to check statistical significance of mean... Mar 1, 2021 at 12:51
• ...that is often not helpful. Then we end up selecting a model based on PACF ad even after that the standard errors of the coefficients are based on asymptomatic distribution. Wouldn't there also we have problem of finite sample performance? Mar 1, 2021 at 12:53
• Also, can I relax the normality assumption? Since this is a limiting distribution, CLT would apply nevertheless? Mar 1, 2021 at 12:56
• Yes, the conditions on the errors are indeed far weaker than normality. The papers in the linked answers by Andrews and Newey and West provide (technical) detail. As to the first part, I am not sure I completely understand - yes, indeed, poor finite-sample inference can pop up in other contexts, too. Mar 1, 2021 at 13:31
• The book by White (Asymptotic Theory for Econometricians) for example discusses a wide range of CLTs covering many dependent and heterogeneous processes. Mar 2, 2021 at 8:26


text:
# Write elements above and right outside the matrix

I found writing matrix's code is a boring work. There is one, you can see in pic below.

Can anybody help?

-
This would be a good start: Where is the \matrix command? –  Werner Feb 23 '12 at 3:27
Thanks. I found only the blkarray package may provide help (Was I wrong?) from your links. But there is a large warning in its PDF document's. Can I use it without leading to any incompatibility? –  may you Feb 23 '12 at 3:38

This is definitely possible when using the blkarray package. Here's a mock-up with some index styling (in \scriptsize):

\documentclass{article}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\matindex}[1]{\mbox{\scriptsize#1}}% Matrix index
\begin{document}
$A=\begin{blockarray}{ccc} \matindex{1} & \matindex{2} & \\ \begin{block}{(cc)c} a & b & \matindex{3} \\ c & d & \matindex{4} \\ e & f & \\ \end{block} \end{blockarray}$
\end{document}

This would also be doable using a plain array, but would require additional vertical alignment/compensation, perhaps removing some of the code readability that exists via blkarray.

-
Hi Werner. I found your answer helpful. How does one selectively adjust the spacing between the block and the elements exterior to the block? –  user001 Mar 21 '12 at 1:12
@user001: Just on one side, or both (right and above)? –  Werner Mar 25 '12 at 21:29
Preferably I would like to adjust the spacing between the top elements and the matrix and the right elements and the matrix to different extents. –  user001 Mar 26 '12 at 1:20


text:
1
JEE Main 2016 (Offline)
+4
-1
If $$a, b, c, d$$ are inputs to a gate and $$x$$ is its output, then, as per the following time graph, the gate is :

A
$$OR$$
B
$$NAND$$
C
$$NOT$$
D
$$AND$$
2
JEE Main 2016 (Offline)
+4
-1
Identify the semiconductor devices whose characteristics are given below, in the order $$(a), (b), (c), (d)$$ :

A
Simple diode, Zener diode, Solar cell, Light dependent resistance
B
Zener diode, Simple diode, Light dependent resistance, Solar cell
C
Solar cell, Light dependent resistance, Zener diode, simple diode
D
Zener diode, Solar cell, simple diode, Light dependent resistance
3
JEE Main 2014 (Offline)
+4
-1
The current voltage relation of diode is given by $${\rm I} = \left( {{e^{100V/T}} - 1} \right)mA,$$ where the applied voltage $$V$$ is in volts and the temperature $$T$$ is in degree kelvin. If a student makes an error measuring $$\pm 0.01\,V$$ while measuring the current of $$5$$ $$mA$$ at $$300$$ $$K,$$ what will be the error in the value of current on $$mA$$?
A
$$0.2$$ $$mA$$
B
$$0.02$$ $$mA$$
C
$$0.5$$ $$mA$$
D
$$0.05$$ $$mA$$
4
JEE Main 2014 (Offline)
+4
-1
The forward biased diode connection is:
A
B
C
D
JEE Main Subjects
Physics
Mechanics
Electricity
Optics
Modern Physics
Chemistry
Physical Chemistry
Inorganic Chemistry
Organic Chemistry
Mathematics
Algebra
Trigonometry
Coordinate Geometry
Calculus
EXAM MAP
Joint Entrance Examination


text:
# Math Help - limit of a trig function

1. ## limit of a trig function

Hi. I'm just a little confused about something.

Here is the problem,

limit as x approaches 0, of tan(pi/4(cos(sin x^(1/3))

So it's simple, cube root of 0 is 0, and sin 0 is 0, cos of 0 is 1, and so pi/4*1=pi/4.

So the limit is tan(pi/4), which is 1.

They ask if the function is continuous at this point, x=0. According to my calculator, at x=0, f(x)=.999999999999999...

I'm just not sure what this means. Does the point x=0, y=1 exist for this function?

2. ## Re: limit of a trig function

Originally Posted by StudentMCCS
Here is the problem,

limit as x approaches 0, of tan(pi/4(cos(sin x^(1/3))

So it's simple, cube root of 0 is 0, and sin 0 is 0, cos of 0 is 1, and so pi/4*1=pi/4.

So the limit is tan(pi/4), which is 1.

They ask if the function is continuous at this point, x=0.
Does $f(0)$ exist?
Does $\lim _{x \to 0} f(x) = f(0)~?$

If you answer yes to both questions then $f$ is continuous at $x=0$.

3. ## Re: limit of a trig function

Originally Posted by Plato
Does $f(0)$ exist?
Does $\lim _{x \to 0} f(x) = f(0)~?$

If you answer yes to both questions then $f$ is continuous at $x=0$.
According to my math, yes. But according to my calculator no. This is what I don't understand, why does the calculator say f(o)=.9999999, when it should say 1?

4. ## Re: limit of a trig function

Originally Posted by StudentMCCS
According to my math, yes. But according to my calculator no. This is what I don't understand, why does the calculator say f(o)=.9999999, when it should say 1?
Throw calculators away. They are useless for limits.

5. ## Re: limit of a trig function

Thanks Plato.


text:
# I want to end a proof with a multiline equation

This question is related to placement of QED symbol on numbered equation line but I'm hoping for a cleaner solution.

I want to end a proof with a multiline environment which is numbered (actually, an XYpic diagram) I would like the number to be center-aligned vertically, but the QED box to be at the bottom. I've tried a number of combinations of aligned and gathered with qedhere without particular success, but I feel sure it's possible.

[update: an MWE has been requested. This one isn't quite minimal in that it includes the whole diagram, but the rest of the code is.

\documentclass{article}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[all]{xy}\newdir{ >}{{}*!/-7pt/\dir{>}}
\begin{document}
\begin{proof}
This follows from the commutativity of the bundle square
\begin{gathered}[b] \begin{aligned} \xymatrix@C=1em@R=1.5em{ & G \ar[ddl]_j \ar[d]|{\varkappa \,\circ\, j} \ar[ddr]\ar[drr] & \\ & {}_KG_K \ar[rr]|(.24)\hole \ar'[d][dd] & & BG \ar[dd]^\pi \\ G_K \ar@{ >->}[ru]_\varkappa \ar[rr] \ar[dd]_\chi & & EG \ar[ru] \ar[dd] & \\ & BK \times BK \ar'[r]_(.675){\rho \times\rho}[rr] & & BG \times BG. \\ BK \ar@{ >->}[ru]_(.55){(\mathrm{id},\mathrm{pt})} \ar[rr]_\rho & & BG \ar@{ >->}[ru]_(.55){(\mathrm{id},\mathrm{pt})} & } \\[-\dp\strutbox] \end{aligned} \end{gathered} \qedhere
\end{proof}
\end{document}

As you can see, the equation number and QED box both align with \pi, whereas I'd like the number to align with \pi in the middle and the box to align with BG at the bottom.]

• Please provide an MWE of what you've done so far.
– Mico
Jul 9 '16 at 6:52
• Would you end a proof with a one line numbered equation? Well, it's the same. Jul 9 '16 at 7:13
• @egreg: the desire appears to be a number vertically centered (i.e. following the middle equation) and a box at the end of the bottom equation.
– JPi
Jul 9 '16 at 10:22
• @JPi That's clear, my objection is that it wouldn't be nice. Jul 9 '16 at 10:50
• egreg: For the record, I would not scruple to do exactly that if there were enough room for both the box and the equation number. In a format where equation numbers were left-aligned, I would think it entirely reasonable.
– jdc
Aug 3 '16 at 0:09

You can use the usual placement of the proof's qed symbol, but backup vertically just before:

\documentclass{article}

\usepackage{amsmath,amsthm,amssymb}
\usepackage[all]{xy}\newdir{ >}{{}*!/-7pt/\dir{>}}

\begin{document}

\begin{proof}
This follows from the commutativity of the bundle square
$$\vcenter{ \xymatrix@C=1em@R=1.5em{ & G \ar[ddl]_j \ar[d]|{\varkappa \,\circ\, j} \ar[ddr]\ar[drr] & \\ & {}_KG_K \ar[rr]|(.24)\hole \ar'[d][dd] & & BG \ar[dd]^\pi \\ G_K \ar@{ >->}[ru]_\varkappa \ar[rr] \ar[dd]_\chi & & EG \ar[ru] \ar[dd] & \\ & BK \times BK \ar'[r]_(.675){\rho \times\rho}[rr] & & BG \times BG. \\ BK \ar@{ >->}[ru]_(.55){(\mathrm{id},\mathrm{pt})} \ar[rr]_\rho & & BG \ar@{ >->}[ru]_(.55){(\mathrm{id},\mathrm{pt})} & } }$$

\vspace*{-2\baselineskip}
\end{proof}

Following text.
\end{document}


text:
## Orthogonality between optical fibre modes

Hi there,

 Each bound mode of a fibre is orthogonal to all other bound modes. Physically this means that if a particular mode is propagating along a fibre, it cannot excite any other mode. Mathematically, orthogonality between the j'th and k'th bound modes is expressible in terms of the vanishing of the integral off a triple scalar product of electric field of the j'th mode and the magnetic field of the k'th mode over the infinite cross-section of the fibre.
The expression that is given is:
$$\int_{A \infty} e_j \times h_k* \cdot \widehat{z} dA = 0$$

where * denotes the complex conjugate, and z^ is the unit vector in the direction of propagation (along the axis of the fibre).

Can anyone explain why this mathematical expression indicates orthogonality? I am trying to interpret the mathematics rather than just accept it.
What I've done:
I tried to explain it by saying that the dot product between two perpendicular vectors will be 0. But in this sense, I only see the indication that a component perpendicular to both e and h (cross product) is perpendicular to the direction of propagation.
Thanks for any help,

Thomas.
 PhysOrg.com science news on PhysOrg.com >> King Richard III found in 'untidy lozenge-shaped grave'>> Google Drive sports new view and scan enhancements>> Researcher admits mistakes in stem cell study

 Tags modes, optical fibers, orthogonality


text:
# Lorentz transformation

1. Oct 18, 2012

### helpcometk

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

Given that the derivative θμ transforms as a covariant vector ,show that θμ transforms as a contravariant vector.

2. Relevant equations

3. The attempt at a solution
Does anyone know how i should go to prove it ?Is it just a trivial substitution ?

#### Attached Files:

• ###### wder.PNG
File size:
31.2 KB
Views:
92
2. Oct 20, 2012

### gabbagabbahey

What are θμ & θμ supposed to mean exactly? Uf the problem is just to show that $\frac{\partial}{\partial x_\mu}$ transforms as a contravariant vector, just try an analogous proof to the covariant case in your image. If you get stuck, show your work.