text:
# Gabor wavelet

Jump to navigation Jump to search

Gabor wavelets are wavelets invented by Dennis Gabor using complex functions constructed to serve as a basis for Fourier transforms in information theory applications. They are very similar to Morlet wavelets. They are also closely related to Gabor filters. The important property of the wavelet is that it minimizes the product of its standard deviations in the time and frequency domain. Put another way, the uncertainty in information carried by this wavelet is minimized. However they have the downside of being non-orthogonal, so efficient decomposition into the basis is difficult. Since their inception, various applications have appeared, from image processing to analyzing neurons in the human visual system.[1][2]

## Minimal uncertainty property

The motivation for Gabor wavelets comes from finding some function ${\displaystyle f(x)}$ which minimizes its standard deviation in the time and frequency domains. More formally, the variance in the position domain is:

${\displaystyle (\Delta x)^{2}={\frac {\int _{-\infty }^{\infty }(x-\mu )^{2}f(x)f^{*}(x)\,dx}{\int _{-\infty }^{\infty }f(x)f^{*}(x)\,dx}}}$

where ${\displaystyle f^{*}(x)}$ is the complex conjugate of ${\displaystyle f(x)}$ and ${\displaystyle \mu }$ is the arithmetic mean, defined as:

${\displaystyle \mu ={\frac {\int _{-\infty }^{\infty }xf(x)f^{*}(x)\,dx}{\int _{-\infty }^{\infty }f(x)f^{*}(x)\,dx}}}$

The variance in the wave number domain is:

${\displaystyle (\Delta k)^{2}={\frac {\int _{-\infty }^{\infty }(k-k_{0})^{2}F(k)F^{*}(k)\,dk}{\int _{-\infty }^{\infty }F(k)F^{*}(k)\,dk}}}$

Where ${\displaystyle k_{0}}$ is the arithmetic mean of the Fourier Transform of ${\displaystyle f(x)}$, ${\displaystyle F(x)}$:

${\displaystyle k_{0}={\frac {\int _{-\infty }^{\infty }kF(k)F^{*}(k)\,dk}{\int _{-\infty }^{\infty }F(k)F^{*}(k)\,dk}}}$

With these defined, the uncertainty is written as:

${\displaystyle (\Delta x)(\Delta k)}$

This quantity has been shown to have a lower bound of ${\displaystyle {\frac {1}{2}}}$. The quantum mechanics view is to interpret ${\displaystyle (\Delta x)}$ as the uncertainty in position and ${\displaystyle \hbar (\Delta k)}$ as uncertainty in momentum. A function ${\displaystyle f(x)}$ that has the lowest theoretically possible uncertainty bound is the Gabor Wavelet.[3]

## Equation

The equation of a 1-D Gabor wavelet is a Gaussian modulated by a complex exponential, described as follows:[3]

${\displaystyle f(x)=e^{-(x-x_{0})^{2}/a^{2}}e^{-ik_{0}(x-x_{0})}}$

As opposed to other functions commonly used as bases in Fourier Transforms such as ${\displaystyle \sin }$ and ${\displaystyle \cos }$, Gabor wavelets have locality properties, meaning that as the distance from the center ${\displaystyle x_{0}}$ increases, the value of the function becomes exponentially suppressed. ${\displaystyle a}$ controls the rate of this exponential drop-off and ${\displaystyle k_{0}}$ controls the rate of modulation.

It is also worth noting the Fourier transform of a Gabor wavelet, which is also a Gabor wavelet:

${\displaystyle F(k)=e^{-(k-k_{0})^{2}a^{2}}e^{-ix_{0}(k-k_{0})}}$

An example wavelet is given here:

A Gabor wavelet with a = 2, x0 = 0, and k0 = 1

## Improved Gabor Wavelet

[4] propose an improved gabor wavelet transform which is invertible. The spectrum ${\displaystyle J(f,\tau )}$ using an improved wavlet ${\displaystyle g}$ of signal ${\displaystyle h(\tau )}$ with frequency ${\displaystyle f}$ at the time ${\displaystyle \tau }$ is defined as

${\displaystyle J(f,\tau )=h(\tau )*g_{f,0}(\tau )}$

The signal can be reconstructed using

${\displaystyle h(\tau )=\int _{-\infty }^{\infty }J(f,t)*\exp(j2\pi ft)\,df}$

Note that ${\displaystyle *}$ refers to the Convolution. The wavelet is defined as

${\displaystyle g_{f,\tau }(t)=|f|g(f\cdot (t-\tau ))}$

${\displaystyle g(t)={\frac {1}{\sigma {\sqrt {2*\pi }}}}\exp(-{\frac {t^{2}}{2\sigma ^{2}}}+j2\pi t)}$

## References

1. ^ Lee, Tai S. (October 1996). "Image Representation Using 2D Gabor wavelets" (PDF). IEEE Transactions on Pattern Analysis and Machine Intelligence. 18 (10): 959–971. doi:10.1109/34.541406.
2. ^ Daugman, John. Computer Vision Lecture Series (PDF). University of Cambridge.
3. ^ a b Daugman, John. Information Theory Lecture Series (PDF). University of Cambridge.
4. ^ Zhanhuai, Ji (2015). "An improved Gabor wavelet and its complete transforms". 2015 IEEE International Conference on Signal Processing, Communications and Computing (ICSPCC). IEEE. pp. 1–6. doi:10.1109/ICSPCC.2015.7338925. ISBN 978-1-4799-8918-8.


text:
# Concentration of measure

Jump to: navigation, search

In mathematics, concentration of measure (about a median) is a principle that is applied in measure theory, probability and combinatorics, and has consequences for other fields such as Banach space theory. Informally, it states that "A random variable that depends in a Lipschitz way on many independent variables (but not too much on any of them) is essentially constant". [1]

The c.o.m. phenomenon was put forth in the early 1970s by Vitali Milman in his works on the local theory of Banach spaces, extending an idea going back to the work of Paul Lévy.[2][3] It was further developed in the works of Milman and Gromov, Maurey, Pisier, Shechtman, Talagrand, Ledoux, and others.

## The general setting

Let $(X, d, \mu)$ be a metric measure space, $\mu(X) = 1$. Let

$\alpha(\epsilon) = \sup \left\{\mu( X \setminus A_\epsilon) \, | \, \mu(A) \geq 1/2 \right\},$

where

$A_\epsilon = \left\{ x \, | \, d(x, A) < \epsilon \right\}$

is the $\epsilon$-extension of a set $A$.

The function $\alpha(\cdot)$ is called the concentration rate of the space $X$. The following equivalent definition has many applications:

$\alpha(\epsilon) = \sup \left\{ \mu( \{ F \geq \mathop{M} + \epsilon \}) \right\},$

where the supremum is over all 1-Lipschitz functions $F: X \to \mathbb{R}$, and the median (or Levy mean) $M = \mathop{Med} F$ is defined by the inequalities

$\mu \{ F \geq M \} \geq 1/2, \, \mu \{ F \leq M \} \geq 1/2.$

Informally, the space $X$ exhibits a concentration phenomenon if $\alpha(\epsilon)$ decays very fast as $\epsilon$ grows. More formally, a family of metric measure spaces $(X_n, d_n, \mu_n)$ is called a Lévy family if the corresponding concentration rates $\alpha_n$ satisfy

$\forall \epsilon > 0 \,\, \alpha_n(\epsilon) \to 0 {\rm \;as\; } n\to \infty,$

and a normal Lévy family if

$\forall \epsilon > 0 \,\, \alpha_n(\epsilon) \leq C \exp(-c n \epsilon^2)$

for some constants $c,C>0$. For examples see below.

## Concentration on the sphere

The first example goes back to Paul Lévy. According to the spherical isoperimetric inequality, among all subsets $A$ of the sphere $S^n$ with prescribed spherical measure $\sigma_n(A)$, the spherical cap

$\left\{ x \in S^n | \mathrm{dist}(x, x_0) \leq R \right\},$

for suitable $R$, has the smallest $\epsilon$-extension $A_\epsilon$ (for any $\epsilon > 0$).

Applying this to sets of measure $\sigma_n(A) = 1/2$ (where $\sigma_n(S^n) = 1$), one can deduce the following concentration inequality:

$\sigma_n(A_\epsilon) \geq 1 - C \exp(- c n \epsilon^2)$,

where $C,c$ are universal constants. Therefore $(S^n)_n$ meet the definition above of a normal Lévy family.

Vitali Milman applied this fact to several problems in the local theory of Banach spaces, in particular, to give a new proof of Dvoretzky's theorem.

## Footnotes

1. ^ Michel Talagand, A New Look at Independence, The Annals of Probability, 1996, Vol. 24, No.1, 1-34
2. ^ "The concentration of $f_\ast(\mu)$, ubiquitous in the probability theory and statistical mechanics, was brought to geometry (starting from Banach spaces) by Vitali Milman, following the earlier work by Paul Lévy" - M. Gromov, Spaces and questions, GAFA 2000 (Tel Aviv, 1999), Geom. Funct. Anal. 2000, Special Volume, Part I, 118–161.
3. ^ "The idea of concentration of measure (which was discovered by V.Milman) is arguably one of the great ideas of analysis in our times. While its impact on Probability is only a small part of the whole picture, this impact should not be ignored." - M. Talagrand, A new look at independence, Ann. Probab. 24 (1996), no. 1, 1–34.

## Further reading

• Ledoux, Michel (2001). The Concentration of Measure Phenomenon. American Mathematical Society. ISBN 0-8218-2864-9.

format: plain


text:
# Equation of reflected curve

1. Nov 27, 2013

### utkarshakash

1. The problem statement, all variables and given/known data
Find equation of the curve on reflection of the ellipse $\dfrac{(x-4)^2}{16} + \dfrac{(y-3)^2}{9} = 1$ about the line x-y-2=0.

2. Relevant equations

3. The attempt at a solution
Let the general point be P(4+4cosθ,3+3sinθ). Let the reflected point be (h,k).

$\dfrac{4+4cos \theta + h}{2} - \dfrac{3+3sin \theta + k}{2} - 2 =0$

I need one more condition so that I can eliminate theta.

2. Nov 27, 2013

### Pranav-Arora

Why not find the reflection of the point (4+4cosθ,3+3sinθ) about the given line? It gives h and k in terms of $\theta$ and its very straightforward from there.

Use the condition that line joining (h,k) and P is perpendicular to x-y-2=0. Can you take it from here?


text:
# Solutions

## NCERT Solution Part 3

Question 21: Two elements A and B form compounds having formula AB2 and AB4. When dissolved in 20 g of benzene (C6H6) 1 g of AB2 lowers the freezing point by 2.3 K whereas 1.0 g of AB4 lowers it by 1.3 K. The molar depression constant for benzene is 5.1 K kg mol-1. Calculate atomic masses of A and B.

Answer: This problem can be solved by using following equation:

M_2=(1000xx\k_f\xx\w_2)/(w_1xx\ΔT_f)

So, M_(AB_2)=(1000xx5.1xx1)/(20xx2.3)=110.87 g mol-1

M_(AB_4)=(1000xx5.1xx1)/(20xx1.3)=196.15 g mol-1

Let us assume that atomic masses of A and B are p and q

Then molar mass of AB_2=p+2q=110.87 ………….(1)

Similarly, molar mass of AB_4=p+4q=196.15 ……………..(2)

Subtracting equation (1) from (2) we get

2q=85.28

Or, q=42.64

Substituting the value of q in equation (1) we get:

p+2xx42.64=110.87

Or, p+85.28=110.87

Or, p=110.87-85.28=25.59

Hence, atomic mass of A = 25.59 g mol-1 and that of B = 42.64 g mol-1

Question 22: At 300 K, 36 g of glucose present in a litre of its solution has an osmotic pressure of 4.98 bar. If the osmotic pressure of the solution is 1.52 bars at the same temperature, what would be its concentration?

Answer: Molar mass of glucose = 180 g mol-1

We know, π=CRT

So, 4.98=(W_1)/(M_1)xx\Rxx300

Or, 4.98=(36)/(180)xxR\xx300

Or, 4.98=60R …………(1)

In second case, 1.52=C\xx\R\xx300 ……….(2)

Dividing equation (2) by (1), we get:

(1.52)/(4.98)=(C\xx\R\xx300)/(60R)

Or, 5C=(1.52)/(4.98)

Or, C=(1.52)/(4.98xx5)=0.06 M

Question 23: Suggest the most important type of intermolecular attractive interaction in the following pairs:

1. N-hexane and n-octane
2. I2 and CCl4
3. NaClO4 and water
4. Methanol and acetone
5. Acetonitrile (CH3CN) and acetone (C3O6O)

Answer: (a) London dispersion forces, (b) London dispersion forces, (c) Ion-dipole interactions, (d) Dipole-dipole interactions

Question 24: Based on solute-solvent interactions, arrange the following in order of increasing solubility in n-octane and explain. Cyclohexane, KCl, CH3OH, CH3CN.

Answer: Cylcohexane mixes in all proportionas, KCl does not dissolve in n-octane, methanol dissolves, CH_3CN dissolves to a greater extent than methanol

Question 25: Amongst the following compounds, identify which are insoluble, partially soluble and highly soluble in water? (i) phenol, (ii) toluene (iii) formic acid (iv) ethylene glycol (v) chloroform (vi) pentanol

Answer: (i) Partially soluble, (ii) Insoluble, (iii) Highly Soluble, (iv) Highly soluble, (v) Insoluble, (vi) Partially soluble

Question 26: If the density of some lake water is 1.25 g mL-1 and contains 92 g of Na+ ions per kg of water, calculate the molality of Na+ ions in the lake.

Answer: Molar mass of na = 23 g mol-1

So, number of moles of Na+ ions in 1 kg of water

=(92)/(23)=4 mole

Hence, molality =(4xx1000g)/(1000g) = 4 m

Question 27: If the solubility of CuS is 6 xx 10-16, calculate the maximum molarity of CuS in aqueous solution.

Answer: Maximum molarity of CuS means solubility of Cus

Let us assume that solubility of CuS is S mol L-1

Hence, K_(sp)=[Cu^(2+)][S^(2-)]

Or, 6xx10^(-16)=S\xx\S=S^2

Or, S=sqrt(6xx10^(-16))=2.45xx10^-8 mol L-1

Question 28: Calculate the mass percentage of aspirin (C9H8O4) in acetonitrile (CH3CN) when 6.5 g of C9H8O4 is dissolved in 450 g of CH3CN.

=text(Mass of aspirin)/(text(Mass of aspirin)+text(Mass of acetonitrile))xx100

=(6.5)/(6.5+450)xx100=(6.5)/(456.5)=1.424%

Question 29: Nalorphene (C19H21NO3), similar to morphine, is used to combat withdrawal symptoms in narcotic users. Does of nalorphene generally given is 1.5 mg. Calculate the mass of 1.5 xx 10-3 m in aqueous solution required for the above dose.

=19xx12+21+14+3xx16=228+21+14+48=311 g mol-1

So, mass of given mole of nalorphene =1.5xx10^(-3)xx311=0.467 g

Hence, mass of given solution =0.467+1000=1000.467 g

Since for 0.467 g of nalorphen, mass of required solution = 1000.467 g

Hence, for 1.5 mg = 1.5 xx 10^(-3) g of nalorphene, mass of required solution

=(1000.467)/(0.467)xx1.5xx10^(-3)=3.21 g

Question 30: Calculate the amount of benzoic acid (C6H5COOH) required for preparing 250 mL of 0.15 M solution in methanol.

Answer: Molar mass of benzoic acid

=6xx12+5xx1+12+2xx16+1=72+5+12+32+1=122 g mol-1

1 L of 1 M benzoic acid solution will contain 122 g benzoic acid

So, 1 L of 0.15 M benzoic acid solution will contain 122xx0.15=18.3 g benzoic acid

Hence, mass of benzoic acid in 250 mL solution =(18.3)xx(250)/(1000)=4.575` g of benzoic acid

Question 31: The depression in freezing point of water observed for the same amount of acetic acid, tricholoroacetic acid and trifluoroacetic acid increases in the order given above. Explain briefly.

Answer: Fluorine is more electronegative than chlorine. Hence, fluorine has higher electron withdrawing inductive effect than chlorine. Due to this, trifluoroacetic acid is the strongest acid, followed by trichloroacetic acid and then by acetic acid. Due to this, trifluoroacetic acid ionizes to the largest extent, while acetic acid ionizes to the least extent. So, depression in freezing point of water is least for acetic acid and greatest for trifluoroacetic acid.


text:
• anonymous
Simplify: fourteen times j plus 2 times j plus twenty-two times k minus 7 times j minus fourteen times k plus 3 times k 9 times j plus eleven times k 9 times j minus eleven times k thirty-one times j minus eleven times k thirty-one times j plus eleven times k
Mathematics

Looking for something else?

Not the answer you are looking for? Search for more explanations.


text:
tabularx key fails inside a newtcolorbox declared box

Consider the following code:

\documentclass{article}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{array}
\usepackage{tcolorbox}

\newtcolorbox{testbox}{
width=.5\textwidth
}

\begin{document}
% \begin{testbox}                      %compilation fails when this is uncommented
%    \begin{tcolorbox}[tabularx={l},width=4cm]
%       test1 \\\hline
%       test2
%   \end{tcolorbox}
% \end{testbox}

\begin{tcolorbox}[width=.5\textwidth]
\begin{tcolorbox}[tabularx={l},width=4cm]
test1 \\\hline
test2
\end{tcolorbox}
\end{tcolorbox}
\end{document}

the testbox declared via newtcolorbox is exactly the same as the tcolorbox with option width=.5\textwidth added manually.

However, while if I put another box with option tabularx into the the latter it works as expected, if I put the same box into my testbox it does not compile anymore.

Any clue on what's happening here?

• no idea what tcolorbox is doing but it's not that surprising that nested constructs fail, there are severe limitations on nesting tabularx in another environment. – David Carlisle Sep 23 '14 at 13:47
• @DavidCarlisle yes, but since the working one is also nested, I was wondering if someone familiar with the internals of the package could explain the difference between the two. – Nico Vecchio Sep 23 '14 at 14:05

The reason for failure in the first case is that the hack for tabularx gets the wrong environment name. This name is stored by the savedelimiter option and is set to testbox by the outer box automatically. For inner boxes, nearly all options are set back to their default values - savedelimiter is one of the very few options which stays at the current value (documented for the reset key).

The example is repaired by using the savedelimiter directly:

\documentclass{article}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{array}
\usepackage{tcolorbox}

\newtcolorbox{testbox}{
width=.5\textwidth
}

\begin{document}
\begin{testbox}
\begin{tcolorbox}[tabularx={l},width=4cm,savedelimiter=tcolorbox]
test1 \\\hline
test2
\end{tcolorbox}
\end{testbox}

\begin{tcolorbox}[width=.5\textwidth]
\begin{tcolorbox}[tabularx={l},width=4cm]
test1 \\\hline
test2
\end{tcolorbox}
\end{tcolorbox}
\end{document}

As David Carlisle wrote: Nesting tabularx is a little bit tricky. Here, we nest tabularx inside a tcolorbox inside a tcolorbox...


text:
# How to feed key-value features (aggregated data) to LSTM?

I have the following time-series aggregated input for an LSTM-based model:

x(0): {y(0,0): {a(0,0), b(0,0)}, y(0,1): {a(0,1), b(0,1)}, ..., y(0,n): {a(0,n), b(0,n)}}
x(1): {y(1,0): {a(1,0), b(1,0)}, y(1,1): {a(1,1), b(1,1)}, ..., y(1,n): {a(1,n), b(1,n)}}
...
x(m): {y(m,0): {a(m,0), b(m,0)}, y(m,1): {a(m,1), b(m,1)}, ..., y(m,n): {a(m,n), b(m,n)}}

where x(m) is a timestep, a(m,n) and b(m,n) are features aggregated by the non-temporal sequential key y(m,n) which might be 0...1,000.

Example:

0: {90: {4, 4.2}, 91: {6, 0.2}, 92: {1, 0.4}, 93: {12, 11.2}}
1: {103: {1, 0.2}}
2: {100: {3, 0.1}, 101: {0.4, 4}}

Where 90-93, 103, and 100-101 are aggregation keys.

How can I feed this kind of input to LSTM?

Another approach would be to use non-aggregated data. In that case, I'd get the proper input for LSTM. Example:

Aggregated input:

0: {100: {3, 0.1}, 101: {0.4, 4}}

Original input:

0: 100, 1, 0.05
1: 101, 0.2, 2
2: 100, 1, 0
3: 100, 1, 0.05
4: 101, 0.2, 2

But in that case, the aggregation would be lost, and the whole purpose of aggregation is to minimize the number of steps so that I get 500 timesteps instead of e.g. 40,000, which is impossible to feed to LSTM. If you have any ideas I'd appreciate it.

Sounds to me like you can reshape the input of a timestep as matrix s.t. $$X_t \in \mathbb{R}^{n \times 2}$$ (assuming you only have a and b as features) and use Convolutional LSTM layers:
$$t=0$$:
$$X_0 = \begin{bmatrix}a(0,0)&b(0,0)\\a(0,1)&b(0,1)\\\vdots&\vdots\\a(0,n)&b(0,n)\end{bmatrix}$$
$$t=m$$:
$$X_m = \begin{bmatrix}a(m,0)&b(m,0)\\\vdots&\vdots\\a(m,n)&b(m,n)\end{bmatrix}$$
Basically each sequential keys $$y$$ is a row in your input matrix. You can think of each matrix as some kind of image you feed to your LSTM network.


text:
# What is the use of the command \IeC?

It is produced in streams by `newfile` when I use special characters.

-

When dealing with UTF-8 coded document, one must keep in mind that characters are encoded by sequences of one to four bytes and that traditional TeX engines (including `pdftex`) are not able to directly interpret multibyte characters.
Thus multibyte clusters are, as soon as possible, translated to the LaTeX Internal Character Representation. This is feasible because in a multibyte cluster the first byte tells about the length of the cluster and so it's not too difficult to compute from this and the following bytes the Unicode point we are faced with; LaTeX maintains a table mapping Unicode points to LaTeX commands. For example, the multibyte cluster that the screen shows as `Ü` gets translated into `\IeC{\"U}`.
What's the purpose of `\IeC`? When `\"U` is found by LaTeX, it tries to expand `\"`, which is wrong when writing to an auxiliary file: we want that `\chapter{Über}` writes something equivalent to `Über` in the `.toc` file and not the complicated sequence of commands needed to print it.
Thus `\IeC`: it does nothing during normal typesetting, but when LaTeX is writing to auxiliary files the tokens `\IeC{\"U}` are written out literally.
If you want to write literally to your own auxiliary files, then this mechanism must be disabled, which can be obtained by protecting the tokens with `\unexpanded`. An example of what you want to obtain should be shown.
An important feature of the syntax here is that it handles following spaces correctly. `\"U` wouldn't really need `\IeC` but other things translate to control sequences. `IeC` ends in a `}` so following space is not gobbled, and the macro can be defined to remove the brace group so avoiding problems with preventing kerning if if it generated `\textalpha{}` or whatever rather tahn `\IeC{\textalpha}` –  David Carlisle Jun 8 '12 at 16:42


text:
# Cross-reference table numbers in a sub-document

Using a master document setup, you can easily reference chapters between subdocuments.

But how do you reference a table number from one subdocument in another subdocument? Is this about referencing number ranges or is there some kind of workaround?

Others asked similar questions

What I’m looking for

The table in the sub-document has a caption like `"Table 4.2: A table containing everything"`

And the reference should be `"For any information see table 4.2"` (only the number should be referenced, not ‘table’)

I know how to cross-reference in a master document setup. Referencing chapters works, but when I reference tables across subdocuments, I just get a blank field…

How is this done?

After some experimenting, the answer turned out to be simple.

1. mark the number range in the table caption (e.g. 4.2)
2. set a reference on the number range
3. insert references in other documents as usual

It works great, I don’t know why this and previous questions did not get an answer with a solution.


text:
# Find the largest prime factor

I just "solved" the third Project Euler problem:

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

With this on Mathematica:

Select[Divisors[600851475143], PrimeQ]

It will first give me a list with all the divisors of 600851475143 and then It's going to select the prime ones, giving me:

{71, 839, 1471, 6857}

And thus giving me the answer of 6857. I feel that my solution won't give me better insights into this (since I used almost null mental activity for it) and I would like to know how can I extend this problem, what other ways are accessible on solving it?

I initially thought that I should applying the idea of divisibility, some guys on the PE solved it using the sieve of Eratosthenes, can you suggest other ways that could solve this problem?

-
This number is computationally quite small for integer factorisation so any method will do really... As for using almost no brain power, this is only the third problem so is taken to be relatively quite simple in comparison to the later ones. –  fretty Aug 26 '12 at 13:10

In general factoring problem is not easy, see:Theoretical Computer Science Q&A
There is a Pollard-Rho algorithm which you can find some information here: Wikipedia: Factoring integers
I solved that problem of Project Euler too! The output of MATLAB is:

   71

839

1471

6857

Elapsed time is 0.002433 seconds.
>>

And the code in MATLAB:

clear;
clc;
tic;
p=600851475143 ;
m=3;
while(sqrt(m)<p)
j=rem(p,m);
if (j==0)
p=p/m;
disp(m);
m=m+2;
else
m=m+2;
end
end
toc;

By the way, there is factor command in MATLAB that directly outputs the factors of a number. But it has a 2^32 of input limitation size. I removed the limitation of the original code and it responded in 0.027501 seconds!

-

Did you try: http://www.alpertron.com.ar/ECM.HTM

-
Someone posted this link on the forum of the project Euler. –  Jesus Christ Aug 26 '12 at 20:31

For numbers of such small magnitude I find it most convenient to use factor, a GNU/Linux command-line utility.

-
I liked both factor and the "small magnitude" comment. Thank you! –  LIttle Ancient Forest Kami Jan 4 at 20:36


text:
## Data

• Title: Finitary birepresentations of finitary bicategories
• Authors: Marco Mackaay, Volodymyr Mazorchuk, Vanessa Miemietz, Daniel Tubbenhauer and Xiaoting Zhang
• Status: Forum Math. 33 (2021), no. 5, 1261-1320. Last update: Fri, 24 Sep 2021 02:40:37 EST
• ArXiv version = 0.99 published version
• LaTex Beamer presentation: Slides1, Slides2, Slides3, Slides4, Slides5

## Abstract

In this paper, we discuss the generalization of finitary 2-representation theory of finitary 2-categories to finitary birepresentation theory of finitary bicategories. In previous papers on the subject, the classification of simple transitive 2-representations of a given 2-category was reduced to that for certain subquotients. These reduction results were all formulated as bijections between equivalence classes of 2-representations. In this paper, we generalize them to biequivalences between certain 2-categories of birepresentations. Furthermore, we prove an analog of the double centralizer theorem in finitary birepresentation theory.

## A few extra words

Finitary 2-representation theory of finitary 2-categories, which is the categorical analog of finite dimensional representation theory of finite dimensional algebras. The main reason for restricting the framework to 2-representations of 2-categories, was to avoid technical difficulties which naturally arise when one considers birepresentations of bicategories in general: by weakening the axioms, the proofs of most results require more and bigger diagrams, whose commutativity is not always easy to show. However, in the recent preprint MMMTZ on the 2-representation theory of Soergel bimodules of finite Coxeter type, it became clear that the 2-categorical setup is really too restrictive.
The main purpose of this paper is therefore to discuss the generalization of some important foundational results on finitary 2-representation theory to finitary birepresentation theory. By discussing, we mean formulating those results carefully in the greatest possible generality (or at least as generally as we currently can) and proving them in detail whenever the proof is not straightforward and cannot be found in the literature. A lot of the results in this paper will not surprise the experts, but we think that it is important to have the statements and their proofs, which sometimes involve quite complicated diagrams, in written form somewhere in the literature.
An example of what changes in this bicategorical setup compared to the 2-categorical one is

which is an adjunction (a.k.a. zigzag) relation, coming now with associators and unitors.
As a bonus, we prove a strong version of the $$\mathcal{H}$$-reduction theorem as well as a version of the double centralizer theorem in our context, both of which are new.


text:
# The differences between dependency tags

I am new to Robotic Operating System, so this can be fundamental question. When I was investigating dependency tags of package.xml file of my newly-created package, I faced two dependency tags that I could not resolve.

According to the researches that I made, if a file from the package A is required to build our newly-created package, then package A is specified in the dependency tags like this: <build_depend> A </build_depend>. This sounds senseful. However, I could not find out following dependency tags:

<build_export_depend> </build_export_depend>

<exec_depend> </exec_depend>

When I created my package, I used the following command:

catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

These three packages are also specified in two tags mentioned above. Is there anyone who knows what these dependency tags mean ?

edit retag close merge delete

Sort by » oldest newest most voted

From the ROS wiki on catkin packages:

Build Dependencies specify which packages are needed to build this package. This is the case when any file from these packages is required at build time. This can be including headers from these packages at compilation time, linking against libraries from these packages or requiring any other resource at build time (especially when these packages are find_package()-ed in CMake). In a cross-compilation scenario build dependencies are for the targeted architecture.

Build Export Dependencies specify which packages are needed to build libraries against this package. This is the case when you transitively include their headers in public headers in this package (especially when these packages are declared as (CATKIN_)DEPENDS in catkin_package() in CMake).

Execution Dependencies specify which packages are needed to run code in this package. This is the case when you depend on shared libraries in this package (especially when these packages are declared as (CATKIN_)DEPENDS in catkin_package() in CMake).

Test Dependencies specify only additional dependencies for unit tests. They should never duplicate any dependencies already mentioned as build or run dependencies.

Build Tool Dependencies specify build system tools which this package needs to build itself. Typically the only build tool needed is catkin. In a cross-compilation scenario build tool dependencies are for the architecture on which the compilation is performed.

Documentation Tool Dependencies specify documentation tools which this package needs to generate documentation.

more

## Stats

Seen: 411 times

Last updated: Jan 22 '19


text:
Patience game (Klondike)

I've been working on a Patience clone in java using javaFX.

It's not finished yet, there are some features not working and some bugs still there, but I'm really in need of some structural advice and I know that alot of the things I'm doing are just getting real messy.

If someone has the knowledge and time to give me any advice on what I could do differently and how it would improve my code, I'd really appreciate it.

Any feedback is welcome :)

An image of the program:

Here is the link to my github repo: https://github.com/vincent-nagy/Card-Games

Here is the controller of the game since I need to post some code with this question. All other classes can be found on the github since it's too many to post here.

package be.vincent_nagy.cardgames.java.controller;

import be.vincent_nagy.cardgames.java.controls.CardPane;
import be.vincent_nagy.cardgames.java.event.DragDetectedHandler;
import be.vincent_nagy.cardgames.java.event.DragDoneHandler;
import be.vincent_nagy.cardgames.java.event.DragDroppedHandler;
import be.vincent_nagy.cardgames.java.event.DragOverHandler;
import be.vincent_nagy.cardgames.java.model.*;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;

import java.util.ArrayDeque;

public class PatienceController {
@FXML
private AnchorPane tablePane;
@FXML
private StackPane nextCardStackPane;
@FXML
private Button start;
@FXML
private Group stackGroup;
@FXML
private ImageView nextCardButton;

private Deck deck;
private Table gameTable;
private Stacks stacks;
private NextCards nextCards;
private ArrayDeque<Node> eventHandlerQueu = new ArrayDeque<>();

public void initialize(){
start.setOnAction(this::startGame);
nextCardButton.setOnMouseClicked(this::showNextCards);
}

private void startGame(ActionEvent event) {
//Empty out previous things
tablePane.getChildren().removeAll(tablePane.getChildren().filtered(e -> e instanceof CardPane));
nextCardStackPane.getChildren().clear();
stackGroup.getChildren().clear();

//Create a new gamefield
createGameField();

}

/*
Create everything needed to play the game
*/
private void createGameField() {
//create stacks
createCardStacks();
//deal the cards on the table
dealCards();
//Create and show next cards
initNextCards();
}

/*
Create the stacks on which the cards should be stacked to finish the game.
*/
private void createCardStacks() {
//Create 4 stacks on which cards are to be stacked from 1 to 13 to finish the game
stacks = new Stacks();

for (int i = 0; i < 4; i++) {
}
}

/*
Deal the cards on the table and set them up
*/
private void dealCards() {
//Create a new deck which gets shuffled automatically
deck = new Deck();

//Create a new table which creates 7 columns which contain 20 empty CardPanes each
gameTable = new Table(this);

//Add the CardPanes from whole table to the field.
for (Column c: gameTable.getColumns()) {
for (CardPane cp : c.getCardPanes()) {
}
}

//Pull the cards from the deck and show them on the table. Each column has 1 more card than the previous
for(int i = 0; i < 7; i++){
for (int j = 0; j <= i; j++) {
Card drawnCard = deck.playCard();

//Shouldn't be null but if it is, show a message
if(drawnCard != null){
gameTable.setCard(i,j,drawnCard);

//Make the card shown if it's the last card in the column and add events
if(j == i){
gameTable.setShown(i, j, true);
}
} else{
System.out.println("Deck is empty error");
}
}
}

}

//Load and show the next cards in the created card stacks
private void initNextCards() {
nextCards = new NextCards(nextCardStackPane, this);
nextCardButton.setVisible(true);
showNextCards(null);
}

private void showNextCards(MouseEvent mouseEvent) {
nextCards.show(deck);
}

//Give a node to add drag and drop handlers. Once everything is finished,
// this method gets called with null to ensure the handlers don't called to early
public void addEventHandlers(Node node, boolean doNow){
DragDetectedHandler dragDetectedHandler = new DragDetectedHandler(stacks, nextCards, gameTable);
DragOverHandler dragOverHandler = new DragOverHandler();
DragDroppedHandler dragDroppedHandler = new DragDroppedHandler(stacks, gameTable, nextCards);
DragDoneHandler dragDoneHandler = new DragDoneHandler(gameTable, nextCards);

if(!doNow && node != null){
} else {
if(node == null) {
while (eventHandlerQueu.peek() != null) {
Node currentNode = eventHandlerQueu.pop();

currentNode.setOnDragDetected(dragDetectedHandler);
currentNode.setOnDragOver(dragOverHandler);
currentNode.setOnDragDropped(dragDroppedHandler);
currentNode.setOnDragDone(dragDoneHandler);
}
} else {
node.setOnDragDetected(dragDetectedHandler);
node.setOnDragOver(dragOverHandler);
node.setOnDragDropped(dragDroppedHandler);
node.setOnDragDone(dragDoneHandler);
}
}
}
}

Keep it simple

public void addEventHandlers(Node node, boolean doNow){

This is a weird interface. The same method can

1. Enqueue a node for later processing,
2. Process the queued nodes, or
3. Process a node immediately.

Why?

Consider making three methods. One for each purpose. Then instead of passing different parameters, you can just call the right one. As originally written, if you accidentally call the method with a null node, it will immediately clear the queue.

The general rule of thumb is that a method should do one thing. This method has three different behaviors. That's two too many.

    addEventHandlers(null, false);

What's this supposed to do? On the one hand, you're telling it not to process nodes, and on the other, you're telling it to process all the nodes. As written, process all the nodes wins. But to figure that out, one has to read the method's code.

Magic numbers

    addEventHandlers(nextCards.getCardPane(2), false);

Why 2? What happens if you reorganize? How will this code know that you made a change elsewhere? At a guess, what you actually want to do here is to getTopCardPane(). But of course that depends on how you have the rest of the code arranged.

You also have 4 and 7, although it's less clear to me if those matter outside this code.

Say what you mean

            //Shouldn't be null but if it is, show a message
if(drawnCard != null){

The comment doesn't match what the code does. The comment talks about what to do when it's null. The code handles the case when it's not null. Why not do what the comment says?

            if (drawnCard == null) {
System.out.println("Deck is empty error");
continue;
}

Now you don't need the comment. The code is self-explanatory.

Of course, a bigger issue is that you are notifying a user of a programming error. What is a user supposed to do with this information? You made a mistake and produced a null card during the deal. This code soldiers on.

A better solution is to end the program if this extremely weird situation actually occurs. Then the user would report a null pointer exception. As is, the user might report an empty deck error or just that they stopped being able to play the game. Because the code tries to keep running after encountering what should be a fatal error.

Consider how much simpler it would be if you don't do this defensive checking. The block of code starting

        for (int j = 0; j <= i; j++) {

could be

        for (int j = 0; j <= i; j++) {
gameTable.setCard(i, j, deck.playCard());
}

gameTable.setShown(i, i, true);

Now instead of checking on every iteration if we're done, we move that behavior after the iterations. We don't need a conditional, as we always do it once.

If you still want the defensive check, then you should exit on it. It's not recoverable.

Interfaces over implementations

private ArrayDeque<Node> eventHandlerQueu = new ArrayDeque<>();

Could be

private Deque<Node> eventHandlerQueu = new ArrayDeque<>();

Then we don't have to worry about what kind of Deque it is anywhere but here. If we want to change in the future, no one else needs to know.

Don't reinvent the wheel

            while (eventHandlerQueu.peek() != null) {

You want to iterate while the queue is not empty. So say that

            while (!eventHandlerQueu.isEmpty()) {

Don't fetch a value that you then discard. Particularly since chances are that it does the the same isEmpty check to return null. So not only is this less readable, it's probably less efficient.


text:
## Limits on tensor type weak currents from nuclear and neutron $β$~decays    [PDF]

Frederik Wauters, Alejandro Garc\'\ia, Ran Hong
The limits on time-reversal invariant tensor-type weak currents from nuclear and neutron $\beta$ decays are evaluated including most recent experimental data. We find that $-0.14 \times 10^{-2} < (C_T + C^\prime_T)/C_A < 1.4 \times 10^{-2}$ and $-0.16 < (C_T - C^\prime_T)/C_A < 0.16$ (90% C.L.), while for the case $C_T = C^\prime_T$ the limits are $| C_T/C_A | < 3.7 \times 10^{-3}$. These limits are shown to be more stringent than those from recent measurements of the radiative pion decay. In addition, the sensitivity of future $10^{-3}$-level correlation measurements is investigated.
View original: http://arxiv.org/abs/1306.2608


text:
This function "pools" (i.e. combines) model parameters in a similar fashion as mice::pool(). However, this function pools parameters from parameters_model objects, as returned by model_parameters().

## Usage

pool_parameters(
x,
exponentiate = FALSE,
effects = "fixed",
component = "conditional",
verbose = TRUE,
...
)

## Arguments

x

A list of parameters_model objects, as returned by model_parameters(), or a list of model-objects that is supported by model_parameters().

exponentiate

Logical, indicating whether or not to exponentiate the coefficients (and related confidence intervals). This is typical for logistic regression, or more generally speaking, for models with log or logit links. It is also recommended to use exponentiate = TRUE for models with log-transformed response values. Note: Delta-method standard errors are also computed (by multiplying the standard errors by the transformed coefficients). This is to mimic behaviour of other software packages, such as Stata, but these standard errors poorly estimate uncertainty for the transformed coefficient. The transformed confidence interval more clearly captures this uncertainty. For compare_parameters(), exponentiate = "nongaussian" will only exponentiate coefficients from non-Gaussian families.

effects

Should parameters for fixed effects ("fixed"), random effects ("random"), or both ("all") be returned? Only applies to mixed models. May be abbreviated. If the calculation of random effects parameters takes too long, you may use effects = "fixed".

component

Should all parameters, parameters for the conditional model, for the zero-inflation part of the model, or the dispersion model be returned? Applies to models with zero-inflation and/or dispersion component. component may be one of "conditional", "zi", "zero-inflated", "dispersion" or "all" (default). May be abbreviated.

verbose

Toggle warnings and messages.

...

Currently not used.

## Value

A data frame of indices related to the model's parameters.

## Details

Averaging of parameters follows Rubin's rules (Rubin, 1987, p. 76). The pooled degrees of freedom is based on the Barnard-Rubin adjustment for small samples (Barnard and Rubin, 1999).

## Note

Models with multiple components, (for instance, models with zero-inflation, where predictors appear in the count and zero-inflation part) may fail in case of identical names for coefficients in the different model components, since the coefficient table is grouped by coefficient names for pooling. In such cases, coefficients of count and zero-inflation model parts would be combined. Therefore, the component argument defaults to "conditional" to avoid this.

Some model objects do not return standard errors (e.g. objects of class htest). For these models, no pooled confidence intervals nor p-values are returned.

## References

Barnard, J. and Rubin, D.B. (1999). Small sample degrees of freedom with multiple imputation. Biometrika, 86, 948-955. Rubin, D.B. (1987). Multiple Imputation for Nonresponse in Surveys. New York: John Wiley and Sons.

## Examples

# example for multiple imputed datasets
if (require("mice")) {
data("nhanes2")
imp <- mice(nhanes2, printFlag = FALSE)
models <- lapply(1:5, function(i) {
lm(bmi ~ age + hyp + chl, data = complete(imp, action = i))
})
pool_parameters(models)

# should be identical to:
m <- with(data = imp, exp = lm(bmi ~ age + hyp + chl))
summary(pool(m))
}
#>          term    estimate  std.error statistic        df      p.value
#> 1 (Intercept) 18.14256305 3.54562901  5.116881 11.625350 0.0002813879
#> 2    age40-59 -6.15715380 2.19792337 -2.801351  5.969005 0.0312810653
#> 3    age60-99 -7.72866592 2.45997959 -3.141760  6.642762 0.0174969755
#> 4      hypyes  2.46673562 2.07396774  1.189380  6.147560 0.2781911871
#> 5         chl  0.06028557 0.02078061  2.901050 10.206904 0.0154916183


text:
• SHILPA PATIL PILLAI

Articles written in Journal of Earth System Science

• Implications of new ⁴⁰Ar / ³⁸Ar age of Mallapur Intrusives on the chronology and evolution of the Kaladgi Basin, Dharwar Craton, India

The Kaladgi Basin on the northern edge of the Dharwar craton has characters diverse from the other epicratonic Purana basins of Peninsular India. Sedimentological studies in the basin have established the presence of three cycles of flooding separated by an event of intra-basinal deformation accompaniedby low grade incipient metamorphism. The overall structural configuration of the basin indicates its development by supracrustal extension accompanied by shearing in a trans-tensional regime during the Mesoproterozoic. This was followed by sagging that yielded Neoproterozoic sedimentation in a successornested basin. ⁴⁰Ar / ³⁸Ar dating

of an intrusive mafic dyke along the axial plane of a fold has yielded a plateau age of 1154±4Ma. This helps constraint the age of the various events during the evolution of this basin.

• Geometry and age of a mafic dyke emplaced along the Bhetkheda–Mohana Lineament, Central Narmada valley, Deccan Volcanic Province

The Bhetkheda–Mohana Lineament is traced as a continuous lineament across nearly 100 km in the central Narmada valley across the Deccan Trap basalts and their basement of Proterozoic sediments. While a major length of this lineament is occupied by a basaltic dyke, there are segments where the dyke is completely absent, and the lineament is represented by a regional fracture/shear/fault zone. At its eastern extremity, this dyke is exposed intruding along the axis of a synclinorium of the Vindhyan Supergroup sediments, as a 4-km long string of hillocks of picturesque columnar jointed basalt. It has the presence of ignimbrites and a thin basaltic flow (resting on the sediments) surrounding it, suggesting the presence of an eruptive vent. This dyke intrudes the Mandleshwar Formation lava flows dated at 67–66 Ma and is associated with the Narmada dyke swarm. It has given $^{40}$Ar/$^{39}$Ar age of 66.6±0.5 Ma. Its chemical characters conform to those of the basaltic flows of the Malwa Traps, indicating a common source and emplacement history. This is a unique example of a dyke that was emplaced along a preexisting fracture zone cutting through the Proterozoic basement as well as the Deccan Trap lavas, with a distinct petrological identity with the host lava flows, indicating its feeder relation. It endorses the comparison of the Icelandic mode of fissure-fed flood basalts with the eruptive history of the Deccan Volcanic Province.

• # Journal of Earth System Science

Volume 131, 2022
All articles
Continuous Article Publishing mode

• # Editorial Note on Continuous Article Publication

Posted on July 25, 2019


text:
# Roots of Complex Numbers, Help!

0
I'm trying to find the: 4 4th roots of ${\sqrt{3}} [/tex] + i . So I made a Cartesian plane and graphed radical 3 and 1.. but these numbers can be in 2 quadrants, 1st and 3rd. r=2 ==> 2([itex] {\sqrt{3}} [/tex] + i) ===> 2(cos 30+isin 30) =4rad2(cos 7.5+isin 7.5) Would I also use 2(cos 210+isin210) ??? Thanks.. 2. ### Hurkyl 16,090 Staff Emeritus Recall that, for instance, [itex]\cos 30 = \cos 390$. Does that give you any ideas about how to proceed?

P.S., the symbols you're looking for are:

$\sqrt{3}$ (click it to see the LaTeX source)

and "& radic ; 3" (the stuff between the quotes, with no spaces), gives √3

Last edited: Dec 13, 2003
3. ### StarkyDee

0
kinda. i know that to get the 4 4th roots of this equation are
30/4 = 7.5 ===>
(cos 7.5 + isin 7.5)
+30 (cos 37.5 + isin 37.5)
+30 (cos 67.5 + isin 67.5)
+30 (cos 97.5 + isin 97.5)

but there is also a second set which you could start from 210.
210/4 = 52.5 ===> (cos 52.5 + isin 52.5)
+210 (cos 262.5 + isin 262.5)
+210 (cos 472.5 + isin 472.5)
+210 (cos 682.5 + isin 682.5)

Would there be 2 sets of answers to this root?

4. ### Hurkyl

16,090
Staff Emeritus
I agree with the first of these four. What justification do you have for the other three? It seems you are simply adding 30 degrees... why?

(For the record, I agree with the last one as well, but not the middle two)

Also, why would you use 210 anyplace?

$$2(\cos 210 + i \sin 210) \neq 2(\cos 30 + i \sin 30)$$

However, note that

$$2(\cos 390 + i \sin 390) = 2(\cos 30 + i \sin 30)$$

Last edited: Dec 13, 2003
5. ### StarkyDee

0
you use 30 to find all of the roots of that particular equation.
substituting k =0,1,2,3..etc.

k=0 for general solution (cos 30 + isin30)
=2[1/2 + i$/sqrt{3}$ /2]
= $/sqrt{3}$ + i

k=1 you add 30 because 30 is the reference angle.

haha im going to stop im confusing myself

6. ### Hurkyl

16,090
Staff Emeritus
Can you write out what the general solution is supposed to be?

(P.S. You're using the wrong slash in your LaTeX; it should be \ not /)

7. ### StarkyDee

0
i wish my teacher would go by the book, he solves it differently than how the book does, which is very confusing. this is homework so i don't have the solution yet.

but i think i understand your point. i use k=90, because 360/4 = 90. if i wanted the 6th roots, i would use 60 as k?

8. ### Hurkyl

16,090
Staff Emeritus
Right (I think):

You know that:

$$\sqrt{3} + i = 2(\cos (30 + 360n) + i \sin(30 + 360n)) \quad n \in \mathbb{Z}$$

So the fourth roots would be

$2 ( \cos \frac{30 + 360n}{4} + i \sin \frac{30 + 360n}{4}) = 2 (\cos (7.5 + 90n) + i \sin (7.5 + 90))$

edit: trying to get the formats right

Last edited: Dec 13, 2003
9. ### StarkyDee

0
ok thanks. so i would use k=0,1,2,3.
so the 210 angle has nothing to do with the equation?
in essence would it be the same as $$2(\cos \frac{30 + 360n}{4} + i \sin \frac{30 + 360n}{4}) = 2 (\cos (7.5 + 90n} + i \sin (7.5 + 90))$$

Thanks for the help I appreciate it much!


text:
$\Delta G^{\circ}= \Delta H^{\circ} - T \Delta S^{\circ}$

$\Delta G^{\circ}= -RT\ln K$

$\Delta G^{\circ}= \sum \Delta G_{f}^{\circ}(products) - \sum \Delta G_{f}^{\circ}(reactants)$

Lina Petrossian 1D
Posts: 77
Joined: Fri Oct 05, 2018 12:16 am

Will there be a difference in my answer if I calculate Gibbs free energy using the formula for products minus reactants or if I use the formula including enthalpy?

Danielle_Gallandt3I
Posts: 70
Joined: Fri Sep 28, 2018 12:24 am

There might be differences but it shouldn't be drastically different. These differences could arise from the delta G changing for products and reactants based on the environment, or because the delta H might be slightly off because its being used for a wide variety of temps

Pritish Patil 1K
Posts: 60
Joined: Fri Sep 28, 2018 12:24 am


text:
Error running OMA standalone at HOG computation step
4
1
Entering edit mode
18 months ago
gaurav.diwan ▴ 20

I have been trying to run OMA standalone using a few genomes downloaded from the OMA browser and then adding a couple of my custom genomes. All the steps of OMA standalone including All-vs-All computations, pairwise orthologs etc have successfully finished. However, I have consistently faced the same error with the final step of generating and storing HOGs for these genomes.

Here is the error message that I get despite trying to run OMA on different machines:

********************************************************************************

Storing results
Traceback (most recent call last):
File "/home/orthologs/OMA.2.4.1/bin/..//.venv/bin/warthogs.py", line 128, in <module>
run_gethogs()
File "/home/orthologs/OMA.2.4.1/bin/..//.venv/bin/warthogs.py", line 95, in run_gethogs
Settings.check_consistency_argument()
File "/home/orthologs/OMA.2.4.1/.venv/lib64/python3.6/site-packages/gethogs/settings.py", line 53, in check_consistency_argument
cls.inputfile_handler = file_manager.inputfile_handler_factory()
File "/home/orthologs/OMA.2.4.1/.venv/lib64/python3.6/site-packages/gethogs/file_manager.py", line 97, in inputfile_handler_factory
return OmaStandaloneFiles(os.path.normpath(join(settings.Settings.pairwise_folder, '..')))
File "/home/orthologs/OMA.2.4.1/.venv/lib64/python3.6/site-packages/gethogs/file_manager.py", line 44, in __init__
_csv.Error: field larger than field limit (131072)
********************************************************************************
An error occured in bottom-up HOG computations:

--- WARTHOGs:
- Start at 13:36 on 2020-12-08
- Orthology relations folder:Output/PairwiseOrthologs (standalone format)
- Method use to merge HOGS: pair
- Output file: Output/HierarchicalGroups.orthoxml

Error, (in GetHOGsBottomUp) failed to compute bottom-up hogs

Also is there a way to only run the HOG computation stage of the program without having to generate all the output files again?

OMA HOG error orthologs • 844 views
4
Entering edit mode
18 months ago

Hi Gaurav, (hi Alberto)

I had a look at the problem and it turns out that there are some proteins with a huge number of crossreferences in the fasta header. The csv module has a limit on the length of each field, which is exceeded by these proteins. The fix is quite simple, so you can actually do it yourself if you want. I also plan to release a new version of oma standalone within the next days that contains that fix (will be 2.4.2).

what you need to do is to include in hog_bottom_up/gethogs/file_manager.py right after the import lines:

csv.field_size_limit(1<<20)

After this change, the analysis run through in a few minutes without further problems.

Thanks for pointing out the problem and good look with our analysis

1
Entering edit mode

This finally worked! Although if I may point out, I also had to copy the file hog_bottom_up/gethogs/file_manager.py to the folder .venv/lib64/python3.6/site-packages/gethogs/ so that the program uses this modified file.

A couple of days ago, I had tried to add the csv.field_size_limit argument in file_manager.py that was in the lib64 folder, however this file was overwritten in a subsequent run of OMA. I'm guessing in a new run of OMA, the files in hogs_bottom_up/gethogs/ are installed/copied into lib64, however this did not happen today for some reason and I got the same "too many fields" error. Only after copying the new file_manager.py to lib64 was I able to finish the HOG computation.

Thanks a lot for all your help! Good luck with the further development of the program. I'm a fan and would be using it for a long time ;)

1
Entering edit mode

Thank you very much for your help. As Gaurav mentioned, it becomes necessary to copy the file hog_bottom_up/gethogs/file_manager.py to the folder .venv/lib64/python3.6/site-packages/gethogs/ , otherwise it doesn't use the modified file. I had to do this same thing as well, so I guess that's an additional confirmation.

As I said above thanks a lot to you and everyone for their help; it was a good a coincidence that this happened to two people at the same time. All the best!

2
Entering edit mode
18 months ago

Hi Gaurav,

indeed, this looks quite strange. regarding your question to rerun only the HOG inference step, in case you run OMA standalone with -d 2 (a bit more verbose output) you should find the command to start the HOG computation step in the output look, just above the extract you showed. Otherwise, you can try the following command:

  /home/orthologs/OMA.2.4.1/.venv/bin/warthogs.py -m pair -o Output/HierarchicalGroups.orthoxml -i Output/PairwiseOrthologs -t standalone -p 65 -s Output/ManualSpeciesTree.nwk

if the problem still remains, it would be helpful if you could share your output folder with us.

0
Entering edit mode

Thanks a lot for your answer. I tried running the HOG computation step using the second command you suggested and it still shows me the same csv_reader related error (too many fields). I can share the Output folder with you. Would you like the entire folder or just a few files from it? Also what would be a safe way to transfer this data (perhaps an email with a link)?

Best regards, Gaurav

2
Entering edit mode

Hi Gaurav,

yes, en email with a link would be fine. The relevant files would be the ManualSpeciesTree.nwk, Map-SeqNum-ID.txt and the whole subfolder PairwiseOrthologs (all in Output directory). If you can send me that as a tarball (maybe with wetransfer) to adrian.altenhoff@inf.ethz.ch.

0
Entering edit mode

Hi everybody,

I hope it is fine to leave this reply here. I am experiencing exactly the same issue as Gaurav, trying to run OMA standalone with genomes downloaded from OMA browser plus a custom genome. I get the same error code, and it stops on the same step. I have been following all the advises provided to Gaurav, to no avail in my case either. I would be happy to provide any extra information too, or at least reporting here for the record that someone else has the same issue.

Thank you very much, Alberto

1
Entering edit mode
18 months ago
alex.wv ▴ 50

Hi Gaurav,

I work in the group that develops OMA. I see that the error you have incurred is when we're reading IDs from the Output/Map-SeqNum-ID.txt file.

It appears that this is either corrupt or a sequence header in your input FASTA files might be malformed. The error message means that there are more columns than the default limit for the CSV library in Python (131072). This file should only contain 3 columns though (species, offset, FASTA header), so something is going wrong.

Please could you check if this file (Output/Map-SeqNum-ID.txt) looks correct? I suspect that it is corrupt, as even if there are tabs in the FASTA header I wouldn't expect there to be 131,000!

Every time you rerun it should delete the "Output" directory, including this file, so it would have to be corrupt multiple times. We often encounter strange behaviour like this when disk quota has been exceeded when running on a shared computing facility. Is this a possibility here?

If you want to rerun and are happy that some of your desired output files are valid, then you can set a new Output folder in parameters.drw (i.e., change "OutputFolder := 'Output';" ) and also set some of the output to "false" in this file too, if you wanted them and they're already valid. (e.g., search for WriteOutput_OrthologousPairs_orthoxml for the most time consuming).

Best wishes, Alex

0
Entering edit mode

Hi Alex,

Thanks a lot for your answer! Well, the FASTA headers of my custom genome files come from Uniprot and contain a bunch of details. However, I used the following command to check how many columns each line of Output/Map-SeqNum-ID.txt file has:

awk --field-separator="\t" '{print NF}' Output/Map-SeqNum-ID.txt | uniq -c
1 1 #the first comment line
682780 3 #all remaining lines

So I see that all the lines of this file have exactly 3 tab-separated columns. So, I don't understand why the CSV library thinks I have more than that in any row. Do you think I should reformat the FASTA headers for my genome files and recalculate everything?

As far as I can tell the Output folder is being deleted every time I run the third part of OMA. I gather that OMA itself has a "rm -rf" command for the Output folder that runs when I start the program. Also I don't think there are any disk quota issues as I'm using our group server where there is plenty of space and no restrictions.

Thanks a lot for your suggestions regarding the output, I will keep these in mind.

Best regards, Gaurav


text:
# TikZ: Labeling objects and referencing them

According to the TikZ manual I can use name= to assign a label to the drawings, but when I do the following:

\begin{tikzpicture}
\draw [ blue, thick, name=e1]  (10pt,10pt)  ellipse   (50pt and 30pt);
\node (red,above) at (e1.north) {E1};
\end{tikzpicture}

I get an error message that e1 is not defined. What am I doing wrong?

My second question is where can I find a concise syntactical representation of TikZ's commands?

-

You can only name nodes, not arbitrary parts of a drawing. In your example, if you wanted to be able to refer to the ellipse by name, you'd need to create it as a node instead of a plain ellipse. Try replacing your \draw command with this:

\node[draw=blue,ellipse,name=e1,minimum width=100pt,minimum height=60pt] at (10pt,10pt) {};

To address the second part of your question, I know of no better documentation of TikZ than the PGF manual itself. I've never heard of a short "cheat sheet" that briefly lists TikZ commands along with reminders of their syntax, if that's what you're looking for. Although it might be out there somewhere, at least for the most commonly used ones. You could probably create such a quick reference by extracting lines from the PGF documentation.

-

It is not a precise answer to your second question, but did you try the TeXample website? It contains a lot of examples (including source code) for doing all sorts of nice things with TikZ. In my experience, the TikZ manual can be a bit overwhelming at first glance. So if you are looking for doing something specific, you may be better off with adapting an example from this site.

-


text:
# Neural Network Programming - Deep Learning with PyTorch

Deep Learning Course 3 of 5 - Level: Intermediate

## CNN Output Size Formula - Bonus Neural Network Debugging Session

### video

expand_more chevron_left

### text

expand_more chevron_left

### CNN Output Size Formula - Tensor Transformations

Welcome to this neural network programming series with PyTorch. In this episode, we are going to see how an input tensor is transformed as it flows through a CNN.

Without further ado, let's get started.

#### High-level Overview of Our Process

• Prepare the data
• Build the model
• Understanding forward pass transformations
• Train the model
• Analyze the model's results

#### Overview of Our Network

The CNN we will use is the one that we have been working with over the last few posts that has six layers.

1. Input layer
2. Hidden conv layer
3. Hidden conv layer
4. Hidden linear layer
5. Hidden linear layer
6. Output layer

We built this network using PyTorch's nn.Module class, and the Network class definition is as follows:

class Network(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5)
self.conv2 = nn.Conv2d(in_channels=6, out_channels=12, kernel_size=5)

self.fc1 = nn.Linear(in_features=12*4*4, out_features=120)
self.fc2 = nn.Linear(in_features=120, out_features=60)
self.out = nn.Linear(in_features=60, out_features=10)

def forward(self, t):
# (1) input layer
t = t

# (2) hidden conv layer
t = self.conv1(t)
t = F.relu(t)
t = F.max_pool2d(t, kernel_size=2, stride=2)

# (3) hidden conv layer
t = self.conv2(t)
t = F.relu(t)
t = F.max_pool2d(t, kernel_size=2, stride=2)

# (4) hidden linear layer
t = t.reshape(-1, 12 * 4 * 4)
t = self.fc1(t)
t = F.relu(t)

# (5) hidden linear layer
t = self.fc2(t)
t = F.relu(t)

# (6) output layer
t = self.out(t)
#t = F.softmax(t, dim=1)

return t

#### Passing a batch of size one (a single image)

In a previous episode, we saw how we can pass a single image by adding a batch dimension using PyTorch's unsqueeze() method. We'll pass this tensor to the network again, but this time we will step through the forward() method using the debugger. This will allow us to inspect our tensor as transformations are performed.

Let's begin:

> network = Network()
> network(image.unsqueeze(0))

### #1 Input layer

When the tensor comes into the input layer, we have:

> t.shape
torch.Size([1, 1, 28, 28])

This value in each of these dimensions represent the following values:

$(\text{batch size}, \text{color channels}, \text{height}, \text{width})$

Since the input layer is just the identity function, the output shape doesn't change.

The input layer can be regarded as the trivial identity function, output of the layer is equal to the input.

### #2 Convolutional layer (1)

When the tensor comes into this layer, we have:

> t.shape
torch.Size([1, 1, 28, 28])

After the first convolution operation self.conv1, we have:

> t.shape
torch.Size([1, 6, 24, 24])

The batch size is still 1. This makes sense because we wouldn't expect our batch size to change, and this is going to be the case through the entire forward pass.

The batch_size is fixed as we move through the forward pass.

The number of color channels has increased from 1 to 6. After we move forward beyond the first convolutional layer, we don't think of the channels as color channels any longer. We just think of them as output channels. The reason we have 6 output channels is due to the number of out_channels that we specified when self.conv1 was created.

#### Convolution Operations use Filters

Like we have seen, this number 6 is arbitrary. The out_channels parameter instructs the nn.Conv2d layer class generate six filters, also known as kernels, with shape 5 by 5 with randomly initialized values. These filters are used to generate the six output channels.

The out_channels parameter determines how many filters will be created.

The filters are tensors, and they are used to convolve the input tensor when the tensor is passed to the layer instance, self.conv1. The random values inside the filter tensors are the weights of the convolutional layer. Remember though, we don't actually have six distinct tensor. All six of the filters are packaged into a single weight tensor that has a height and width of five.

The filters are the weight tensors.

After the weight tensors (filters) are used to convolve the input tensor, the result is the output channels.

Another name for output channels is feature maps. The terms here are interchangeable. This is due to the fact that the pattern detection that emerges as the weights are updated represent features like edges and other more sophisticated patterns.

The algorithm:

1. Color channels are passed in.
2. Convolutions are performed using the weight tensor (filters).
3. Feature maps are produced and passed forward.

Conceptually, we can think of the weight tensors as being distinct. However, what we really have in code is a single weight tensor that has an out_channels (filters) dimension. We can see this by checking the shape of the weight tensor:

> self.conv1.weight.shape
torch.Size([6, 1, 5, 5])

This tensor's shape is given by:

(number of filters, number of input channels, filter height, filter width)

#### The relu() activation function

The call to the relu() function removes any negative values and replaces them with zeros. We can verify this by checking the min() of the tensor before and after the call.

> t.min().item()
-1.1849982738494873

> t = F.relu(t)
> t.min().item()
0.0

The relu() function can be expressed mathematically as

$f\left(x\right) = \left\{ \begin{array}{lll} 0 & \text{if} & x \lt 0 & \\ x & \text{if} & x \geq 0 \end{array} \right.$

#### The max pooling operation

The pooling operation reduces the shape of our tensor further by extracting the maximum value from each 2x2 location within our tensor.

> t.shape
torch.Size([1, 6, 24, 24])

> t = F.max_pool2d(t, kernel_size=2, stride=2)
> t.shape
torch.Size([1, 6, 12, 12])

#### Convolution layer summary

The shapes of the tensor input to and output from the convolutional layer is given by:

• Input shape: [1, 1, 28, 28]
• Output shape: [1, 6, 12, 12]

Summary of each operation that occurs:

1. The convolution layer convolves the input tensor using six randomly initialized 5x5 filters.
• This reduces the height and width dimensions by four.
2. The relu activation function operation maps all negative values to 0.
• This means that all the values in the tensor are now positive.
3. The max pooling operation extracts the max value from each 2x2 section of the six feature maps that were created by the convolutions.
• This reduced the height and width dimensions by twelve.

### CNN Output Size Formula

Let's have a look at the formula for computing the output size of the tensor after performing convolutional and pooling operations.

#### CNN Output Size Formula (Square)

• Suppose we have an $$n \times n$$ input.
• Suppose we have an $$f \times f$$ filter.
• Suppose we have a padding of $$p$$ and a stride of $$s$$.

The output size $$O$$ is given by this formula:

$O = \frac{n - f + 2p}{s} + 1$

This value will be the height and width of the output. However, if the input or the filter isn't a square, this formula needs to be applied twice, once for the width and once for the height.

#### CNN Output Size Formula (Non-Square)

• Suppose we have an $$n_{h} \times n_{w}$$ input.
• Suppose we have an $$f_{h} \times f_{w}$$ filter.
• Suppose we have a padding of $$p$$ and a stride of $$s$$.

The height of the output size $$O_{h}$$ is given by this formula:

$O_{h} = \frac{n_{h} - f_{h} + 2p}{s} + 1$

The width of the output size $$O_{w}$$ is given by this formula:

$O_{w} = \frac{n_{w} - f_{w} + 2p}{s} + 1$

### #3 Convolutional layer (2)

The second hidden convolutional layer self.conv2, transforms the tensor in the same was as self.conv1 and reduces the height and width dimensions further. Before we run through these transformations, let's check the shape of the weight tensor for self.conv2:

self.conv2.weight.shape
torch.Size([12, 6, 5, 5])

This time our weight tensor has twelve filters of height of five and width of five, but instead of having a single input channel, the number of channels is is coming in at six, which gives the filters a depth. This accounts for the six output channels from the first convolutional layer. The resulting output will have twelve channels.

Let's run these operations now.

> t.shape
torch.Size([1, 6, 12, 12])

> t = self.conv2(t)
> t.shape
torch.Size([1, 12, 8, 8])

> t.min().item()
-0.39324113726615906

> t = F.relu(t)
> t.min().item()
0.0

> t = F.max_pool2d(t, kernel_size=2, stride=2)
> t.shape
torch.Size([1, 12, 4, 4])

The shape of the resulting output of self.conv2 allows us to see why we reshape the tensor using 12*4*4 before passing the tensor to the first linear layer, self.fc1.

As we have seen in the past, this particular reshaping is called flattening the tensor. The flatten operation puts all of the tensor's elements into a single dimension.

> t = t.reshape(-1, 12*4*4)
> t.shape
torch.Size([1, 192])

The resulting shape is 1x192. The 1 in this case represents the batch size, and the 192 is the number of elements in the tensor that are now in the same dimension.

### #4 #5 #6 Linear Layers

Now, we just have a series of linear layers followed by non-linear activation function until we reach the output layer.

> t = self.fc1(t)

> t.shape
torch.Size([1, 120])

> t = self.fc2(t)
> t.shape
torch.Size([1, 60])

> t = self.out(t)
> t.shape
torch.Size([1, 10])

> t
tensor([[ 0.1009, -0.0842,  0.0349, -0.0640,  0.0754, -0.0057,  0.0878,  0.0296,  0.0345,  0.0236]])

This table summarizes the shape changing operations and the resulting shape of each:

Operation Output Shape
Identity function torch.Size([1, 1, 28, 28])
Convolution (5 x 5) torch.Size([1, 6, 24, 24])
Max pooling (2 x 2) torch.Size([1, 6, 12, 12])
Convolution (5 x 5) torch.Size([1, 12, 8, 8])
Max pooling (2 x 2) torch.Size([1, 12, 4, 4])
Flatten (reshape) torch.Size([1, 192])
Linear transformation torch.Size([1, 120])
Linear transformation torch.Size([1, 60])
Linear transformation torch.Size([1, 10])

### Training the CNN is next

We should now have a good understanding of how input tensors are transformed by convolutional neural networks, how to debug neural networks in PyTorch, and how to inspect the weight tensors of all of the layers.

In the next episode, we will begin training our network, which will lead to the values in our weight tensor to be updated to make the forward method of our network map the inputs to the correct output classes. I'll see you in the next one!

### quiz

expand_more chevron_left

### resources

expand_more chevron_left

expand_more chevron_left

Did you know you that deeplizard content is regularly updated and maintained?

• Updated
• Maintained

Spot something that needs to be updated? Don't hesitate to let us know. We'll fix it!


text:
# Crossing power sets

• January 29th 2009, 01:19 PM
nikie1o2
Crossing power sets
Ok so I have the problem:

let A and B be finite sets with lAl=m and lBl=n.
Express lP(A) X P(B)l and lP(A X B)l in terms of m and n
• January 29th 2009, 01:30 PM
Plato
Quote:

Originally Posted by nikie1o2
let A and B be finite sets with lAl=m and lBl=n.
Express lP(A) X P(B)l and lP(A X B)l in terms of m and n

$\begin{gathered}
\left| K \right| = n\;\& \;\left| J \right| = m\; \Rightarrow \;\left| {K \times J} \right| = (n)(m) \hfill \\
\left| {\mathbb{P}(K)} \right| = 2^n \;\& \;\left| {\mathbb{P}(J)} \right| = 2^m \; \Rightarrow \;\left| {\mathbb{P}(K) \times \mathbb{P}(J)} \right| = \left( {2^n } \right)\left( {2^m } \right) = 2^{n + m} \hfill \\
\end{gathered}$

And also $\left| {\mathbb{P}(K \times J)} \right| = 2^{nm}$


text:
# Mesh quality error with interpolation of table

I am trying to interpolate a table of the following form.

{{x1,y1,z1},{x2,y2,z2}...}

Where z depends on x and y, and x ranges from 0.01 to 1 in steps of 0.01, and y ranges from 0.01 to 15 in steps of 0.1 . It is a huge table so I cannot post the elements.

This is what the surface looks like.

I want to interpolate the table, however I am getting the following error regarding the mesh,

Interpolation::fememtlq: The quality 0. of the underlying mesh is too low.
The quality needs to be larger than 0..

I read that this error can be caused by collinear points, so I performed the following perturbation. I tried this at multiple values of epsilon, and also without adding a perturbation to z and the results are more or less the same.

  epsilon = 10^-5;
perturbData = {#1 + RandomReal[epsilon {-1, 1}], #2 +
RandomReal[epsilon {-1, 1}], #3 +
RandomReal[epsilon {-1, 1}]} & @@@ intrct;
reg = ConvexHullMesh[perturbData[[All, 1 ;; 2]]];
f = Interpolation[perturbData, InterpolationOrder -> 1]

However when I plot this to check how it looks I get this surface which does not seem right at all.

I am trying to find the roots of this function, but I cannot do this properly with this setup.

So I would like to know if there are any alternative ways to solve the interpolation error, or to refine the one I have.

• Did you try Interpolation[...,InterpolationOrder->1]? Jun 18 '19 at 14:35
• It's not possible to help you without the data. Either try to simplify the data and post it here (preferred) or upload the data to some sight where we can download it and work with it. Jun 19 '19 at 5:13
• Yes I have tried setting the interpolation order to 1. Here is a link to dropbox containing the table dropbox.com/sh/p2ju7nqegyne5y3/AADV4vMg9IVNEQjoAcWoaZr3a?dl=0 Jun 19 '19 at 14:20
• @Claire.Bear, unfortunately, the notebook under that link does not contain all the data. Jun 19 '19 at 15:03
• I'm sorry, but the full notebook is rather large with a lot of different computations taking place. What other data in particular do you need? The table that I am trying to interpolate is all that is in the notebook. Jun 19 '19 at 20:09

One option is to use every 5th data point:

Needs["NDSolveFEM"]
mesh = ToElementMesh[wtable[[All, 1 ;; 2]][[1 ;; -1 ;; 5]]]

mesh["Wireframe"]

if = ElementMeshInterpolation[{mesh},
wtable[[All, 3]][[1 ;; -1 ;; 5]]]

Plot3D[if[x, y], {x, y} \[Element] mesh]

Or a bit simpler:

if = Interpolation[wtable[[1 ;; -1 ;; 5]], "InterpolationOrder" -> 1];

A second option is to look for the bad data points and slightly perturb them:

mesh = ToElementMesh[wtable[[All, 1 ;; 2]]]
ToElementMesh::femimq: The element mesh has insufficient quality of 0.. A quality estimate below 0. may be caused by a wrong ordering of element incidents or self-intersecting elements.

pos = Position[mesh["Quality"], _?(# <= 0. &)]
{{1, 10791}}

{{5611, 6823, 6232}}

{{{0.46, 2.4000000000000004}, {0.56, 3.6}, {0.51, 3.}}}

This is not a good polygon:

Area[Polygon[#]] & /@ badCoords
{Undefined}

We make a new mesh:

newCoords = mesh["Coordinates"];
epsilon = 10^-3;
(newCoords[[#]] += epsilon) & /@ badInci[[All, 2]];
mesh2 = ToElementMesh[newCoords]

And a new interpolating function:

if2 = ElementMeshInterpolation[mesh2, wtable[[All, 3]]]

Plot3D[if2[x, y], {x, y} \[Element] mesh2]
`

• That worked great! Thanks very much for your help and time :) Jun 26 '19 at 15:26
• @Claire.Bear, welcome. If you are satisfied with the answer you can accept it. Jun 27 '19 at 7:41


text:
# Proton and an α -particle Are Accelerated Through the Same Potential Difference Which One of the Two Has Greater De-broglie Wavelength - Physics

A proton and an α -particle are accelerated through the same potential difference. Which one of the two has greater de-Broglie wavelength Justify your answer.

#### Solution

The de Broglie wavelength is related to the accelerating potential as

lambda=h/sqrt(2meV)

:.lambda_p=h/sqrt(2m_pe_pV)

And lambda_alpha=h/sqrt(2m_alphae_alphaV)

:.lambda_p/lambda_alpha=h/sqrt(2m_pe_pV)xxsqrt(2m_alphae_alphaV)/h=sqrt(m_alphae_alpha)/sqrt(m_pe_p)

Now, mass and charge of α particle is greater than that of proton.

∴ λp > λα for the same potential difference.

Concept: de-Broglie Relation
Is there an error in this question or solution?