text:
## GetDist : make appear mean values for contours on both x-axis and y-axis

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Dournac Fabien
Posts: 45
Joined: May 18 2019
Affiliation: IRAP
Contact:

### GetDist : make appear mean values for contours on both x-axis and y-axis

Hi,

I have an example of triplot (using triangle_plot) which is deduced from a Covariance matrix to get the contours of considered parameters.

Here the script :

Code: Select all

# Show plots inline, and load main getdist plot module and samples class
from __future__ import print_function
import sys, os
sys.path.insert(0,os.path.realpath(os.path.join(os.getcwd(),'..')))
import numpy as np
import getdist
from getdist import plots
import matplotlib.pyplot as plt
import matplotlib as mpl
# The plotting scripts also let you plot Gaussian (or Gaussian mixture) contours
from getdist.gaussian_mixtures import GaussianND
from getdist.gaussian_mixtures import Mixture2D
print('GetDist Version: %s, Matplotlib version: %s'%(getdist.__version__, plt.matplotlib.__version__))

## Load Fisher matrix and invert it to get Covariance array
# Invert to get Covariance matrix
COV_File1 = np.linalg.inv(File1)[0:7,0:7]

# Mean of each cosmo parameters : respect order of generated "Big" Fisher matrix
mean = [0.32, 0.05, -1.0, 0.0, 0.96, 0.67, 0.815]

# Names and labels
names = ['Omega_m', 'Omega_b', 'w_0', 'w_a', 'h', 'n_s', 'sigma_8']
labels = [r'\Omega_{m}', r'\Omega_{b}', r'w_{0}', r'w_{a}', r'h', r'n_{s}', r'\sigma_{8}']

# Current method
matrix1 = GaussianND(mean, COV_File1, labels = labels, names = names)

# Plot triplot
plt.rcParams['text.usetex'] = True
plt.rc_context({'axes.autolimit_mode': 'round_numbers'})
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = True
g.settings.legend_fontsize = 24
g.settings.axes_labelsize = 24
g.settings.axes_fontsize = 20
g.settings.axis_tick_x_rotation = 45
g.settings.axis_tick_y_rotation = 45
g.settings.title_limit_fontsize = 1

g.triangle_plot(matrix1,
names,
filled = True,
legend_labels = ['File1'],
contour_colors = ['green']
)
# Save triplot
g.export('output_example.png')
Below the plot :

As you can see, the mean for each of the parameter is not systematically displayed on both axis (x-axis and y-axis) : especially, on y-axis, the mean for is shown whereas on x-axis, I have just an interval and not the mean.

For Hubble parameter , I have just an interval for both axis. Same issue with and parameters.

Concerning the other parameters, everything is working fine. So what's wrong to make print these missing mean values on both axis for a triangle plot ?

Any suggestion/clue is welcome. Regards

Darshan Beniwal
Posts: 3
Joined: March 17 2020
Affiliation: Department of Physics and Astrophysics, University of Delhi, Delhi, India

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

Hi Fablen

As per my understanding your issue, I think you want to print mean value of each parameter.

Code: Select all

g.triangle_plot(matrix1,
names,
filled = True,
legend_labels = ['File1'],
contour_colors = ['green']
)
to

Code: Select all

g.triangle_plot(matrix1,
names,
line_args=[{'ls':'--', 'color':'green'},
{'lw':2, 'color':'darkblue'}],
contour_colors=['green','darkblue'],
title_limit=1,
filled = True,
legend_labels = ['File1'],
contour_colors = ['green']
)

I hope this helps you.

Sincerely.

Dournac Fabien
Posts: 45
Joined: May 18 2019
Affiliation: IRAP
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

Hi Darshan Beniwa,

Thanks for your quick answer. Unfortunately, your suggestion is not working, I get the following error at execution with :

Code: Select all

g.triangle_plot(matrix1,
names,
line_args=[{'ls':'--', 'color':'green'},
{'lw':2, 'color':'darkblue'}],
contour_colors=['green','darkblue'],
title_limit=1,
filled = True,
legend_labels = ['File1'],
contour_colors = ['green']
)
Error :

Code: Select all

  File "example_cosmocoffee_mean_issue_answer.py", line 84
contour_colors = ['green']
^
SyntaxError: keyword argument repeated
If I delete this line

Code: Select all

contour_colors = ['green']
, I get another error :

Code: Select all

Traceback (most recent call last):
File "example_cosmocoffee_mean_issue_answer.py", line 83, in <module>
legend_labels = ['File1'],
File "/Users/fab/Library/Python/3.7/lib/python/site-packages/getdist/plots.py", line 2398, in triangle_plot
lims=param_limits.get(param.name), ax=ax, _ret_range=True, **diag1d_kwargs)
File "/Users/fab/Library/Python/3.7/lib/python/site-packages/getdist/plots.py", line 1558, in plot_1d
ax=ax, **line_args[i])
File "/Users/fab/Library/Python/3.7/lib/python/site-packages/getdist/plots.py", line 968, in add_1d
raise ValueError('title_limit not currently supported for MixtureND')
[b]ValueError: title_limit not currently supported for MixtureND[/b]
This error was expected from what Antony told me in a previous post : no support of title_limit for MixtureND.

So, I have deleted also this line

Code: Select all

title_limit=1
such the code snippet looks like :

Code: Select all

g.triangle_plot(matrix1,
names,
line_args=[{'ls':'--', 'color':'green'},
{'lw':2, 'color':'darkblue'}],
contour_colors=['green','darkblue'],
filled = True,
legend_labels = ['File1'],
)

Here the plot generated :

As you can see, some mean values on both axes are missing ( on x-axis :

and on y-axis : .

What I don't understand is that for parameter, its mean is displayed (=0.96) on y-axis and not on the x-axis : this is the only difference between the 2 axes : where could this strange behavior come from ?

So, debugging to display the mean for all parameters continues. Any other suggestion would be fine.

Regards

Antony Lewis
Posts: 1685
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

The axis tick labels are in general unrelated to the mean on both axes (even for n_s the mean is not exactly 0.96). You can show means and errors in latex above each parameter if you want to (title_limit option).

Dournac Fabien
Posts: 45
Joined: May 18 2019
Affiliation: IRAP
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

Hi Antony,

I have already used the option title_limit on this previous post : viewtopic.php?f=11&t=3319&p=9078#p9078

and I got the following error :

Code: Select all

ValueError: title_limit option  not currently supported for MixtureND
You told me that error was normal since title_limit is only supported for Gaussian mixturess.

If you look at my previous snippet code, I tried as suggested by @Darshan Beniwa told me, i.e :

Code: Select all

g.triangle_plot(matrix1,
names,
line_args=[{'ls':'--', 'color':'green'},
{'lw':2, 'color':'darkblue'}],
contour_colors=['green','darkblue'],
title_limit=1,
filled = True,
legend_labels = ['File1'],
contour_colors = ['green']
)
and so following error :

Code: Select all

raise ValueError('title_limit not currently supported for MixtureND')
ValueError: title_limit not currently supported for MixtureND

Do you agree ?

Antony Lewis
Posts: 1685
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

Yes, title_limit is only with samples.

Dournac Fabien
Posts: 45
Joined: May 18 2019
Affiliation: IRAP
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

Sorry Antony, I just want to place on both axis the fiducial values contained into the following array :

Code: Select all

# Mean of each cosmo parameters : respect order of generated "Big" Fisher matrix
mean = [0.32, 0.05, -1.0, 0.0, 0.96, 0.67, 0.815]
Indeed, in my code snippet, I provide this array

Code: Select all

mean
into GaussianND :

Code: Select all

# Current method
matrix1 = GaussianND(mean, COV_File1, labels = labels, names = names)
Isn't there really a way to display these fiducial values for each subplot ? I can't convert a Sample into Covariance matrix ^^.

Regards

Antony Lewis
Posts: 1685
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

### Re: GetDist : make appear mean values for contours on both x-axis and y-axis

You can access the g.subplots array directly and add titles etc as you like. You can also use the 'markers' argument to add lines marking the mean values.


text:
The energy of a photon of light with wavelength 5000 Å is approximately 2.5 eV. This way the energy of an X-ray photon with wavelength 1Å would be
(a) 2.5/5000 eV             (b)
(c)            (d)

Concept Questions :-

X-ray
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

The graph that correctly represents the relation of frequency v of a particular characteristic X-ray with the atomic number Z of the material is

Concept Questions :-

X-ray
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

If in nature there may not be an element for which the principal quantum number n > 4, then the total possible number of elements will be

(a) 60                    (b) 32
(c) 4                      (d) 64

Concept Questions :-

Various atomic model
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

In the Bohr's hydrogen atom model, the radius of the stationary orbit is directly proportional to (n = principle quantum number)
(a) ${\mathrm{n}}^{-1}$              (b) n
(c) ${\mathrm{n}}^{-2}$              (d) ${\mathrm{n}}^{2}$

Concept Questions :-

Bohr's model of atom
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

In the nth orbit, the energy of an electron ${\mathrm{E}}_{\mathrm{n}}=-\frac{13.6}{{\mathrm{n}}^{2}}\mathrm{eV}$ for hydrogen atom. The energy required to take the electron from first orbit to second orbit will be
(a) 10.2 eV              (b) 12.1 eV
(c) 13.6 eV              (d) 3.4 eV

Concept Questions :-

Bohr's model of atom
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

In the following atoms and moleculates for the transition from n= 2 to n = 1, the spectral line of minimum wavelength will be produced by
(a) Hydrogen atom               (b) Deuterium atom
(c) Uni-ionized helium           (d) di-ionized lithium

Concept Questions :-

Spectral series
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

The Lyman series of hydrogen spectrum lies in the region

(a) Infrared                (b) Visible
(c) Ultraviolet             (d) X- rays

Concept Questions :-

Spectral series
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

The size of an atom is of the order of

(a) ${10}^{-8}$ m         (b)
(c)         (d)

Concept Questions :-

Various atomic model
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

Which one of the series of hydrogen spectrum is in the visible region

(a) Lyman series              (b) Balmer series
(c) Paschen series            (d) Bracket series

Concept Questions :-

Spectral series
High Yielding Test Series + Question Bank - NEET 2020

Difficulty Level:

The Rutherford $\mathrm{\alpha }$-particle experiment shows that most of the $\mathrm{\alpha }$-particles pass through almost unscattered while some are scattered through large angles. What information does it give about the structure of the atom

(a) Atom is hollow

(b) The whole mass of the atom is concentrated in a small centre called nucleus

(c) Nucleus is positively charged

(d) All the above

Concept Questions :-

Various atomic model

format: plain


text:
# Why is softmax function used to calculate probabilities although we can divide each value by the sum of the vector?

Applying the softmax function on a vector will produce "probabilities" and values between $$0$$ and $$1$$.

But we can also divide each value by the sum of the vector and that will produce probabilities and values between $$0$$ and $$1$$.

I read the answer on here but it says that the reason is because it's differentiable, although Both functions are differentiable.

• I think its better if you first look at logistic regression. your 'goal' is to monotonically transform $(-\infty, \infty)$ to (0,1). This is what the logistic function does. Note that any cumulative (probability) distribution function on the real line also works - see probit regression which uses the normal distribution function. – seanv507 Jul 30 '19 at 20:09
• See also: StackOverflow and ai.SE – Martin Thoma Jun 8 at 5:14

The function you propose has a singularity whenever the sum of the elements is zero.

Suppose your vector is $$[-1, \frac{1}{3}, \frac{2}{3}]$$. This vector has a sum of 0, so division is not defined. The function is not differentiable here.

Additionally, if one or more of the elements of the vector is negative but the sum is nonzero, your result is not a probability.

Suppose your vector is $$[-1, 0, 2]$$. This has a sum of 1, so applying your function results in $$[-1, 0, 2]$$, which is not a probability vector because it has negative elements, and elements exceeding 1.

Taking a wider view, we can motivate the specific form of the softmax function from the perspective of extending binary logistic regression to the case of three or more categorical outcomes.

Doing things like taking absolute values or squares, as suggested in comments, means that $$-x$$ and $$x$$ have the same predicted probability; this means the model is not identified. By contrast, $$\exp(x)$$ is monotonic and positive for all real $$x$$, so the softmax result is (1) a probability vector and (2) the multinomial logistic model is identified.

• Thank you so much. We can solve both issues by dividing by the sum of absolute values, Right? – floyd Jul 30 '19 at 1:19
• No. What happens if you sum the absolute values of both of my examples and then divide by that sum? – Sycorax Jul 30 '19 at 1:20
• really thank you. I get it now. but we can solve this issue by taking the absolute value of the numerator or maybe calculating $x_i^2/sum(X^2)$ for each value in the vector. I am not trying to be stubborn, I just find it weird that people invented a complex function although there are simpler ones to calculate probabilities. I don't know a lot of math so maybe there are other mathematical properties – floyd Jul 30 '19 at 1:34
• Your proposal still fails for $[0,0,0]$. Additional reasons for the softmax function relate to its properties as a generalization of binary logistic regression to the case of multiple outcomes. We have a number of threads about this such as stats.stackexchange.com/questions/349418/… – Sycorax Jul 30 '19 at 1:52
• In addition to Sycorax's point, applying $x_i^2 / \sum_j x_j^2$ or $|x_i| / \sum_j |x_j|$ does not have the desired property that reducing a vector element will always reduce its probability contribution. Reducing negative elements would increase their contribution. $\exp(x)$ has the nice property that its output is positive for all real inputs, and is monotonic on the whole real line. – Bridgeburners Jul 30 '19 at 13:21

Softmax has two components:

1. Transform the components to e^x. This allows the neural network to work with logarithmic probabilities, instead of ordinary probabilities. This turns the common operation of multiplying probabilities into addition, which is far more natural for the linear algebra based structure of neural networks.

2. Normalize their sum to 1, since that's the total probability we need.

One important consequence of this is that bayes' theorem is very natural to such a network, since it's just multiplication of probabilities normalized by the denominator.

The trivial case of a single layer network with softmax activation is equivalent to logistic regression.

The special case of two component softmax is equivalent to sigmoid activation, which is thus popular when there are only two classes. In multi class classification softmax is used if the classes are mutually exclusive and component-wise sigmoid is used if they are independent.

In addition to previous suggestion, the softmax function allows for an additional parameter $$\beta$$, often named temperature $$t=1/\beta$$ from statistical mechanics, that allows to modulate how much the output probability distribution is concentrated around the positions with larger input value versus smaller ones. $$\sigma(\mathbf{z})_i = \frac{e^{\beta z_i}}{\sum_{j=1}^K e^{\beta z_j}} \text{ or } \sigma(\mathbf{z})_i = \frac{e^{-\beta z_i}}{\sum_{j=1}^K e^{-\beta z_j}} \text{ for } i = 1,\dotsc , K$$ With this formulation it is also difficult to get extremely unbalanced probabilities, e.g. [1,0,0,..,0], and the system will be allowed a bit of uncertainty in its estimation. To obtain these extreme probability values very low temperatures or very high inputs are necessary. For example in a decision system one may assume temperature that decreases with the number of samples, avoiding having high certainty with very little data

Also softmax does not consider only the relative value of two numbers but their absolute value. This may be important when each input is generated aggregating data from multiple sources and having overall low values for each dimension may just intuitively mean that there is not much information about this situation and so the difference between the output probabilities should be small. While when all the input are quite high, this may mean that more information has been aggregate over time and there is more certainty. If the absolute values are higher, in softmax with the same proportion of the input a higher difference in the output probabilities will be generated. Lower input values may be generated for example when the input is generated by a NN that had fewer samples similar to current input or with contrasting outputs.


text:
This content will become publicly available on December 31, 2023

Nearly Optimal Pseudorandomness from Hardness
Existing proofs that deduce BPP = P from circuit lower bounds convert randomized algorithms into deterministic algorithms with a large polynomial slowdown. We convert randomized algorithms into deterministic ones with little slowdown . Specifically, assuming exponential lower bounds against randomized NP ∩ coNP circuits, formally known as randomized SVN circuits, we convert any randomized algorithm over inputs of length n running in time t ≥ n into a deterministic one running in time t 2+α for an arbitrarily small constant α > 0. Such a slowdown is nearly optimal for t close to n , since under standard complexity-theoretic assumptions, there are problems with an inherent quadratic derandomization slowdown. We also convert any randomized algorithm that errs rarely into a deterministic algorithm having a similar running time (with pre-processing). The latter derandomization result holds under weaker assumptions, of exponential lower bounds against deterministic SVN circuits. Our results follow from a new, nearly optimal, explicit pseudorandom generator fooling circuits of size s with seed length (1+α)log s , under the assumption that there exists a function f ∈ E that requires randomized SVN circuits of size at least 2 (1-α′) n , where α = O (α)′. The construction uses, among more »
Authors:
; ; ;
Award ID(s):
Publication Date:
NSF-PAR ID:
10387386
Journal Name:
Journal of the ACM
Volume:
69
Issue:
6
Page Range or eLocation-ID:
1 to 55
ISSN:
0004-5411
National Science Foundation
##### More Like this
1. Abstract

We continue the program of proving circuit lower bounds via circuit satisfiability algorithms. So far, this program has yielded several concrete results, proving that functions in$\mathsf {Quasi}\text {-}\mathsf {NP} = \mathsf {NTIME}[n^{(\log n)^{O(1)}}]$$\mathrm{Quasi}-\mathrm{NP}=\mathrm{NTIME}\left[{n}^{{\left(\mathrm{log}n\right)}^{O\left(1\right)}}\right]$and other complexity classes do not have small circuits (in the worst case and/or on average) from various circuit classes$\mathcal { C}$$C$, by showing that$\mathcal { C}$$C$admits non-trivial satisfiability and/or#SAT algorithms which beat exhaustive search by a minor amount. In this paper, we present a new strong lower bound consequence of having a non-trivial#SAT algorithm for a circuit class${\mathcal C}$$C$. Say that a symmetric Boolean functionf(x1,…,xn) issparseif it outputs 1 onO(1) values of${\sum }_{i} x_{i}$${\sum }_{i}{x}_{i}$. We show that for every sparsef, and for all “typical”$\mathcal { C}$$C$, faster#SAT algorithms for$\mathcal { C}$$C$circuits imply lower bounds against the circuit class$f \circ \mathcal { C}$$f\circ C$, which may bestrongerthan$\mathcal { C}$$C$itself. In particular:

#SAT algorithms fornk-size$\mathcal { C}$$C$-circuits running in 2n/nktime (for allk) implyNEXPdoes not have$(f \circ \mathcal { C})$$\left(f\circ C\right)$-circuits of polynomial size.

#SAT algorithms for$2^{n^{{\varepsilon }}}$${2}^{{n}^{\epsilon }}$-size$\mathcal { C}$$C$-circuits running in$2^{n-n^{{\varepsilon }}}$${2}^{n-{n}^{\epsilon }}$time (for someε> 0) implyQuasi-NPdoes not have$(f \circ \mathcal { C})$$\left(f\circ C\right)$-circuits of polynomial size.

Applying#SAT algorithms from the literature, one immediate corollary of our results is thatQuasi-NPdoes not haveEMAJACC0THRcircuits of polynomialmore »

3. We introduce a notion called entropic independence that is an entropic analog of spectral notions of high-dimensional expansion. Informally, entropic independence of a background distribution $\mu$ on $k$-sized subsets of a ground set of elements says that for any (possibly randomly chosen) set $S$, the relative entropy of a single element of $S$ drawn uniformly at random carries at most $O(1/k)$ fraction of the relative entropy of $S$. Entropic independence is the analog of the notion of spectral independence, if one replaces variance by entropy. We use entropic independence to derive tight mixing time bounds, overcoming the lossy nature of spectral analysis of Markov chains on exponential-sized state spaces. In our main technical result, we show a general way of deriving entropy contraction, a.k.a. modified log-Sobolev inequalities, for down-up random walks from spectral notions. We show that spectral independence of a distribution under arbitrary external fields automatically implies entropic independence. We furthermore extend our theory to the case where spectral independence does not hold under arbitrary external fields. To do this, we introduce a framework for obtaining tight mixing time bounds for Markov chains based on what we call restricted modified log-Sobolev inequalities, which guarantee entropy contraction not for allmore »


text:
# binary search terminating condition (left != right) vs (left <= right)

I have seen several implementations of binary search where they can use either (left != right) or (left <= right). For example, in normal binary search where you check if target value is in the array, using inclusive right bound (right initially set to array size-1), you will use left <= right. When you want to find the first element larger or equal to target value, you use (left != right). I think my problem is I don't understand the difference between the two. Can someone tell me the intuition of when to pick one condition over the other?

• cs.stackexchange is for questions about computer science, as in the academic discipline. As a rule of thumb, if your question depends on real-life languages/code/hardware/..., ask on Stack Overflow; if your question calls for abstract/mathematical models and reasoning, ask on Computer Science. Feb 29 '20 at 16:19

With the left != right condition, like in the following code sample, where vec is a sorted array and val is the value we are looking for,

int left = 0, right = (int)vec.size();
while(left != right) {
int mid = (left + right) / 2;
if (vec[mid] < val) left = mid + 1;
else right = mid;
}

Both left and right will in the end denote the least index where vec[i] >= val (possibly outside the bounds of the array).

With the left <= right condition, like in the following code sample,

int left = 0, right = (int)vec.size() - 1;
while(left <= right) {
int mid = (left + right) / 2;
if (vec[mid] < val) left = mid + 1;
else right = mid - 1;
}

left will in the end denote the least index where vec[i] >= val, and right the greatest index where vec[i] < val (either possibly outside the bounds of the array).

In my subjective opinion, the difference is so small that it is best to choose one and only ever use it. My preference is the former, as I find it easier to reason about just one value rather than two.


text:
It is currently 23 Jun 2017, 03:54

GMAT Club Daily Prep

Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

Events & Promotions

Events & Promotions in June
Open Detailed Calendar

A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another

Author Message
TAGS:

Hide Tags

Director
Joined: 07 Jun 2004
Posts: 612
Location: PA
A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another [#permalink]

Show Tags

27 Sep 2010, 15:25
00:00

Difficulty:

35% (medium)

Question Stats:

73% (01:40) correct 27% (00:49) wrong based on 11 sessions

HideShow timer Statistics

A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another bag has 60 marbles numbered consecutively 90 - 149 inclusive. If a marble is randomly chosen from each bag, what is the probability that two marbles have the same number

1/10

1/60

1/100

1/600

1/6000
[Reveal] Spoiler: OA

_________________

If the Q jogged your mind do Kudos me : )

CEO
Status: Nothing comes easy: neither do I want.
Joined: 12 Oct 2009
Posts: 2784
Location: Malaysia
Concentration: Technology, Entrepreneurship
Schools: ISB '15 (M)
GMAT 1: 670 Q49 V31
GMAT 2: 710 Q50 V35
Re: A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another [#permalink]

Show Tags

27 Sep 2010, 15:44
rxs0005 wrote:
A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another bag has 60 marbles numbered consecutively 90 - 149 inclusive. If a marble is randomly chosen from each bag, what is the probability that two marbles have the same number

1/10

1/60

1/100

1/600

1/6000

Common numbers : 90,91...99 total 10 numbers

probability = $$\frac{10}{{100*60}}$$ = $$\frac{1}{{600}}$$ = D
_________________

Fight for your dreams :For all those who fear from Verbal- lets give it a fight

Money Saved is the Money Earned

Jo Bole So Nihaal , Sat Shri Akaal

GMAT Club Premium Membership - big benefits and savings

Gmat test review :
http://gmatclub.com/forum/670-to-710-a-long-journey-without-destination-still-happy-141642.html

Retired Moderator
Joined: 02 Sep 2010
Posts: 803
Location: London
Re: A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another [#permalink]

Show Tags

27 Sep 2010, 15:47
No of ways to pick two marbles = 100*60 = 6000

No of ways to pick same number = (90,90) , ... , (99,99) = 10

So probability = 1/600
_________________
Senior Manager
Status: Time to step up the tempo
Joined: 24 Jun 2010
Posts: 408
Location: Milky way
Schools: ISB, Tepper - CMU, Chicago Booth, LSB
Re: A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another [#permalink]

Show Tags

27 Sep 2010, 20:50
rxs0005 wrote:
A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another bag has 60 marbles numbered consecutively 90 - 149 inclusive. If a marble is randomly chosen from each bag, what is the probability that two marbles have the same number

1/10

1/60

1/100

1/600

1/6000

My approach:

Pickup the matching 10 numbered marbles from the first bag -- Probability - 10/100 -- 1/10

Now we have one of the marble numbered from 90 - 99. From the other bag we need to pick just the one marble which will have a number from 90 - 99 to ensure we have a matching marble set. Its probability is 1/60.

Hence combined probability is (1/10) * (1/60) -- 1/600. Answer D.

There is a similar question in this forum , check this out -- http://gmatclub.com/forum/junior-58914.html
_________________

Support GMAT Club by putting a GMAT Club badge on your blog

Manager
Joined: 16 Sep 2010
Posts: 123
Location: India
Schools: Terry, Georgia Tech
WE 1: Working for Wipro Technologies since April 2010
Re: A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another [#permalink]

Show Tags

27 Sep 2010, 22:03
ezhilkumarank wrote:
rxs0005 wrote:
A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another bag has 60 marbles numbered consecutively 90 - 149 inclusive. If a marble is randomly chosen from each bag, what is the probability that two marbles have the same number

1/10

1/60

1/100

1/600

1/6000

My approach:

Pickup the matching 10 numbered marbles from the first bag -- Probability - 10/100 -- 1/10

Now we have one of the marble numbered from 90 - 99. From the other bag we need to pick just the one marble which will have a number from 90 - 99 to ensure we have a matching marble set. Its probability is 1/60.

Hence combined probability is (1/10) * (1/60) -- 1/600. Answer D.

There is a similar question in this forum , check this out -- http://gmatclub.com/forum/junior-58914.html

my approach.....

probability of picking a marble from 0 -99 in the first set = 1/100 { since 0-99 is hundred marbles}

similarly, probability of picking a marble from 90-149 in the second set = 1/60

therefore, probability that they are same = (1/100) * (1/60) = 1/6000

it can happen for 10 marbles ( 90 to 99 inclusive ) .

Thus, total probability = 10 *1/6000 = 1/600 ANS
_________________

Samidh
-------------------------------------------------------------------------------------------
Feel free to get in touch if you feel I can be of some assistance to you. You can find me in Facebook if you search!

Consider giving me some kudos if you like my post

Re: A bag has 100 marbles numbered consecutively 0 - 99 inclusive. Another   [#permalink] 27 Sep 2010, 22:03
Similar topics Replies Last post
Similar
Topics:
Jeffrey has a bag of marbles. The bag contains 6 red, 6 yellow, 12 1 24 Apr 2017, 00:37
2 What is the sum of all consecutive integers from 10 to 100, inclusive? 9 26 Oct 2016, 19:16
S is a set of 100 consecutive multiples of 3. If the smallest number 2 16 Sep 2016, 07:19
If the set S is composed of the following numbers {99, 100, 100, 105, 2 15 Aug 2016, 19:13
26 If 1/3 of the total number of marbles in the three bags listed in the 5 13 Jun 2017, 04:45
Display posts from previous: Sort by


text:
Get a free home demo of LearnNext

Available for CBSE, ICSE and State Board syllabus.
Call our LearnNext Expert on 1800 419 1234 (tollfree)
OR submit details below for a call back

clear
searchtune

Feb 11, 2015

infinity

Jun 24, 2014

Value of sin 2π?

since sin(2npi) = 0
Thus n=1=>

Dec 10, 2014

Find the angle between the lines whose direction cosines are given by the equations 3l + m + 5n = 0 and 6mn - 2nl + 5lm = 0

Sol:
Given lines are 3l + m + 5n = 0

m = - (3l + 5n) -----------(1)

and 6mn - 2nl + 5lm = 0 ----------(2)

Substitute m in equation (2) we obtain
...

Feb 2, 2014

What is one one and onto function? Explain with example

Sol: for x1  x2 or f(x1)

Jan 20, 2015

0∫π/2 log(sinx)dx

Let I = $\underset{\text{0}}{\overset{\frac{\pi }{}}{\int }}$

Oct 5, 2013

State and prove de-moivre's theorem,

De-moivre’s theorem:
(cosθ + i sinθ)n = (cos nθ + i sin nθ) for all n ϵ N
Proof:
We have to prove this theorem u...

Feb 24, 2015

There is the probability that a mathematics teacher will give an unannounced test during any class meeting is 1/ 5. If a student is absent twice, what is the probability that he will miss at least one test?

GIven that probability that a mathematics teacher will give an unannounced test during any class meeting is 1 / 5.
the probability of not missing the test = 1 - 1/5 = 4/ 5
T...

Nov 4, 2014

Nov 20, 2014

Feb 9, 2015


text:
# Find all elements $b\in\mathbb{Z}_{17}$ such that for at least one $x \in \mathbb{Z}_{17}$: $x^2 + 3x + b = 0$

Find all elements $b\in\mathbb{Z}_{17}$ such that for at least one $x \in \mathbb{Z}_{17}$:
$x^2 + 3x + b = 0$

Hi everyone, this one has me wondering. I'm not all that confident with second degree equations in rings as it is, but how do I deal with the term $b$? Any tips or whole solutions would be nice.

• Well by brute force you cal list all $x^2 + 3x$ and then $b$ must simply be it additive inverse of those values. – fleablood Dec 4 '17 at 23:33

Since $17$ is prime, $\mathbb{Z}_{17}$ is not just a ring, but a field. Solving equations in a field, works the same all the time. Also you could just go about and solve

$x^2+3x+0=0$

$x^2+3x+1=0$

...

$x^2+3x+16=0$

$x_{1,2}=-\frac{3}{2}\pm\sqrt{\frac{9}{4}-b}$

Since there are no fractions in $\mathbb{Z}_{17}$ you have to ask what $2^{-1}$ and $4^{-1}$ is. We search $y\in\mathbb{Z}_{17}$ with $2y=1$ Since $2\cdot 9=18=1\mod 17$ it is $2^{-1}=9$

The same for 4y=1 we get y=13, hence $4^{-1}=13$

$x_{1,2}=-3\cdot 9\pm\sqrt{9\cdot 13-b}$

$x_{1,2}=-27\pm\sqrt{117-b}$

We can reduce this mod 17 as well. But this is not needed. It just makes the calculation easier, in my opinion.

$x_{1,2}=7\pm\sqrt{15-b}$

So this just one solution for $b=15$, and two solutions if $15-b$ is a square in $\mathbb{Z}_{17}$.

Note, that you can not write $15-b<0$ like in $\mathbb{R}$, since there is no order $<$ on $\mathbb{Z}_{17}$. It is a field that can not be arranged. Like $\mathbb{C}$.

• Hi, thank you for your answer. I'm really interested in your comment: "Since $17$ is prime, $Z_{17}$ is not just a ring, but a field. Solving equations in a field, works the same all the time." Does that mean that there would be a different approach if we were in $Z_{18}$, where $18$ is not prime? – Something Dec 6 '17 at 20:28
• You have to be carefull then, since $\mathbb{Z}_{18}$ has zero divisors, like $2\cdot 9=18=0$ for example. – Cornman Dec 6 '17 at 20:50
• "Solving equations in a field, works the same all the time" - close, but not quite true. For example you can't use the quadratic formula in ${\Bbb Z}_2$ because then dividing by $2$ means dividing by $0$. – David Dec 6 '17 at 23:28
• But that is a little bit like cheating, since you always have to be careful that you divide by 0. – Cornman Dec 6 '17 at 23:55

In ${\Bbb Z}_{17}$ we have \eqalign{x^2+3x+b=0\quad &\Leftrightarrow\quad x^2-14x+b=0\cr &\Leftrightarrow\quad (x-7)^2-49+b=0\cr &\Leftrightarrow\quad b=49-(x-7)^2\cr &\Leftrightarrow\quad b=-2-(x-7)^2\ .\cr} So $b$ must be $-2$ minus a square. The squares in ${\Bbb Z}_{17}$ are $$0^2=0\ ,\quad 1^2=16^2=1\ ,\quad 2^2=15^2=4$$ and so on. So the values of $b$ are $$-2-0=-2=15\ ,\quad -2-1=-3=14\ ,\quad -2-4=-6=11\ ,$$ and a few more which I'm sure you can find for yourself.

• Thank you, very easy to follow and understand. – Something Dec 6 '17 at 20:40

Well by brute force you cal list all $x^2 + 3x$ and then $b$ must simply be it additive inverse of those values.

$x^2 + 3x + b\equiv 0\mod 17$

$b \equiv -x^2 - 3x = -x(x+3) \mod 17$.

So just list them all: $-0*3 = 0; -1*4= 13; -2*5=7.... etc.$

It's interesting as $-14*0=0$ so there will be fewer than $17$ distinct answers.

$(7 - i)(10-i) = 70 - 17i +i^2 \equiv 70 + 17i + (-i)^2 =(7 + i)(10+i)$ so you only have to check for $x=0... 7$.

They are $0,-4,7,-1,6,-6,3,2$. I don't really see any pattern in that to get any further insight how to solve without brute force.

• Hi, thank you for your answer. I can't help but notice that David above has one answer that is $b = 15$ while you don't. Who is wrong here? Also, I would like to ask where you got $(7-i)(10-i)$ from. – Something Dec 6 '17 at 20:49


text:
# Juan is making spaghetti and he adds 29 grams of NaCl to 250 grams of water. What is the boiling point of this solution?

Aug 22, 2016

Approximately 214.32 degrees Fahrenheit

#### Explanation:

The salt (NaCl) content of this water is 11.6%. 20% salty water has 216 degrees Fahrenheit boiling point.

Pure water has a boiling point of 212 degrees Fahrenheit. When you build an equation Delta t = 4 degrees F when salt has a concentration of 20%, you can calculate the boiling point of Juan's water. The answer is 214.32 degrees Fahrenheit.

Aug 22, 2016

100.50 degrees celcius.

#### Explanation:

If you dissolve 29.2 g of sodium chloride in 1 kg water, you create what is known as a "0.5 molal" solution (as opposed to 0.5 molar solution, which is 29.2 g of sodium chloride dissolved in 1 litre of solution).

The boiling point of water is raised by 0.5 degrees celcius for each 0.5 molality of the solution, so instead of boiling at 100 degrees C it would boil at 100.50 degrees C.


text:
# How do you write an algebraic expression for the phrase: the quotient of twenty and a number?

$\frac{x}{20}$
a number = $x$
quotient = $/$


text:
# Folding a piece of paper in half [closed]

How tall would a piece of paper be if you folded it 100 times?

(Assume a normal piece of paper, and that you could theoretically fold the paper perfectly in half.)

• This looks like a homework. Also lateral-thinking in hypothetical situation? – Zikato Mar 23 '15 at 6:43
• Not homework. Just looking for interesting ways people approach this. – TwoShorts Mar 23 '15 at 6:44
• this is not a puzzle and it has been discussed here:iflscience.com/space/…, scienceblogs.com/startswithabang/2009/08/31/…, math.stackexchange.com/questions/729033/… – user9174 Mar 23 '15 at 7:44
• Depends on what you mean by folding 100 times. Do you mean 101 layers of paper or $2^{100}$ layers of paper? – kasperd Mar 23 '15 at 13:25
• Your title states "in half" but in the question you only say "if you folded it 100 times"? Must the paper be folded in half... or just folded? – Digital Chris Mar 23 '15 at 14:51

If you had some sort of super paper that defied all laws of physics, and was $0.05 \text{mm}$ thick, then folding it a hundred times would give a thickness of:
$0.05 \times 2^{100} \text{mm}$
$\approx 6.34\times10^{28} \text{mm}$
Note that the observable universe has a width of around: $8.8\times10^{29} \text{mm}$

Using the paper folding formula $W = \pi t \times 2^{3(n-1)/2}$ where $W$ is the width (of a square piece of paper), $n$ is the number of folds and $t$ is the thickness, we find that the width of the paper would have to be $0.05\pi \times 2^{3(100-1)/2}\text{mm}$ wide, to be foldable 100 times. This is approximately $7.9\times10^{43} \text{mm}$, which is larger than the universe, and hence we can deduce such paper does not exist.

A 'normal piece of paper' cannot be folded more that 7 times.

If any paper can be used, then it can be folded upto 12 times maximum ( Gallivan demonstrated that a single piece of toilet paper 4000 ft (1200 m) in length can be folded in half twelve times.)

Let's consider an ideal case that the paper can be folded 100 times,

Let the length and width of the paper be x and y.

Then after folding 100 times, the length and height will be x/(2^50) and y/(2^50)

Lateral Thinking: The length and width of the paper will remain the same after any number of folds. Only the height and width of the new shape will get reduced.

As we can see

1 fold = 2 layer of paper
2 fold = 4 layer
3 fold = 8 layer
4 fold = 16 layer
5 fold = 32 layer

we can get formula
Number of paper layers = (2)n where n is number of folds.
for 100 folds it will be (2)100
Height will be (2)100 X (Thickness of paper)


text:
# Checking if H is a subgroup of G

1. Jun 19, 2011

### Samuelb88

1. The problem statement, all variables and given/known data
Let $G = GL_n(\mathbb{C})$ and $H = GL_n(\mathbb{R})$

2. Relevant equations
Prop. A subset H of a group G is a subgroup if:
1. If $a,b \in H$, then $ab \in H$.
2. $1 \in H$
3. $\forall a \in H$ $\exists a^{-1} \in H$.

3. The attempt at a solution

My intuition says the answer is yes since the $\mathbb{R} \subset \mathbb{C}$, it seems reasonable to say the same about the general linear group of invertible $n \times n$ matrices. So if I am understanding how to check if H is a subgroup of G correctly, I need to test the three conditions above. Here goes:

1. Let $a,b \in GL_n(\mathbb{R})$. Then the product of two $n \times n$ matrices $a,b$ is an $n \times n$ matrix $ab$. Thus $ab \in GL_n(\mathbb{R})$.

2. The $n \times n$ identity matrix $I \in GL_n(\mathbb{R})$ since $\det(I)=1$ $\forall n$.

3. From the definition of $GL_n(\mathbb{R}) = \{ n \times n \, \, \, invertible \, \, \, real \, \, \, matrices\}$, it follows that $\forall a \in GL_n(\mathbb{R})$ $\exists a^{-1} \in GL_n(\mathbb{R})$.

So does this show that $GL_n(\mathbb{R}) \subset GL_n(\mathbb{C})$? I'm confused since I haven't even mentioned $GL_n(\mathbb{C})$.

2. Jun 20, 2011

### HallsofIvy

Yes, you did. You said that $GL_n(\mathbb{R})\subset GL_n(\mathbb{C})$. Once you have that, you only need to look at $GL_n(\mathbb{R})$.


text:
A big problem in deep-learning is the lack of data. In remote sensing, in addition to the fact that the publicly available data is rare, most of it do not have the same resolution.

Several papers show a real use of the hyperspectral in deep learning. Unfortunately, except for small hyperspectral resolution, used for land or aerial imaging, the resolution for those hyperspectral sensors are generally worse than that of RGB sensor.

This paper shows a super-resolution method to put the hyperspectral band with a larger GSD to the same resolution than that of the RGB image. Those images can be used to better analyse data and thus improve prediction accuracy.

The data used for creating the method came from the constelation of Sentinel-2 (S2), two identical satellites with the same sensors at 180 degrees of each other. The sensor gives 13 bands with different information and resolution.

The big avantage from S2 is than they cover the entire earth and all the data are accesible for every one.

## The Method

Since the resolutions are 10, 20, and 60m, and they want to generalise every band at 10m GSD, they use 2 CNNs: one to upgrade 20m images to 10m images and the other to upgrade the resolution from 60m to 10m. In that case, they do not need annotated images, but they use the real value for a 20m and 60m resolution for ground truth and they downsample the training images to 40 and 360m as follow.

In this way, they can train the two networks, to be able to learn 2x and 6x super resolutions. At the end they will use those networks to predict on 10m GSD with no way to quantify the results’ accuracy.

This super-resolution algorithm optimised for (but conceptually not limited to) S2, with the following characteristics:

• significantly higher accuracy of all super-resolved bands
• better preservation of spectral characteristics
• favourable computational speed when run on modern GPUs
• global applicability for S2 data without retraining, according to our (necessarily limited) tests
• generic end-to-end system that can, if desired, be retrained for specific geographical locations and land-covers, simply by running additional training iterations
• free, publicly available source code and pre-trained network weights, enabling out-of-the-box super-resolution of S2 data.

They obtain 2 networks, DSen2 and VDSen2, the difference is the $$d$$ and $$f$$ that will be 6, 128 for the DSen2 and 32, 256 for VDSen2.


text:
# Tag Info

0

Deleting a file inturn translates to vfs_unlink and then fs specific fs_unlink system call to get executed. Precisely these calls get to parent directory and removes the inode of corresponding file causing that file's dentry to become negative. The data on disk(whatever size it is of) remains as it is, with only one change: block where it's residing are ...

2

rm deletes files regardless of their size. Very large files can take a little time to delete, because the filesystem needs to mark all the blocks that the file used as available. That cost has to be paid at one time or another; if you don't pay it at deletion time, you pay it when files are created. Zfs offers a way to defer the cost of deleting a directory ...

0

I ran into problems using find with -delete due to the intentional behavior of find (i.e. refusing to delete if the path starts with ./, which they do in my case) as stated in its man page: -delete Delete found files and/or directories. Always returns true. This executes from the current working directory as find recurses down the tree. It will ...

3

-size with a suffix of b is for 512-byte blocks, not bytes. 5000000b is 2,560,000,000 bytes or 2.5 GB Try: find /home -size +5M -name "error_log" -exec rm -rf {} \; From the GNU find man page: -size n[cwbkMG] File uses n units of space. The following suffixes can be used: b' for 512-byte blocks (this is the default if no suffix is ...

1

Making rm prompt for confirmation (as in Rui F Ribeiro's answer) will get you in the habit of depending on that. Then should you ever log in to a different system, you'll be in for an unwelcome surprise. Instead, I'd suggest retraining yourself—two approaches come to mind: One, which you suggested, is to make rm just not work. That's fairly easy, alias ...

2

Usually a good strategy, and specially to users with admin privileges, is aliasing the rm command to rm -i, that requires confirmation. place it on your .bashrc alias rm='rm -i'

0

Using ricchard's idea removing all except last in month: rm -f ls *.sql | sort | uniq w11 -D -u` To view what will be deleted: ls *.sql | sort | uniq w11 -D -u

1

if rm -rf directoryname fails you, try using rm -R -f directoryname, or rm --recursive -f directoryname. If you are not having any luck with these, you should consider reinstalling rm or switching shells.

0

how about running a file system check on the SD card? insert the card and under linux run fsck /dev/mmcblk01p1 for example. If you're note sure what's the name of the device name given, just see dmesg upon inserting the card. Aaand do not forget to umount it prior fsck

0

I had a similar issue with my SD card recently. I was not able to fix it under Linux. However, as soon as I plugged the card into a Windows machine, the system came up with a message asking whether I want to repair the card as apparently it was not unmounted correctly. The repair under Windows helped.

0

find . -depth -type d -exec rmdir {} + is the simplest and standard compliant answer to this question. The other answers given here unfortunately all depend on vendor specific enhancements that do not exist on all systems.

1

Under bash, you can bypass an alias by prepending a \ to the command, so rm filename becomes \rm filename

10

GNU rm supports -i, which I assume is what you are referring to and asks for confirmation for each file, but also -I, which is a little different: -I prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giv‐ ing protection against most mistakes As to whether it's ...

2

with Ctrl+c you will be able to cancel the operation. But if you look in your .bashrc file, you can comment the alias that force the confirmation, it use the -i param as expained dhag. in you .bashrc you will find a entry like this : alias rm='rm -i' if you comment it, your rm -f will works directly

17

To accomplish request 1 you will need to use a more sophisticated program than yes to send y N number of times and then pass keyboard input through beyond that. You can't do it with rm except to always ask (rm -i) or to never ask (rm -f). You can always abort rm by pressing Control-C to interrupt it (sends SIGINT), pressing Control-Z to stop it (sends ...

4

Another quickie, also without an explicit loop. Don't forget, you can prefix the rm -f with echo to test this out. ( cd dir2 && find . -maxdepth 1 -type f -print0 ) | ( cd dir1 && xargs -0 rm -f ) You can put this into a script, replacing dir1 with "$1" and dir2 with "$2"

-1

Use rsync : rsync --verbose --remove-source-files xyz/* . pop3-2.dump pop3-3.dump pop3.dump popcorn-build.log sent 852,069,995 bytes received 124 bytes 113,609,349.20 bytes/sec total size is 851,861,745 speedup is 1.00

0

Quick answer... #!/bin/bash #finddel dir1 dir2 for i in $(ls$1) do [ -f $2/$i ] && echo "Deleting $2/$i" && rm -f $2/$i done

4

To handle filenames with spaces: #!/bin/bash OPWD=$(pwd) cd "$1" for MYFILE in "$2"/* do if [ -f "${MYFILE##/*/}" ] then echo "removing ${MYFILE##/*/}" rm "${MYFILE##/*/}" fi done cd "\$OPWD"

1

rsync can do this with the --existing option: rsync -v --existing dir2/* dir1/

2

Actually, there's a single command that does exactly what you're asking. rsync -av --existing dir2/ dir1/ This will recursively copy the files from dir2 into dir1 only if the file already exists in dir1. The -av options are the options you'll usually use for copying files using rsync. The --existing option tells rsync to skip creating new files on ...

Top 50 recent answers are included


text:
Deepak Scored 45->99%ile with Bounce Back Crack Course. You can do it too!

# In Duma's method of estimation of nitrogen,

Question:

In Duma's method of estimation of nitrogen, $0.1840 \mathrm{~g}$ of an organic compound gave $30 \mathrm{~mL}$ of nitrogen collected at $287 \mathrm{~K}$ and $758 \mathrm{~mm}$ of Hg pressure. The percentage composition of nitrogen in the compound is___________ (Round off to the Nearest Integer).

Solution:

In Duma's method of estimation of Nitrogen.

$0.1840 \mathrm{gm}$ of organic compound gave $30 \mathrm{~mL}$

of nitrogen which is collected at $287 \mathrm{~K} \& 758$

$\mathrm{mm}$ of $\mathrm{Hg}$.

Given ;

Aqueous tension at $287 \mathrm{~K}=14 \mathrm{~mm}$ of $\mathrm{Hg}$.

Hence actual pressure $=(758-14)$

$=744 \mathrm{~mm}$ of Hg .

Volume of nitrogen at $\mathrm{STP}=\frac{273 \times 744 \times 30}{287 \times 760}$

$\mathrm{V}=27.935 \mathrm{~mL}$

$\because 22400 \mathrm{~mL}$ of $\mathrm{N}_{2}$ at STP weighs $=28 \mathrm{gm}$.

$\therefore 27.94 \mathrm{~mL}$ of $\mathrm{N}_{2}$ at STP weighs $=$

$\left(\frac{28}{22400} \times 27.94\right) \mathrm{gm}$

$=0.0349 \mathrm{gm}$

Hence $\%$ of Nitrogen $=\left(\frac{0.0349}{0.1840} \times 100\right)$

$=18.97 \%$

Rond off. Answer $=19 \%$


text:
# Homework Help: Variance of binomial distribution - 1 trial

1. Jul 31, 2012

### operationsres

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

For n trials, $S_n$ can be seen as the sum of n independent single trials $X_i$, i = 1,2,...,n, with $\mathbb{E}[X_i]$=p and Var$[X_i]=p(1-p)$.

2. What I don't understand

I don't understand why Var$[X_i]=p(1-p)$.

We know that: Var$[X_i]=\mathbb{E}[(X_i - \mathbb{E}[X_i])^2] = \mathbb{E}[X_i^2 - 2X_i\mathbb{E}[X_i] + \mathbb{E}[X_i]^2] = \mathbb{E}[X_i^2] - \mathbb{E}[X_i]^2$.

Taking $\mathbb{E}[X_i]^2$, we have $\mathbb{E}[X_i]^2=p^2$.

Taking $\mathbb{E}[X_i^2]$, we have $\mathbb{E}[X_i^2]=\mathbb{E}[\prod_{i=1}^2X_i] = \prod_{i=1}^2 \mathbb{E}[X_i] = \mathbb{E}[X_i]^2 = p^2$.

So Var$[X_i]= p^2 - p^2 = 0 \not= p(1-p)$, which contradicts what my lecture notes say.

2. Aug 1, 2012

### Ray Vickson

No, $E X_i^2 \neq p^2.$ In fact, $E f(X_i) = \sum_{k} P\{X_i = k\} f(k)$ for any function f, so we get $E X_i^2 = p.$

RGV

3. Aug 1, 2012

### operationsres

Enlightening post, thank you.

I guess my error was assuming that X_i was independent in:
$\mathbb{E}[X_i^2]=\mathbb{E}[\prod_{i=1}^2X_i] = \prod_{i=1}^2 \mathbb{E}[X_i] = \mathbb{E}[X_i]^2 = p^2$.

?

But they're the same event so that would be non-sensical....

4. Aug 1, 2012

### voko

Use the definition of variance of a discrete variable.


text:
# Java 9 Improvements

RunninglVlan
1,512 views

### Open Source Your Knowledge, Become a Contributor

We've found, while teaching developers about lambdas and Streams in Java 8, that many developers really appreciate the code that comes out at the other end. It tends to read a lot more like the problem that developers are trying to solve than traditional for loops and, as a side effect, is often shorter to boot. That doesn't mean that the Streams API is perfect or even complete. In this article we will be looking at a few small improvements that were introduced in Java 9 that make it even better.

## ofNullable

The Stream interface has a couple of factory methods called of() that allow you to create Streams from pre-specified values - one is an overload for a single value and the other takes a varargs parameter. These are incredibly useful both when you're trying to test out Streams code and also when you want to just instantiate a Stream with a few values. Java 9 adds an ofNullable() factory - let's see how you might use it and what it's for.

Let's suppose we're trying to find a location to put some configuration files in a Java application. We want to look at a couple of different properties - e.g. "app.config" and "app.home". Let's write this code in Java 8:

final String configurationDirectory =
Stream.of("app.config", "app.home", "user.home")
.flatMap(key -> {
final String property = System.getProperty(key);
if (property == null) {
return Stream.empty();
}
else {
return Stream.of(property);
}
})
.findFirst()
.orElseThrow(IllegalStateException::new);

Hmm, that's a little bit ugly right - What's going on here? Well we're looking up each property in our Stream and using the flatMap operation. We use flatMap here because it allows us to map an element to 0 or 1 elements in the Stream. If we can lookup the system property then we return a Stream containing only it, but if we can't look it up then we return an empty Stream in its place. This results in no element being added into the stream.

Unfortunately what we've ended up with is a fairly large statement style lambda expression with a null check in the middle of the code. One alternative would be to use a ternary operator

final String configurationDirectory =
Stream.of("app.config", "app.home", "user.home")
.flatMap(key -> {
final String property = System.getProperty(key);
return property == null ? Stream.empty() : Stream.of(property);
})
.findFirst()
.orElseThrow(IllegalStateException::new);

Even after this refactor, however, the code reads slightly inelegantly. Java 9's ofNullable would allow us to write the same pattern much more succinctly and more readably.

// {...}
final String configurationDirectory =
Stream.of("app.config", "app.home", "user.home")
.flatMap(key -> Stream.ofNullable(System.getProperty(key)))
.findFirst()
.orElseThrow(IllegalStateException::new);
System.out.println(configurationDirectory);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

It's worth noting for the sake of completeness that this isn't the only way to solve this problem in code, we could also have mapped over the System.getProperty() function and then filtered out the null values. That is perhaps a more natural way of writing this code for some people, but has the downside of resulting in null values getting into our Stream - something we try to steer clear of.

## takeWhile and dropWhile

We have an application that is processing payments being made on an ecommerce website and we're maintaining a list of all payments in the current day that are sorted from the most expensive down to the cheapest. We have a business requirement to produce a report on every payment that is £500 or greater in value at the end of the day. A natural way of writing this code using Java 8 Streams might be:

final List<Payment> expensivePayments = paymentsByValue
.stream()
.filter(payment -> payment.getValue() >= 500)
.collect(toList());

Unfortunately the downside of this approach is that if you start processing lots and lots of transactions in a day the filter operation gets applied to every transaction in your input list. You know that your input list is sorted by descending value of the transaction, so once you have found a transaction that fails your predicate every transaction after that point can be filtered out. Thankfully Java 9 solves this problem with the addition of a takeWhile operation.

// {...}
final List<Payment> expensivePayments = paymentsByValue
.stream()
// try changing to dropWhile and see what happens
.takeWhile(payment -> payment.getValue() >= 500)
.collect(toList());
System.out.println(expensivePayments);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

While filter retains all elements in the Stream that match its predicate, takeWhile stops once it has found an element that fails to match. The dropWhile operation does the inverse: throws away the elements at the start where the predicate is false.

One subtlety that affects takeWhile() and dropWhile() relates to infinite streams. If you have an infinite stream and apply a takeWhile operation that eventually returns false on an element in the stream then it gets truncated at that point. When applying the dropWhile operation to an infinite stream, the result can still be an infinite stream. If the the predicate always returns true then the Stream will continue to drop elements. Consider:

IntStream.iterate(0, i -> i)
.dropWhile(i -> true)
.forEach(System.out::println);

If you run this, the program will look like it's hanging and not terminate. This is because the dropWhile results in an infinite stream with no elements. If we re-wrote it as the following program, then it would terminate:

IntStream.iterate(0, i -> i)
.takeWhile(i -> false)
.forEach(System.out::println);

Here's a visual example:

// {...}
IntStream.iterate(0, i -> ++i)
.takeWhile(i -> i < 5)
.forEach(System.out::println);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Now so far we've talked about streams that have a defined order: an encounter order. The order of streams can be defined at its source, for example if we're streaming from a list of values then the order in the list is the encounter order. It is also possible to have stream operations that introduce an encounter order into their pipeline, for example sorted(). Most, but not all, of the practical use cases of takeWhile() and dropWhile() rely upon their input streams having a defined encounter order.

One usecase for wanting to apply takeWhile() on an unordered stream if you want to be able to stop the Stream operation. For example perhaps you have a Stream operation that may operate on an infinite stream, processing all the data in it, but you want to be able to stop the Stream when you application shuts down or if a user needs to cancel the stream pipeline. You can do this with a takeWhile() operation that reads from a piece of external state, such as a volatile boolean flag. When you want to stop the stream pipeline, you simply set it to be false.

## iterate

A related update is the introduction of an alternative iterate() method for creating streams. The vintage iterate method from Java 8 takes an initial value and a function that provides the next value in the Stream. Take a look at the following code example.

IntStream.iterate(3, x -> x + 3)
.filter(x -> x < 16)
.forEach(System.out::println);

This code prints out all the numbers that are divisible by 3 and less than 16. We start with 3, which is divisible by 3 and add 3 every time we iterate. We then filter to ensure that the numbers are less than 16 and use a method reference to print out the resulting numbers. Looks simple, but if you run it you'll find that there's a pretty big problem.

The program never terminates, it keeps on adding 3 in a loop indefinitely. That's because there's no way to know in the filter that the numbers continue to increase. We can solve that problem with the new version of iterate in Java 9 which also takes a predicate as its second argument that tells us when to continue iterating up until. So we rewrite our code as follows.

// {...}
IntStream.iterate(3, x -> x < 16, x -> x + 3)
.forEach(System.out::println);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Hey presto, it now stops running after it has printed out the number 15. Our sample code here used the IntStream interface since we were operating on primitive int values, but the iterate() methods appear on both the primitive and regular Stream interfaces.

## Conclusion

In this article we've gone through four new additions to the Streams API that appear in Java 9 and help fill in some small gaps in its functionality. In the next article we will be talking about the improvements to the Collectors API in Java 9. Hopefully you will join us for that, or on one of our in-house training courses.

## Notes

This playground is based on IteratrLearning's article Stream Improvements in Java 9

Similar playground by Gowgi: Java 9 Streams Enhancements

Open Source Your Knowledge: become a Contributor and help others learn.


text:
# Investigation: Modeling Cells in Solutions

Osmosis is the movement of water across a selectively permeable membrane, meaning that it allows some things to cross it, but not others. The cell membrane is permeable to water, which means that water can move across the membrane. Water moves in the direction where there is the most solute. Solutes are just particles that have been dissolved in water, like sugar or salt, or other cellular materials.   Water will move toward the area with the greatest solute concentration. For example, if you place a cell in a salty solution, the water in the cell will move out of the cell, causing the cell to shrink.

There are three different types of solutions:

Hypotonic =  solution has LESS solutes than the cell
Hypertonic = solution has MORE solutes than the cell
Isotonic = solution has the same amount of solute as the cell

Pre-Lab Questions

1. Osmosis is the movement of  [ solutes / water ] across a membrane
2. A cell that is 1% salt is placed in a solution that is 3% salt.  This solution is [ hypotonic / hypertonic / isotonic ] relative to the cell.
3. The cell placed in this solution will [ gain / lose ] water.
4. The cell will then [ shrink  / swell ].
5. The cell membrane is selectively _________________________________,

Modeling Osmosis

1. Obtain 3 deco-cubes that have been soaked overnight. These cubes are absorb water and are used as decoration in flower vases.
2. Measure each cube side in millimeters (length, width, height). Calculate the volume of each cube and complete the data table.  Volume = length x width x height.
3. Place the cubes in the following solutions:  Salt water | Tap Water | Distilled Water. Label your cups.
4. Let cubes sit for 24 hours and measure the volume of each the next day.

 DATA TABLE Volume (Day 1) Volume (Day 2) Cube 1 (Tap Water) Cube 2 ( Salt Water) Cube 3 (Distilled Water)

Analysis

1. Which solution was hypertonic relative to the cube? How do you know?
2. Which solution was hypotonic relative to the cube? How do you know?
3. How does the cube serve as a model for the cell? (Consider properties it has that is similar to a cell.)
4. What do you think would happen to a carrot that was soaked overnight in salt water? Explain your reasoning.
5. Describe what would happen to a blood cell that was placed in a HYPOTONIC solution.

Investigation: Modeling Cells in Solutions is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.


text:
# Tikzpicture with remember picture and overlay inserting vertical space

I am trying to insert additional vertical space at the top, but instead this vertical space is inserted after the first title line:

However, if I comment out \TikzDecorations[2], I obtain the correct spacing.

The desired output is has the vertical space before the first title line:

## Update:

• A simpler test case is now provided which does not use \parshape.

## Notes:

• The code below seems a bit long, but the relevant macro is \TypesetTitle and the fact that \TikzDecorations is invoked.

• In the MWE one solution is to move the \TikzDecorations to be after the text, but in my actual use case I would prefer to have it first so I don't have to deal with the opacity/foreground/background issues.

## Code: Simpler Test Case

\documentclass{article}
\usepackage{showframe}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{layout}

\usepackage[textwidth=5.0cm]{geometry}

\newcommand*{\Text}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.%
}%

\newcommand*{\MyAboveSkip}{5pt}
\newcommand*{\MyBotSkip}{5pt}
\newcommand*{\TypesetTitle}[1]{%
\hbox{}\kern-\topskip
\vspace*{\MyAboveSkip}
{\bfseries\centering#1\par}%
\vspace*{\MyBotSkip}%
}%

\NewDocumentCommand{\TikzDecorations}{%
O{2}% #1 = Number of lines for title
}{%
\noindent
\begin{tikzpicture}[remember picture,overlay]
\coordinate (X) at ([
xshift=1.0in+\hoffset+\oddsidemargin,
]current page.north west);

\draw [red] ([yshift=-2\baselineskip-\MyAboveSkip-\MyBotSkip]X) -- ++ (\linewidth,0);
\end{tikzpicture}%
}

\begin{document}%\layout
\TikzDecorations[2]
\sloppy\parskip0pt\relax
\TypesetTitle{A Long Title That Requires Two Lines}%
\noindent\Text
\end{document}

## Code: Full Test Case

\documentclass{article}
\usepackage{showframe}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{layout}

\newcommand*{\Text}{%
\sloppy\noindent
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem.
Nulla et lectus vestibulum urna fringilla ultrices.%
}%

\newcommand*{\TitleParShape}{%
0.40\hsize 0.20\hsize
0.35\hsize 0.30\hsize
}%
\newcommand*{\BodyParShape}{%
0.30\hsize 0.40\hsize
0.25\hsize 0.50\hsize
0.20\hsize 0.60\hsize
0.15\hsize 0.70\hsize
0.10\hsize 0.80\hsize
0.05\hsize 0.90\hsize
0.00\hsize 1.00\hsize
}%

\newcommand*{\NumberOfLines}{7 }
\newcommand*{\MyParShape}{%
\parshape \NumberOfLines
\BodyParShape
}%

\newcommand*{\MyAboveSkip}{5pt}
\newcommand*{\MyBotSkip}{5pt}
\newcommand*{\TypesetTitle}[1]{%
\hbox{}\kern-\topskip
\vspace*{\MyAboveSkip}
\parshape 2
\TitleParShape
{\bfseries\centering#1\par}%
\vspace*{\MyBotSkip}%
}%

\NewDocumentCommand{\TikzDecorations}{%
O{2}% #1 = Number of lines for title
}{%
\noindent
\begin{tikzpicture}[remember picture,overlay]
\coordinate (X) at ([
xshift=1.0in+\hoffset+\oddsidemargin,
]current page.north west);

\draw [red] ([yshift=-2\baselineskip-\MyAboveSkip-\MyBotSkip]X) -- ++ (\linewidth,0);
\end{tikzpicture}%
}

\begin{document}%\layout
\TikzDecorations[2]
\sloppy\parskip0pt\relax
\TypesetTitle{Two Line Title}%
\MyParShape
\Text
\end{document}

• I am not sure what you are aiming to, but you may consider the tcolorboxpackage which is very powerful and versatile. – DRi Nov 20 '18 at 8:11
• @DRi: I haven't found a way to use tcolorbox with a custom \parshape. I need the frame border to be along the parshape, not rectangular. – Peter Grill Nov 20 '18 at 8:13
• Just not add the tikzpicture at the beginning? Put it after \typesettitle or even cleaner may be inside. – Manuel Nov 22 '18 at 9:01
• @Manuel: I'd prefer to have the \TikzDecorations before any text is placed (see point 2 in the Notes section). – Peter Grill Nov 22 '18 at 16:31

## The problem

The problem is, like in the questions you link to, that using TikZ switches TeX from vertical to horizontal mode. So if your document starts with a TikZ picture, this picture will be part of the first paragraph of your document, which in your case is the title.

When you use \vspace in horizontal mode, this space will be inserted after the current line. Here is a little demonstration:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\fbox{\begin{minipage}[t]{2cm} %% no vspace
ab cd ef gh ij kl mn op qr st uv wx yz
\end{minipage}}
%
\fbox{\begin{minipage}[t]{2cm} %% vspace in vertical mode
\vspace{1ex}ab cd ef gh ij kl mn op qr st uv wx yz
\end{minipage}}
%
\fbox{\begin{minipage}[t]{2cm} %% vspace mid paragraph
ab \vspace{1ex} cd ef gh ij kl mn op qr st uv wx yz
\end{minipage}}
%
\fbox{\begin{minipage}[t]{2cm} %% vspace at the start of a paragraph, in horizontal mode
\leavevmode\vspace{1ex}ab cd ef gh ij kl mn op qr st uv wx yz
\end{minipage}}
%
\fbox{\begin{minipage}[t]{2cm} %% vspace after a tikz environment
\begin{tikzpicture}\end{tikzpicture}\vspace{1ex}ab cd ef gh ij kl mn op qr st uv wx yz
\end{minipage}}

\end{document}

(Note that the Tikz picture will reside in a paragraph of its own if it is separated from other content by paragraph breaks, in which case it will probably introduce more vertical space than expected or desired.)

## A solution

I think the safer way to include an overlay TikZ environment on a given page is to not have it be part of the running text at all and to draw it when the page is being shipped. That way it is guaranteed not to mess up any spacing.

This can be done by using the atbegshi package. The following code is mostly identical to yours: I've added five lines and removed one empty line. The changes are indicated by comments.

\documentclass{article}
\usepackage{showframe}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{layout}

\usepackage{atbegshi} %% <-- I added this line

\usepackage[textwidth=5.0cm]{geometry}

\newcommand*{\Text}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.%
}%

\newcommand*{\MyAboveSkip}{5pt}
\newcommand*{\MyBotSkip}{5pt}
\newcommand*{\TypesetTitle}[1]{%
\hbox{}\kern-\topskip
\vspace*{\MyAboveSkip}
{\bfseries\centering#1\par}%
\vspace*{\MyBotSkip}%
}%

\NewDocumentCommand{\TikzDecorations}{%
O{2}% #1 = Number of lines for title
}{%
\AtBeginShipoutNext{% %% <-- I added this line
\AtBeginShipoutUpperLeftForeground{% %% <-- I added this line
\begin{tikzpicture}[remember picture,overlay]
\coordinate (X) at ([
xshift=1.0in+\hoffset+\oddsidemargin,
]current page.north west);
% %% <-- Deleted blank line here
\draw [red] ([yshift=-2\baselineskip-\MyAboveSkip-\MyBotSkip]X) -- ++ (\linewidth,0);
\end{tikzpicture}%
}% %% <-- I added this line
}% %% <-- I added this line
}

\begin{document}%\layout
\TikzDecorations[2]
\sloppy\parskip0pt\relax
\TypesetTitle{A Long Title That Requires Two Lines}%
\noindent\Text

\end{document}

## Some remarks

• I had to delete an empty line in your TikZ environment because \AtBeginShipoutNext and \AtBeginShipoutUpperLeftForeground are not defined \long and their arguments are therefore not allowed to contain paragraph breaks. (See e.g. this answer.)

• The TikZ environment inside \AtBeginShipoutUpperLeftForeground{…} is placed in the top left corner of the page, so it actually has coordinates (0,0). You can therefore replace current page.north west by 0,0 and leave out the remember picture option. The following thus works just as well:

\NewDocumentCommand{\TikzDecorations}{%
O{2}% #1 = Number of lines for title
}{%
\AtBeginShipoutNext{%
\AtBeginShipoutUpperLeftForeground{%
\begin{tikzpicture}[overlay] %% <-- removed remember picture
\coordinate (X) at ([
xshift=1.0in+\hoffset+\oddsidemargin,
]0,0); %% <-- 0,0 instead of current page.north west
\draw [red] ([yshift=-2\baselineskip-\MyAboveSkip-\MyBotSkip]X) -- ++ (\linewidth,0);
\end{tikzpicture}%
}%
}%
}

(In fact, you won't even need to run LaTeX twice for this line to show up at the right spot. Note that the opposite corner of the page has coordinates (\paperwidth,-\paperheight), with a minus sign.)

• If you replace AtBeginShipoutUpperLeftForeground by AtBeginShipoutUpperLeft, then the tikz picture will be drawn behind your text rather than on top of it.

• Works well on the MWE. I made a note of the blank line in my MWE that needed to be deleted in the tikzpicutre for this to compile. – Peter Grill Nov 22 '18 at 17:18
• Thanks for the replace AtBeginShipoutUpperLeftForeground comment: Using AtBeginShipoutUpperLeft is the right thing for me as I want the drawings on the background. – Peter Grill Nov 22 '18 at 17:58
• +1: Very nice answer. Looks like a chapter in a tikz book :) – Dr. Manuel Kuehner Nov 24 '18 at 7:27

You see exactly the same phenomenon if you just insert an empty box instead of \TikzDecorations[2]. I would contest that the problem is the first \vspace* in your \TypesetTitle macro. Indeed

\documentclass[twoside]{article}

\begin{document}
\showoutput
\mbox{}
\clearpage
\vspace*{0pt}
\noindent
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\clearpage
\mbox{}
\vspace*{0pt}
\noindent
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\end{document}

produces text starting at two different locations

The simplest solution in your case is to move the \TikzDecorations command to after the title setting command

\documentclass{article}
\usepackage{showframe}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{layout}

\newcommand*{\Text}{%
\sloppy\noindent
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem.
Nulla et lectus vestibulum urna fringilla ultrices.%
}%

\newcommand*{\TitleParShape}{%
0.40\hsize 0.20\hsize
0.35\hsize 0.30\hsize
}%
\newcommand*{\BodyParShape}{%
0.30\hsize 0.40\hsize
0.25\hsize 0.50\hsize
0.20\hsize 0.60\hsize
0.15\hsize 0.70\hsize
0.10\hsize 0.80\hsize
0.05\hsize 0.90\hsize
0.00\hsize 1.00\hsize
}%

\newcommand*{\NumberOfLines}{7 }
\newcommand*{\MyParShape}{%
\parshape \NumberOfLines
\BodyParShape
}%

\newcommand*{\MyAboveSkip}{5pt}
\newcommand*{\MyBotSkip}{5pt}
\newcommand*{\TypesetTitle}[1]{%
\hbox{}\kern-\topskip
\vspace*{\MyAboveSkip}
\parshape 2
\TitleParShape
{\bfseries\centering#1\par}%
\vspace*{\MyBotSkip}%
}%

\NewDocumentCommand{\TikzDecorations}{%
O{2}% #1 = Number of lines for title
}{%
%    \noindent
\begin{tikzpicture}[remember picture,overlay]
\coordinate (X) at ([
xshift=1.0in+\hoffset+\oddsidemargin,
]current page.north west);

\draw [red] ([yshift=-2\baselineskip-\MyAboveSkip-\MyBotSkip]X) -- ++ (\linewidth,0);
\end{tikzpicture}%
}

\begin{document}%\layout
\sloppy\parskip0pt\relax
\TypesetTitle{Two Line Title}%
\TikzDecorations[2]
\MyParShape
\Text
\end{document}

• Moving the \TikzDecorations[2] to after the text is placed introduces other complications as per second point in the Notes section. I really would prefer it to be done before any text is placed. – Peter Grill Nov 22 '18 at 16:29


text:
## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Condense Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

since my name has been taken in vain ...

from robin:
an \include-like system that allows you to
include stuff at arbitrary positions on the page, which is what
TUGboat actually needs.

from david:
Why do you need an \include? or in particular why do you need an
\includeonly ? Tugboat isn't so long is it?

from my point of view, this isn't the biggest problem.  david hit on
that later:

1) making a master class' that can pull a series of separate articles
each from a separate file. Each of these article files' should be a
self contained document that may be processed independantly
(although of necessity with a different class and perhaps a
slightly different look to the output when processed independantly).

[...]

You can more or less get (1) by just having the master class redefine
\documentclass to do nothing, re-enable \usepackage for use by the
articles, and just set up whatever typographic details are needed to
handle the front matter' of the individual articles when considered
as sections in the larger work.

There are problems when you start to consider packages used by the
different articles clashing, and issues relating to avoiding namespace
clashes with \label etc, but they are not insurmountable (probably:-).

that little matter of incompatible packages is a real beast.
for latex 2.09, ron whitney cobbled together a workable technique,
but it's much less obvious (at least to me) how this can be done
for latex2e.  if the only problems were the ability to disable
\documentclass, \begin and \end{document}, reinstate the front matter
macros, reinitialize counters, suppress the \clearpage, and that sort
of housekeeping, i would have been able to bludgeon something together.
but latex2e, although much easier to use in many other ways, is not
at all forgiving when trying to supersede package a by package b.

tugboat processing usually progresses by (re-)processing single
articles until all the errors are gone and necessary changes have
been made, then juggling multiple articles into a logical order
with reasonable paging.  (of course, all the floats change at this
point, so there can still be substantial reiteration.)

and there are still articles submitted in plain tex, which tugboat
is not going to refuse if the material is relevant and well written.
in fact, as some such articles propose non-latex solutions, it may
be impossible to process them at all using latex.  whenever possible,
we try to group articles not only by subject, but also by processing
method required.  in pre-latex days, it was often possible to run
the camera-ready copy of an issue as a unit.  no more.
-- bb
`


text:
I recently downloaded a topic to test a client project. I always do that before buying a theme.

2 problems appeared:

The first was that I had to delete all the mentions of the site from where I downloaded the subject.

within the theme styles.css case file. This was easy because all the mentions were in the upper part of the file (they only replaced all the links with false ones).

The second problem was that these imbeciles had injected a redirection code that when activated (at random intervals) opened a new window of a site called

Code:

`freedownloadmusic.com`

, or something like that. The solution was to open the themes folder, then the include folder and delete everything inside the functions-init.php file.

Although this was only a trial installation for me, I would like to warn all people who are here not to download and / or install themes or wp plugins from that site, to avoid these types of problems. More importantly, just do not share them here, because you do not have to fuck someone else's site.

Oh, and if you feel like it, visit your Facebook page and show your appreciation for the spread of malicious codes through their actions.

## [GET][NULLED] – Thrive Themes Leads Plugin v2.1.2

[GET][NULLED] – Thrive Themes Leads Plugin v2.1.2

## Discounted themes from Yetishare, Xfilesharing and Xvideosharing Template

Hello Wjunction Users

First, happy new year 2019!

To begin this year, we have added a 40% discount for all our products until January 3.

Please use this coupon to apply the discount. newyear2019

* The terms and conditions apply.

Thank you

Code:
`mediafire.com/download/ml8h8fyt8p8fc7m/WPMU_DEV.zip`

## kubuntu – Change the GTK 3 and 2 themes from the terminal

In KDE (specifically Kubuntu), is there any way to change the GTK theme and update it later to be applied, for example, with `kde-gtk-config` But through the command line / terminal / console?

I know the files that I need to change are the most likely `~ / .gtkrc-2.0` for GTK2 and `~ / .config / gtk-3.0 / settings.ini` for GTK3, and I also have to (can I?) use `settings` for GTK3 with `org.gnome.desktop.interface gtk-theme`, but I have not been able to update the applications using these themes, as for example with the mentioned `kde-gtk-config` that is present in the configuration of the GUI system, not even with `kwriteconfig` In gtk-3.0 I like what I use to change the Plasma theme and update it automatically.

So, what is it that I'm missing? How do I update the topics after writing in these files? And if it is not possible, how do I achieve a similar effect?

## [GET][NULLED] – Thrive Themes Quiz Builder Plugin v2.1.0

[GET][NULLED] – Thrive Themes Quiz Builder Plugin v2.1.0

## development of themes: custom field in the user profile that does not save data

I was trying to add a custom field to the word "Your profile" from wordpress. I did that, but when I enter any data and pulse update, the profile is updated. But the personalized entry remains empty even adding data before. I do not know why this happens. My code is.

``````add_author_role_field (\$ user) function {
\$ role = get_the_author_meta (& # 39; author_role & # 39 ;, \$ user-> ID);
?>

<input type = "text" name = "author_role" value = "">
<? php
}

add_action (& # 39; show_user_profile & # 39 ;, & # 39; add_author_role_field & # 39;);
add_action (& # 39; edit_user_profile & # 39 ;, & # 39; add_author_role_field & # 39;);
add_action (& # 39; personal_options_update & # 39 ;, & # 39; crf_update_profile_fields & # 39;);
add_action (& # 39; edit_user_profile_update & # 39 ;, & # 39; crf_update_profile_fields & # 39;);

function crf_update_profile_fields (\$ user_id) {
if (! current_user_can (& # 39; edit_user & # 39 ;, \$ user_id)) {
false return;
}

yes (! empty (\$ _POST['year_of_birth'] )) {
update_user_meta (\$ user_id, & # 39; author_role & # 39 ;, sanitize_text_field (\$ _ POST['author_role']));
}
}
``````

So I'm trying to show it on the interface using this code.

``````echo get_the_author_meta (& # 39; author_role & # 39;);
``````

I can not understand the problem. Thanks in advance

## The Windows themes are all fucked

the text inside the windows is not readable
I just updated to 18.04.1 and discovered that I can not read the text within the pull-down menus, sub-menus and buttons. For example, I can not read my entry when I type my username and password on the websites, or the OK and CANCEL buttons on. I have tried the Unity and GNOME settings to change the themes and settings, but I can not make it work. I also discovered that in the window of BACKGROUND in the configuration I only have two images, one for the background and one for the blocking screen without any option for something else, such as the color of the text, etc. Any idea what I could do here? Note that I am not a Linux guru … more than one point and click on the Windoze transplant.

## gm. General Mathematics – List of modern points of view that simplify or clarify classical themes.

There are many modern mathematical achievements that greatly clarify or (and) simplify important classical themes. I believe that a list of such achievements, among other benefits, would be a great help for a beginner when entering certain subfields of mathematics.

For example, when I tried to understand Peter-Weyl's theory for the representations of compact topological groups, I would prefer someone to tell me that I should learn the representation theory of compact quantum groups of the $$C ^ ast$$-the algebraic point of view, since it not only clarifies the theory, it also makes more apparent the links with the Hopf algebras, the monoidal structures and the reconstruction theorems of tanacian type.

As a somewhat less specialized, perhaps more debatable example, one could argue that one should study modern category theory rather than the theory of structures as presented in the first volume of Bourbaki. elements (although nowadays a mathematician has many more possibilities of running into the theory of categories instead of the theory of structure when he needs to formulate universal constructions).

I ask here for a list of mathematical achievements that shape the modern point of view of certain classical subjects in mathematics, like the previous examples (first in theory of the representation of compact groups, second in formulating universal constructions), in the sense that it simplifies or (and) clarifies our previous point of view on the subject, preferably making modern research literature more accessible by establishing new standard notions, terminologies, techniques, ways of thinking, etc.

I know this would be too broad a question, but I just could not think of a better place to ask this here than here. If possible, I would like each response to focus on one topic instead of listing several topics.


text:
Taliban Target Pro-Western 14-year-old girl

Discussion in 'World Events' started by Bowser, Oct 11, 2012.

1. BowserNamasteValued Senior Member

Messages:
8,828
Interesting enough, the accuser is now accused of the very same crime. There is some satisfaction to be had from this story.

3. CptBorkValued Senior Member

Messages:
6,411
Maybe they should toss him in a US prison and see how long his intestines stay in his stomach. To be serious, I hope he gets life in a safe prison somewhere in Pakistan so civilized human beings can use him as an example of mercy being shown to someone who would do far worse if the tables were turned. Still skirts over the core issue which is that Pakistan has such anti-blasphemy laws in the first place- the people responsible for making those laws should do the world a favour and go hang themselves.

5. The MarquisOnly want the best for NigelValued Senior Member

Messages:
2,562
You noticed nothing. I've often mentioned the difference between modern war and total war. Maybe not in this thread, but let's not try to avoid your own disingeniousness (is that a word?).

Actually, I do. I represent a viewpoint which is totally at odds with your own; this is not "nothing". It's a viewpoint. I wondered why the Muslims in Australia can get so hyped about a speeding fine, yet are nowhere to be seen when a girl wanting a education gets shot in the head. You, of course, interpret this is having no viewpoint. I understand why you do. I also understand you have no idea at all why I dislike you so intensely. In fact, there are many things I imagine you don't understand.

I will mention again, however, that a "troll" is one who says something with no motive other than to garner an emotional reaction. I would suggest that in order to defend your reputation as a literate man, you at least use a word in the sense in which it was intended.
It would be clear to anyone, with an understanding of the word and its genesis, that I am not a troll.

Yeah. Well. Not quite what I advocate, but then I am well aware of your political aspirations. Or at least, I do hope you have some. I cannot imagine what else you would use this particular talent you have for spin, otherwise. I mean, seriously, Tiassa... you would make a most excellent politician.

Pretty much all of them. No, not really. Actually, yes, all of them.

Once again, Tiassa, you can't see the wood for the trees. I do have a tendency to write under the assumption that others already understand some basic precepts. In your case, I assume too much; you show such promise... and yet repeatedly fail under examination. I wouldn't worry about it too much, though. It does take exceptional type of person to see through you; and that type of person is in limited supply here. Take it as a compliment. You appeal to a majority opinion. It isn't a bad place to find yourself in.

Ohh, have they? Really? I eagerly await the results.

Isn't it strange how the "facts" tend to vary with a particular viewpoint.
Alright, Tiassa. Let's play. Hit me with some "facts".

No. I'd expect you to be exactly what you are, rather than adopting the customs of others in order to ingratiate yourself with them.
Anything else is dishonest and false.

It doesn't, actually. But then I don't walk down the street looking for a guy a beating on his wife in order to intervene and be seen as a hero, either. Sometimes you just see something and feel enough about it to interfere.
You, of course, would just walk past and say nothing; because we should just tolerate everything, shouldn't we. After all, it's their "culture" and it has nothing to do with us.

She died.

Your take on that would have been something along the lines of "oh, that's really terrible. We should discuss this, and then perhaps in the future someone will come up with a plan, if we can all be reasonable about it. Now I hope no one will take me as being overly confrontational about this; instead, see me as something of a facilitator."

Messages:
6,411

10. Captain KremmenAll aboard, me Hearties!Valued Senior Member

Messages:
12,738
The conspiracy theory.
America attacked Malala to make ordinary Pakistanis turn against the Taliban.

11. Billy TUse Sugar Cane Alcohol car FuelValued Senior Member

Messages:
23,198
too much risk to believe. She could have died and just been one of dozens of others killed by drones - making some more blame for the US, not the Taliban.


text:
# 1 Square Meter In Feet

1 Square Meter In Feet. Therefore, 1 foot is equal to 1/3. 2808399 meter. So, 1 square foot is equal to 1/3. 2808399^2 or 0. 09290304 meters. Therefore, you can convert any number from square feet to square meters either by dividing it by 3. 2808399^2 or multiplying it by 0. 09290304. Now, enter the following formula in cell d5 to get the same result as in the earlier method.

M 2), is an si. To calculate the square footage of the same area, multiply the result by 10. 7639104. You may also use the conversion calculator above to calculate the area in both square meters and square feet by entering the length and the width in meters. How to convert square feet to square meters? 1 square foot (sqft) is equal to 0. 09290304 square meter (sqm). In mathematical terms, 1 square meter = 10. 7639 square feet. Square meter to square feet formula. To conversion value between square meter to square feet, just multiply the value by the conversion ratio. One square meter is equal to 10. 7639.


text:
# Matrix Permutations

Hello,

how do I get all permutations of a Matrix?

For the following exercise I would like to get all permutations of a Matrix with integer values in the range $0$ to $9$. There should be $10^4$ permutations. And then generate the permutations of tuples with three matrices. $10^{12}$ permutations and then I would filter the list somehow for the invertible matrices.

Is there a better way?

Exercise: Let $S, T, U \in \mathbb{R}^{2x2}$ such that, $S_{i, j}, T_{i, j}, U_{i, j} \in {0,1, \cdots, 9}$ How many of the products $S \cdot T \cdot U$ are invertible?

In the Sage reference for permutation I couldn't find any thing.

Thanks

PS: The curly braces couldn't be escaped properly in the LaTex part ... \{0,1, \cdots, 9\}

edit retag close merge delete

Sort by » oldest newest most voted

For the exercise, to loop among the list of all 2x2 matrices with entries in [0..9] the suitable mathematical construction is the cartesian product of four copies of [0..9]. This may be achieved like this:

sage: R = [0..9]
sage: C = cartesian_product( (R,R,R,R) )
sage: len(C)
10000
sage: C.random_element()
(6, 5, 4, 7)

One can build the matrix with the las entries (last value is _ in the sage interpreter) like this:

sage: _
(6, 5, 4, 7)
sage: matrix( ZZ, 2, 2, list(_) )

[6 5]
[4 7]

So the number of invertible matrices $S$ of the given shape is:

sage: R = [0..9]
sage: C = cartesian_product( (R,R,R,R) )
sage: len( [ c for c in C if matrix( ZZ, 2, 2, list(c) ).det() ] )
9430

The product $STU$ is invertible iff each matrix in it is invertible. So the exercise is solved in one more line. It is a good idea to use structure in mathematics, when it is possible. Brute force can then confirm the result.

Note: Permutations are not involved in the exercise. Inn order to get info on this or an other mathematical object, just try the first letters of it in the sage interpreter, which has autocompletion. We can try here perm[TAB] and/or Perm[TAB]. In the second case we get a list of classes / constructors, among them we can put a question mark before or after...

sage: Permutation?

to get more information on this. The sage interpreter is a good tool to learn sage.

more

I tried it as follow based on your code, but it doesn't work. I use CoCalc. It shows the green bar for computation, but it doesn't stop and doesn't return any results.

R = [0,1,2,3,4,5,6,7,8,9]

C = cartesian_product((R,R,R,R)).list()

invertibleMatrices = [matrix(ZZ, 2,2,list(c)) for c in C if matrix(ZZ, 2,2,list(c)).det()]

invertibleMatrices3Tuples = cartesian_product((invertibleMatrices, invertibleMatrices, invertibleMatrices)).list()

invertibleSTUProducts = [c for c in invertibleMatrices3Tuples if c[0]*c[1]*c[2].det()]
len(invertibleSTUProducts)

BTW: What do you mean by "It is a good idea to use structure in mathematics"?

( 2017-12-16 12:19:34 -0500 )edit

As it is written: "The product STU is invertible if and only if each of the matrices S, T and U is invertible." So there is no need to compute all the products (that would be too long to terminate anyway).

( 2017-12-16 14:07:40 -0500 )edit

I don't think that I do so.

I perform the following steps:

1. I put all invertible Matrices in the variable invertibleMatrices.
2. I try to build all tuple-combinations with 3 matrices and put it in the variable invertibleMatrices3Tuples.
3. I build the products of matrices in each tuple and see if the product is invertible and put them all in the variable invertibleSTUProducts.

Did I miss something?

( 2017-12-16 14:55:27 -0500 )edit

yes you did

( 2017-12-16 15:00:53 -0500 )edit

I think, now I get your point:

The 1st step remains and the I'll do this:

CountOfInvertibleMatrices3Tuples = len(invertibleMatrices)^3
CountOfInvertibleMatrices3Tuples
838561807000

Is it now ok?

Thanks

( 2017-12-16 15:19:56 -0500 )edit

It is possible to make an even less computational solution than in @dan_fulea answer. As already mentioned, we simply want to count the solutions of a d - b c != 0 where a, b, c, d are elements of {0, 1, ..., 9}. This is easily obtained from the number of solutions of ad - bc = 0 which itself can be obtained by solving x y = s for all possible values of s. For example

• xy = 0 has 19 solutions (from which we get 19 * 19 = 361 matrices)
• xy = 1 has 1 solution (from which we get 1 matrix)
• xy = 6 has 4 solutions (from which we get 6 * 6 = 36 matrices)
• etc

In Sage

sage: P = set(i * j for i in range(10) for j in range(10))
sage: sum(sum(x * y == s for x in range(10) for y in range(10))**2 for s in P)
570
sage: 10**4 - 570
9430

Here 570 is the number of non-invertible matrices with entries in {0, 1, ..., 9}. Now, we can even be more clever. The number of solutions for xy = s is, excepted for s = 0, the number of divisors d of s that belongs to {1, ..., 9} and so that s/d also beongs to {1, ..., 9}. We recover 570 with

sage: Q = set(i * j for i in range(1, 10) for j in range(1, 10))
sage: 19^2 + sum(sum(s%d == 0 and s < 10*d for d in range(1,10))**2 for s in Q)
570

more

Thanks for the post! I must confess, this was the first solution i wanted to type, then saw that there is a little combinatorial point to explain when we place the a,b,c,d elements with ad == bc on the two diagonals in case a == d and/or b == c. Since the cartesian product was already an issue, i decided to avoid combinatorics. This means then to compute for each possible product the number of the ways to produce it. Of course, we do not have $10^4$ cases, since for each possible product we can count the pairs. At most $10^2$ cases. But then i was generous to get all $10^4$. The argument is not better, but it better illustrates the cartesian product as a construction. I was really glad to see it in action for $S,T,U$ again. (Although the bits needed are too many.)

( 2017-12-17 11:33:29 -0500 )edit

It is a good homework to try to implement this idea for counting $3\times 3$ invertible matrices with entries among $0,1,2,3,4,5,6,7,8,9$. The $10^9$-steps loop would not be my solution. (Of course, there is no structural meaning for the number obtained after much work, just an exercise. The experience will eventually pay later many times the dividends...)

( 2017-12-17 11:37:42 -0500 )edit

Thanks for your help. @vdelecroix I'll try to comprehend your solution ...

( 2017-12-19 06:51:53 -0500 )edit


text:
Probability of getting a hand with at least 6 doubles in domino

Mathematics Asked by Rolando González on December 21, 2020

I have this problem:

Domino has 28 tiles with 7 doubles. Each hand has 7 tiles. What is the probability of getting a hand with at least 6 doubles?

Since it’s an "at least" kind of problem I did the following:

Total number of hands: $$28C7$$

$$P(hand with at least 6 doubles) = 1 – P(no double ) – P(one double )- P(two doubles )-dots – P(six doubles ) = 1- bigg( frac{(7C0 times 21C7)+ (7C1 times 21C6) + (7C2 times 21C5) + (7C3 times 21C4) + (7C4 times 21C3) + (7C5 times 21C1) + (7C6 times 21C1) }{28C7} bigg)$$

This gives me a probability of $$0.8035$$ but I’m doubtful if my approach was correct. Is it right or is there another way of solving this?

Thanks.

Related Questions

find the range of $x$ on which $f$ is decreasing, where $f(x)=int_0^{x^2-x}e^{t^2-1}dt$

2  Asked on December 4, 2020 by steven-lu

Differentiability for an integral function

1  Asked on December 4, 2020 by andereben

Solving a system of separable ODE’s

1  Asked on December 4, 2020 by costard

$Vert x_{n} – y_{n} Vert$is a cauchy sequence in $mathbb{F}$

1  Asked on December 4, 2020 by gaufler

equation of the form P (θ) = 0, where P is a polynomial, satisfied by the maximum likelihood estimator

0  Asked on December 4, 2020 by nisha

Evaluate $int_0^{infty } Bigl( 2qe^{-x}-frac{sinh (q x)}{sinh left(frac{x}{2}right)} Bigr) frac{dx}x$

2  Asked on December 3, 2020 by iridescent

How can one derive a partial differential equation from a function

1  Asked on December 3, 2020 by bob-pen

Dice Probability Dungeons and Dragons

3  Asked on December 3, 2020 by bangini

How can you derive an algorithm for dividing natural numbers?

0  Asked on December 3, 2020 by honza-prochazka

Expansion of the Frobenius norm

1  Asked on December 3, 2020 by wuannnn

On the definition of an algebra

1  Asked on December 3, 2020 by hakuna-matata

Distribution of a random variable given on the set of all natural number if …

0  Asked on December 3, 2020 by dabdya

Doubtful solution to an exercise on faithful flatness in Matsumura’s Commutative Algebra

1  Asked on December 3, 2020 by an-hoa

If $f(x)=frac{1-x}{1+x}$, then how do I explain graphically why $f(f(x))=x$?

4  Asked on December 3, 2020 by stupidgal123

*A: Prisoner A is selected for release. *B: The guard informs Prisoner A that Prisoner B is going to be released. Are A and B independent?

1  Asked on December 3, 2020 by t536373

Simplify the following sum $sum_{i=1}^nfrac1{n-(i-1)}$

1  Asked on December 3, 2020 by wild

What is a polynomial approximation?

3  Asked on December 2, 2020 by brilliant

Finding the smallest $k$ so that specific items are spaced exactly three apart

2  Asked on December 2, 2020 by troniix

Homotopic function question – very basic

2  Asked on December 2, 2020 by peter4075