text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 17 Dec 2018, 05:26

R1 Decisions:

Michigan Ross Chat (US calls are expected today)  |  UCLA Anderson Chat  (Calls expected to start at 7am PST; Applicants from Asia will hear first)

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 December
PrevNext
SuMoTuWeThFrSa
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
Open Detailed Calendar
• 10 Keys to nail DS and CR questions

December 17, 2018

December 17, 2018

06:00 PM PST

07:00 PM PST

Join our live webinar and learn how to approach Data Sufficiency and Critical Reasoning problems, how to identify the best way to solve each question and what most people do wrong.
• R1 Admission Decisions: Estimated Decision Timelines and Chat Links for Major BSchools

December 17, 2018

December 17, 2018

10:00 PM PST

11:00 PM PST

From Dec 5th onward, American programs will start releasing R1 decisions. Chat Rooms: We have also assigned chat rooms for every school so that applicants can stay in touch and exchange information/update during decision period.

In a numerical table with 10 rows and 10 columns, each entry is either

Author Message
TAGS:

Hide Tags

Board of Directors
Joined: 01 Sep 2010
Posts: 3291
In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

25 Jul 2017, 10:27
6
Top Contributor
49
00:00

Difficulty:

55% (hard)

Question Stats:

71% (02:12) correct 29% (02:01) wrong based on 955 sessions

HideShow timer Statistics

In a numerical table with 10 rows and 10 columns, each entry is either a 9 or a 10. If the number of 9s in the nth row is n – 1 for each n from 1 to 10, what is the average (arithmetic mean) of all the numbers in the table?

A. 9.45

B. 9.50

C. 9.55

D. 9.65

E. 9.70

_________________
Math Expert
Joined: 02 Sep 2009
Posts: 51261
In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

25 Jul 2017, 22:10
15
10
carcass wrote:
In a numerical table with 10 rows and 10 columns, each entry is either a 9 or a 10. If the number of 9s in the nth row is n – 1 for each n from 1 to 10, what is the average (arithmetic mean) of all the numbers in the table?

A. 9.45

B. 9.50

C. 9.55

D. 9.65

E. 9.70

We have 10*10 = 100 entries.

"The number of 9s in the nth row is n – 1 for each n from 1 to 10" means that:
In the 10th row the number of 9s is 10 - 1 = 9;
In the 9th row the number of 9s is 9 - 1 = 8;
In the 8th row the number of 9s is 8 - 1 = 7;
...
In the 1st row the number of 9s is 1 - 1 = 0.

Thus, the total number of 9s is 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 9*(9 + 1)/2 = 45.

The number of 10s is therefore 100 - 45 = 55.

The average of all numbers = (45*9 + 55*10)/100 = 9.55.

P.S. Below is an image for better understanding:

Attachment:

Untitled.png [ 8.57 KiB | Viewed 11971 times ]

_________________
Current Student
Joined: 12 Aug 2015
Posts: 2627
Schools: Boston U '20 (M)
GRE 1: Q169 V154
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

05 Aug 2017, 22:13
4
2
Painful question.

I feel this question is just pure lengthy and nothing else.

Here is what I did -->

Sum => 1000-(1+2+3+4+5+6+7+9) => 1000-(45) => 955

Total spaces => 100

Mean => 955/100 => 9.55

_________________

MBA Financing:- INDIAN PUBLIC BANKS vs PRODIGY FINANCE!

Getting into HOLLYWOOD with an MBA!

The MOST AFFORDABLE MBA programs!

STONECOLD's BRUTAL Mock Tests for GMAT-Quant(700+)

AVERAGE GRE Scores At The Top Business Schools!

General Discussion
Intern
Joined: 02 Oct 2014
Posts: 12
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

01 Aug 2017, 18:39
1
Key formula to note: Avg of an evenly spaced set = $$\frac{(First + Last)}{2}$$

Yellow part sum: 9 ( 1 + 2 + 3 ..... 9) = 9 * (Avg * 9) = 9 * [(9+1)/2]*9 = 45 * 9 = 405
This also hints there are 9 9s

Green part sum: 10 ( 1 + 2 + 3 .... 10) = 10 * 5.5*10 = 550
There are 10 10s

Total elements = 10 * 10 = 100

Thus Avg =
(550+405)/100 = 9.55 (C)
Intern
Joined: 25 Jul 2017
Posts: 7
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

06 Aug 2017, 01:12
1
2
We can do it following way also to be quick -
Assume al lnumbers were 10, then the sum would have been 10*10(rows)*10(columns) = 1000
Now, this sum is diminshed by including some 9s in the rows in a specific pattern. So remove the extra counted 1 (10-9 = 1) from above sum.
There are 0+1+2+3+4+5+6+7+8+9 = 45 9s. Hence, subtract 45 from 1000.
This gives 955 which is the sum of all numbers on the grid.
Hence, average = 955/100 = 9.55
C
Target Test Prep Representative
Affiliations: Target Test Prep
Joined: 04 Mar 2011
Posts: 2830
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

09 Aug 2017, 12:34
1
1
carcass wrote:
In a numerical table with 10 rows and 10 columns, each entry is either a 9 or a 10. If the number of 9s in the nth row is n – 1 for each n from 1 to 10, what is the average (arithmetic mean) of all the numbers in the table?

A. 9.45

B. 9.50

C. 9.55

D. 9.65

E. 9.70

Since the table has 10 rows and 10 columns there are 100 spots in the table.

So we see there are:

For row 1: n = 1 and there are (n - 1) = (1 - 1) = 0. Thus, there are 0 nines in row 1

For row 2: n = 2 and there are (n - 1) = (2 - 1) = 1. Thus, there is 1 nine in row 2.

For row 3: n = 3 and there are (n - 1) = (3 - 1) = 2. Thus, there are 2 nines in row 3, and so on.

We can see that a pattern emerges.

So the number of nines is:

0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45

Because there are 100 numbers in the entire table, we have (100 - 45) = 55 tens.

Thus, the average of the 45 nines and 55 tens is:

[9(45) + 10(55)]/100 = (405 + 550)/100 = 9.55

_________________

Jeffery Miller

GMAT Quant Self-Study Course
500+ lessons 3000+ practice problems 800+ HD solutions

Manager
Joined: 22 May 2015
Posts: 104
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

21 Aug 2017, 07:17
1
1st row has 0 9's
2nd row has 1 9's
.....
10th row has 9 9's

No of 9's = 1+2.....+9 = 45.

=> No of 10's = 55

So total sum of numbers = (45*9)+(55*10) = 955

Mean = 955/100 = 9.55
_________________

Consistency is the Key

Manager
Joined: 26 Feb 2018
Posts: 58
WE: Sales (Internet and New Media)
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

16 Mar 2018, 10:31
stonecold , could you explain , in the sum section how did you take 1000 - rest
_________________

" Can't stop learning and failing"

Manager
Joined: 10 Apr 2018
Posts: 180
In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

15 Aug 2018, 20:58
1
Bunuel wrote:
carcass wrote:
In a numerical table with 10 rows and 10 columns, each entry is either a 9 or a 10. If the number of 9s in the nth row is n – 1 for each n from 1 to 10, what is the average (arithmetic mean) of all the numbers in the table?

A. 9.45

B. 9.50

C. 9.55

D. 9.65

E. 9.70

We have 10*10 = 100 entries.

"The number of 9s in the nth row is n – 1 for each n from 1 to 10" means that:
In the 10th row the number of 9s is 10 - 1 = 9;
In the 9th row the number of 9s is 9 - 1 = 8;
In the 8th row the number of 9s is 8 - 1 = 7;
...
In the 1st row the number of 9s is 1 - 1 = 0.

Thus, the total number of 9s is 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 9*(9 + 1)/2 = 45.

The number of 10s is therefore 100 - 45 = 55.

The average of all numbers = (45*9 + 55*10)/100 = 9.55.

P.S. Below is an image for better understanding:

Attachment:
Untitled.png

Hi loserunderachiever,

May be i can try to explain. View the figure above
Let's assume that each value in 10 rows and 10 columns is "10". Then then total sum of each columns would be 100 and there are 10 columns= 100*10= 100
Now since in every row there is one less 10 than previous and we have assumed the value of it 1 each more than actual ,we will subtract it from total.
In the ninth coloumn our assumed total is 100 but actually its 99 so we have taken 1 more than assumed value .
Now in column number 8 number our assumed total is 100 but actually it is 98 so its two more than assumed. Why because we assumed two "10's" in place of 9 so each contributes additional 1.
similarly up-to column number 1 where our assumed total is 100, but actually it has to be 91 . each of the 9 assumed 10's are contributing 1 each to total .

So 1000-(9+8+7+6+5+4+3+2+1+0)
is 1000-45
955
total number observations are 100

so avg = 955/100
9.55
Manager
Joined: 20 Jul 2018
Posts: 89
GPA: 2.87
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

02 Sep 2018, 18:30
Total entries of 9 and 10 are 100 in the table.
In first row number of 9’s are 0 as according to n-1
In second row number of 9’s are 1
In third, fourth, fifth,....,tenth rows are 2,3,4,5,6,7,8,9 respectively.
So total 9’s are 0+1+2+3+4+5+6+7+8+9=45
Total 10’s are =100-45=55
So total sum of entries is 45*9 + 55*10 = 955
Average is=Sum/total number of entries
Average=955/100=9.55

Posted from my mobile device
_________________

Hasnain Afzal

"When you wanna succeed as bad as you wanna breathe, then you will be successful." -Eric Thomas

Intern
Joined: 26 Apr 2015
Posts: 11
Re: In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

16 Oct 2018, 11:09
Bunuel wrote:
carcass wrote:
In a numerical table with 10 rows and 10 columns, each entry is either a 9 or a 10. If the number of 9s in the nth row is n – 1 for each n from 1 to 10, what is the average (arithmetic mean) of all the numbers in the table?

A. 9.45

B. 9.50

C. 9.55

D. 9.65

E. 9.70

Attachment:
Untitled.png

Lengthy question for sure; not sure I'd be able to stick with it during test-like conditions.
Anyways, if you note that in rows 2-10 there is an equal number of 9s and 10s, you can calculate it as a weighted average between those rows and the first row:

$$\frac{((9x10)(9.50) + (10)(10))}{(10x10)}$$ =8.55 + 1 = 9.55
Manager
Joined: 17 Mar 2018
Posts: 60
In a numerical table with 10 rows and 10 columns, each entry is either  [#permalink]

Show Tags

18 Nov 2018, 23:01
As per question, in 1 row the number of 9's are row number-1, and the remaining numbers in the row are 10s.
Hence, quickest way is to list number 9s by row number and 10s would be 10-9s (because only 10 numbers in each row)

Ans.= c
Attachments

Screen Shot 2018-11-19 at 11.03.07 AM.png [ 25.27 KiB | Viewed 1047 times ]

In a numerical table with 10 rows and 10 columns, each entry is either &nbs [#permalink] 18 Nov 2018, 23:01
Display posts from previous: Sort by


text:
# Induction on Natural Numbers

The following function sums the non-negative integers up to n:

let rec sumto n =
if n = 0 then 0
else n + sumto (n - 1)

You might recall that the same summation can be expressed in closed form as n * (n + 1) / 2. To prove that forall n >= 0, sumto n = n * (n + 1) / 2, we will need mathematical induction.

Recall that induction on the natural numbers (i.e., the non-negative integers) is formulated as follows:

forall properties P,
if P(0),
and if forall k, P(k) implies P(k + 1),
then forall n, P(n)

That is called the induction principle for natural numbers. The base case is to prove P(0), and the inductive case is to prove that P(k + 1) holds under the assumption of the inductive hypothesis P(k).

Let's use induction to prove the correctness of sumto.

Claim: sumto n = n * (n + 1) / 2

Proof: by induction on n.
P(n) = sumto n = n * (n + 1) / 2

Base case: n = 0
Show: sumto 0 = 0 * (n + 1) / 2

sumto 0
=   { evaluation }
0
=   { algebra }
0 * (n + 1) / 2

Inductive case: n = k + 1
Show: sumto (k + 1) = (k + 1) * ((k + 1) + 1) / 2
IH: sumto k = k * (k + 1) / 2

sumto (k + 1)
=   { evaluation }
k + 1 + sumto k
=   { IH }
k + 1 + k * (k + 1) / 2
=   { algebra }
(k + 1) * (k + 2) / 2

QED

Note that we have been careful in each of the cases to write out what we need to show, as well as to write down the inductive hypothesis. It is important to show all this work.

Suppose we now define

let sumto_closed n = n * (n + 1) / 2

Then a corollary to our previous claim, by extension we can conclude

sumto_closed = sumto

Technically that equality holds only inputs that are natural numbers. But since all our examples henceforth will be for naturals, not integers per se, we will elide stating any preconditions or restrictions regarding natural numbers.

format: plain


text:
# 机器学习-吴恩达：学习笔记及总结（4）

## Coursera | Machine Learning | Andrew Ng

Thistledown    March 10, 2020

Course Link ：Week 4 - Neural Networks: Representation

## 11 Motivations

#### 11.1 Non-linear Hypotheses

Neural Networks is a much better way to learn complex non-linear hypotheses even when your input feature space $(n)$ is large.

#### 11.2 Neurons and the Brain

• Origins: Algorithms that try to mimin the brain.
• Was very widely used in 80s and early 90s; popularity diminished in late 90s.
• Recent resurgence: State-of-the-art technique for many applications.

## 12 Neural Networks

#### 12.1 Model Representation I

• Neuron in the brain

• Neurons are basically computational units that take inpus (dendrites) as electrical inputs (called “spikes”) that are channeled to outputs (axons).
• Neuron model: Logistic unit

• In our model, our dendrites are like the input features $x_1 \cdots x_n$, and the output is the result of our hypothesis function.

• In this model our $x_0$ input node is sometimes called the “bias unit”, it is always equal to 1.

• In neural networks, we use the same logistic function as in classification, $\frac{1}{1+e^{-\theta^Tx}}$, yet we sometimes call it a sigmoid (logistic) activation function.

• In this situation, our “$\theta$” parametrs are sometimes called “weights”.

• Visually, a simplistic representation looks like:

• Neural Network

• Our input nodes (layer 1), also known as the “input layer”, go into another node (layer 2), which finally outputs the hypothesis function, known as the “output layer”.

• We can have intermediate layers of nodes between the input and output layers called the “hidden layers”.

• In this example, we label these intermediate or “hidden” layer nodes $a_0^2 \cdots a_n^2$ and call them “activation units”.

• If we had one hidden layer, it would look like:

• The values for each of the “activation” nodes is obtained as follows:

• This is saying that we compute our activation nodes by using a $3\times4$ matrix of parameters. We apply each row of the parameters to our inputs to obtain the value for one activation node. Our hypothesis output is the logistic function applied to the sum of the values of our activation nodes, which have been multiplied by yet another parameter matrix $\Theta^{(2)}$ containing the weights for our second layer of nodes.

• Each layer gets its own matrix of weights, $\Theta^{(j)}$.

• The dimensions of these matrices of weights is determined as follows:

The $+1$ comes from the addition in $\Theta^{(j)}$ of the “bias nodes”, $x_0$ and $\Theta_0^{(j)}$. In other words, the output nodes will not include the bias nodes while the inputs will.

#### 12.2 Model Representation II

• Forward propation: Vectorized implementation

• To re-iterate, the following is an example of a neural network:

• In this section we’ll do a vectorized implementation of the above functions. We’re going to define a new variable $z_k^{(j)}$ that encompasses the parameters inside our $g$ function.

• In our previous example, if we replaced by the variable $z$ for all the parameters we would get:

• In other words, for layer $j=2$ and node $k$, the variable $z$ will be:

• The vector represation of $x$ and $z^{(j)}$ is:

• Setting $x=a^{(1)}$, we can rewrite the equation as: $z^{(j)}=\Theta^{(j-1)}a^{(j-1)}$

• We are multiplying our matrix $\Theta^{(j-1)}$ with dimensions $s_j \times (n+1)$ (where $s_j$ is the number of our activation nodes) by our vector $a^{(j-1)}$ with height $(n+1)$. This gives us our vector $z^{(j)}$ with height $s_j$.

• Now we can get a vector of our activation nodes for layer $j$ as follows: $a^{(j)} = g(z^{(j)})$. Where our function $g$ can be applied element-wise to our vector $z^{(j)}$.

• We can then add a bias unit (equal to 1) to layer $j$ after we have computed $a^{(j)}$. This will be element $a_0^{(j)}$ and will be equal to 1.

• To compute our final hypothesis, let’s first compute another $z$ vector:

• We get this final $z$ vector by multiplying the next theta matrix after $\Theta^{(j-1)}$ with the values of all the activation nodes we just got.

• This last theta matrix $\Theta^{(j)}$ will have only one row which is multiplied by one column $a^{(j)}$ so that our result is a single number. We then get our final result with:

• Notice that in this last step, between layer $j$ and layer $j+1$, we are doing exactly the same thing as we did in logistic regression. Adding all these intermediate layers in neural networks allows us to more elegantly produce interesting and more complex non-linear hypothesis.
• Neural Network learning its own features

• Other network architectures

## 13 Applications

#### 13.1 Examples and Intuitions I

• Non-linear classification examples: XOR/XNOR

• Simple example: AND

• A simple example of applying neural networks is predicting $x_1 \text{AND } x_2$ , which is the logical ‘and’ operator and is only true if both $x_1$ and $x_2$ are 1.

• The graph of our function will look like:

Remember that $x_0$ is our bias variable and is always 1.

• Let’s set our first theta matrix as: $\Theta^{(1)} = \begin{bmatrix} -30 & 20 & 20 \end{bmatrix}$.

• This will cause the output of our hypothesis to only be positive if both $x_1$ and $x_2$ are 1. In other words:

• So we have constructed one of the fundamental operations in computers by using a small neural network rather than using an actual AND gate.

• Neural networks can also be used to simulate all the other logical gates. The following is an example of the logical operator ‘OR’, meaning either $x_1$ is true or $x_2$ is ture, or both. Where $g(z)$ is the following:

#### 13.2 Examples and Intuitions II

• Negation ($\text{NOT } x_1$):

• Putting it together: $x_1 \text{ XNOR } x_2$

• The $\Theta^{(1)}$ matrices for AND, NOR, and OR are:

• We can combine these to get the XNOR logical operator (which gives 1 if $x_1$ and $x_2$ are both 0 or both 1).

• For the transition between the first and second layer, we’ll use a $\Theta^{(1)}$ matrix that combines the values for AND and NOR:

• For the transition between the second and third layer, we’ll use a $\Theta^{(2)}$ matrix that uses the value for OR:

• Let’s write out the values for all our nodes:

• And there we have the XNOR operator using a hidden layer with two nodes.

• Neural Network intuition

• Examples:

#### 13.3 Multiclass Classification

• Multiple output units: One-vs-all

• To classify data into multiple classes, we let our hypothesis function return a vector of values. Say we wanted to classify our data into one of four categories. We will use the following example to see how this classification is done. This algorithm takes as input an image and classifies it accordingly.

• We can define our set of resulting classes as $y$:

• Each $y^{(i)}$ represents a different image corresponding to either a car, pedestrian, truck, or motorcycle. The inner layers, each provides us with some new information which leads to our final hypothesis function.

• The setup looks like:

• Our resulting hypothesis for one set of inputs may look like:

In which case our resulting class is the third one down, or $h_\Theta(x)_3$, which represents the motorcycle.

## Ex3: Multi-class Classification and Neural Networks👨💻

See this exercise on Coursera-MachineLearning-Python/ex3/ex3.ipynb

#### Ex3.1 Multi-class Classification

Instruction: For this exercise, you will use logistic regression and neural networks to recognize handwritten digits (from 0 to 9). Automated handwritten digit recognition is widely used today - from recognizing zip codes (postal codes) on mail envelopes to recognizing amounts written on bank checks. This exercise will show you how the methods you’ve learned can be used for this classification task.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as scio
import scipy.optimize as opt

''' Part 0: Functions and Parameters '''
# Load training data
def loadData(path):
data = scio.loadmat(path)
X, y = data['X'], data['y']
m = len(y)
return X, y, m

# Randomly select several data points to display
def randomDisplay(data, num=100, cmap='binary', transpose=True):
sample = data[np.random.choice(len(data), num)]
size, size1 = int(np.sqrt(num)), int(np.sqrt(sample[0].shape[0]))
fig0, ax0 = plt.subplots(nrows=size, ncols=size, sharex=True, sharey=True, figsize=(8, 8))
order = 'F' if transpose else 'C'
for i in range(size):
for j in range(size):
ax0[i, j].imshow(sample[size * i + j].reshape([size1, size1], order=order), cmap=cmap)
plt.xticks(np.array([]))
plt.yticks(np.array([]))
plt.subplots_adjust(wspace=0, hspace=0)
plt.suptitle(str(num)+' examples from the dataset', fontsize=24)

# Sigmoid function
def sigmoid(z):
return 1 / (1 + np.exp(-z))

# Compute cost and gradient for logistic regression with regularization
def lrCostFunction(theta, X, y, lam):
m = len(y)
cost1 = - np.sum(y * np.log(sigmoid(np.dot(X, theta))) + (1 - y) * np.log(1 - sigmoid(np.dot(X, theta)))) / m
cost2 = 0.5 * lam * np.dot(theta[1:].T, theta[1:]) / m
cost = cost1 + cost2
grad = np.dot(X.T, sigmoid(np.dot(X, theta)) - y) / m
grad[1:] += (lam * theta / m)[1:]
return cost, grad

def costFunc(param, *args):
X, y, lam = args
m, n = X.shape
theta = param.reshape([n, 1])
cost1 = - np.sum(y * np.log(sigmoid(np.dot(X, theta))) + (1 - y) * np.log(1 - sigmoid(np.dot(X, theta)))) / m
cost2 = 0.5 * lam * np.dot(theta[1:].T, theta[1:]) / m
return cost1 + cost2

def gradFunc(param, *args):
X, y, lam = args
m, n = X.shape
theta = param.reshape(-1, 1)
grad = np.dot(X.T, sigmoid(np.dot(X, theta)) - y) / m
grad[1:] += (lam * theta / m)[1:]
return grad.ravel()

# oneVsAll() trains multiple logistic regression classifiers and returns all
# the classifiers in a matrix all_theta, where the i-th row of all_theta
# corresponds to the classifier for label i
def oneVsAll(X, y, num_labels, lam):
m, n = X.shape
all_theta = np.zeros([num_labels, n + 1])
X = np.c_[np.ones([m, 1]), X]
for i in range(1, num_labels + 1):
params = np.zeros(n + 1)
args = (X, y == i, lam)
res = opt.minimize(fun=costFunc, x0=params, args=args, method='TNC', jac=gradFunc)
all_theta[i - 1, :] = res.x

return all_theta

# Predict the label for a trained one-vs-all classifier
def predictOneVsAll(X, all_theta):
m, n = X.shape
X = np.c_[np.ones([m, 1]), X]
h_argmax = np.argmax(sigmoid(np.dot(X, all_theta.T)), axis=1)
return h_argmax + 1

# Setup the parameters
input_layer_size = 400  # 20x20 Input Images of Digits
num_labels = 10         # 10 labels, form 1 to 10 (note that we have mapped '0' to label '10')

''' Part 1: Loading and Visualizing Data '''
print('Loading and Visualizing Data ... ')
# Load Training Data
X, y, m = loadData('ex3data1.mat')

# Randomly select 100 data points to display
randomDisplay(X, 100)
plt.show()

''' Part 2.1: Vectorize Logistic Regression '''
# Test case for lrCostFunction
print('\nTesting lrCostFunction() with regularization')
theta_test = np.array(([-2], [-1], [1], [2]))
X_test = np.c_[np.ones([5, 1]), np.linspace(1, 15, 15).reshape([5, 3], order='F') / 10]
y_test = np.array(([1], [0], [1], [0], [1]))
lam_test = 3

cost, grad = lrCostFunction(theta_test, X_test, y_test, lam_test)

print('Cost: ', cost.flatten())
print('Expected cost: 2.534819')
print('Gradients: ', grad.flatten())
print('Expected gradients: 0.146561\t -0.548558\t 0.724722\t 1.398003')

''' Part 2.2: One-vs-All Training '''
print('\nTraining One-vs-All Logistic Regression...')
theta = oneVsAll(X, y, num_labels=num_labels, lam=1.0)

''' Part 3: Predict for One-Vs-All '''
y_predict = predictOneVsAll(X, all_theta=theta)
print('Training Set Accuracy: ', np.mean(y.ravel() == y_predict) * 100, '%')

Output:

• Console:
• Randomly select several data points to display:

#### Ex3.2 Neural Networks

Instruction:

In this part of the exercise, you will implement a neural network to recognize handwritten digits using the same training set as before. The neural network will be able to represent complex models that form non-linear hypotheses. Your goal is to implement the feedforward propagation algorithm to use our weights for prediction.

Our neural network is shown below. It has 3 layers – an input layer, a hidden layer and an output layer. Recall that our inputs are pixel values of digit images. Since the images are of size $20×20$, this gives us 400 input layer units (excluding the extra bias unit which always outputs +1). As before, the training data will be loaded into the variables $X$ and $y$.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as scio

''' Part 0: Functions and Parameters '''
# Load training data
def loadData(path):
data = scio.loadmat(path)
X, y = data['X'], data['y']
m = len(y)
return X, y, m

# Randomly select several data points to display
def randomDisplay(data, num=100, cmap='binary', transpose=True):
sample = data[np.random.choice(len(data), num)]
size, size1 = int(np.sqrt(num)), int(np.sqrt(sample[0].shape[0]))
fig0, ax0 = plt.subplots(nrows=size, ncols=size, sharex=True, sharey=True, figsize=(8, 8))
order = 'F' if transpose else 'C'
for i in range(size):
for j in range(size):
ax0[i, j].imshow(sample[size * i + j].reshape([size1, size1], order=order), cmap=cmap)
plt.xticks(np.array([]))
plt.yticks(np.array([]))
plt.subplots_adjust(wspace=0, hspace=0)
plt.suptitle(str(num)+' examples from the dataset', fontsize=24)

# Sigmoid function
def sigmoid(z):
return 1 / (1 + np.exp(-z))

# Predict the label of an input given a trained neural network
def predict(theta1, theta2, X):
a1 = np.c_[np.ones([X.shape[0], 1]), X]
z2 = np.dot(a1, theta1.T)
a2 = np.c_[np.ones([z2.shape[0], 1]), sigmoid(z2)]
z3 = np.dot(a2, theta2.T)
a3 = sigmoid(z3)
pred = np.argmax(a3, axis=1)
return pred + 1

# Setup the parameters
input_layer_size = 400  # 20x20 Input Images of Digits
hidden_layer_size = 25  # 25 hidden units
num_labels = 10         # 10 labels, form 1 to 10 (note that we have mapped '0' to label '10')

''' Part 1: Loading and Visualizing Data '''
print('Loading and Visualizing Data ... ')
# Load Training Data
X, y, m = loadData('ex3data1.mat')

# Randomly select 100 data points to display
randomDisplay(X, 100, transpose=True)
plt.show()

''' Part 2: Loading Parameters '''
weights = scio.loadmat('ex3weights.mat')
theta1, theta2 = weights['Theta1'], weights['Theta2']

''' Part 3: Implement Predict '''
y_predict = predict(theta1, theta2, X)
print('\nTraining Set Accuracy: ', np.mean(y_predict == y.flatten()) * 100, '%')

# Randomly select examples
random_index = np.random.choice(m, size=10)
print('Indexes of examples :', random_index)
for i, idx in enumerate(random_index):
# print('Example[%d]\t is number %d,\t we predict it as %d' % (i + 1, y[idx], y_predict[idx    ]))
print('Example[{:0>2}] is number {:^2}, we predict it as {:^2}'.
format(str(i + 1), str(int(y[idx])), str(y_predict[idx])))

Output:

• Console:

Thistledown


text:
# Monotonic subsequence

Consider a bounded sequence. By Bolzanno Weierstrass theorem we can conclude that it contains a sub sequence which is convergent . The proof of Bolzanno uses Cantor's completeness principle.

Let us consider the sequence of nested closed intervals $[a_1,b_1][a_2,b_2],\ldots,[a_n,b_n]$. Suppose this sequence of intervals satisfies all the conditions required for the cantor's completeness principle (described and discussed in my previous question).

Now both the sequences converge to a value K , which is the common intersection of all the closed intervals.Now let us consider the sequence of closed intervals $[a_1,k], [a_2,k],\ldots$. This can be thought as the outcome of considering the sequences $a_1,a_2,a_3,\ldots$ and $k,k,k.,k,\ldots$. So we can apply the cantor's completeness principle here. Then we can apply the idea used in proving Bolzanno Weierstrass theorem to conclude that every bounded sequence has a monotonic convergent sub sequence.

Is this idea of mine correct?

• You have to be more explicit. How do you construct the sequence $(a_n)$? It is possible to give a proof of Bolzano-Weierstrass along similar lines in which $(a_n)$ does not have to be a subsequence. – Michael Greinecker Oct 24 '12 at 7:42
• @MichaelGreinecker I could not get. – danny gotze Oct 24 '12 at 7:45
• @MichaelGreinecker I meant I could not get what you meant. – danny gotze Oct 24 '12 at 7:46
• You start with some bounded sequence $(x_n)$ of real numbers. How do you construct a convergent subsequence? How do you construct your nested sequence of closed intervals? Your question cannot be answered before you have clarified that. – Michael Greinecker Oct 24 '12 at 7:50
• @MichaelGreinecker I started with Xn,....Let its least upperbound be K. So, we can keep on shrinking the interval [-k,k] to [-k/2,k/2]...[-k/2^n,K/2^n] and then apply Cauchy principle to assert the convergence, as it is done while proving the bolzanno weirstrass. Now the sequence of intervals converge to a single value, say ,L. Then consider the sequence of closed intervals [-K,l],[-k/2,l]..... – danny gotze Oct 24 '12 at 7:57


text:
# Zeroes and Ones - 30 points

## Writeup by poortho

Problem Statement: Bit String Flicking

How many solutions are there for X in the expression:

LCIRC -3 (01011 AND X OR 10100) = 01101

Hint:

Try simplifying it?

## Writeup

This problem is a simple bit string flicking equation. Let's begin.

First, LCIRC-3 means that you cycle the bits left 3 times. The inverse of LCIRC-3 is RCIRC-3, so we can rewrite the equation as 01011 AND X OR 10100 = 10101

Then, order of operations dictates that we perform the AND then the OR.

Thus, because the OR is applied last, we know that the 2nd and 4th bit of 01011 AND X has to be 0, the 5th bit has to be 1, and the 1st and 3rd bit can be anything.

So now we have 01011 AND X = ?0?01. Again, we see that the 1st and 3rd bit of X can be anything. We also see that the 5th bit has to be 1, and the 2nd and 4th bit must be 0.

Thus, our answer is 2^(number of ?'s) = 2^2 = 4, which is our flag.

## Flag

4


text:
## Algebra 1: Common Core (15th Edition)

$1/b^{21}$.
When a power is raised to a power, we multiply the two powers. Thus, we multiply -7 and 3 to obtain that the expression simplifies to $b^{-21}$. However, because -21 is negative, we put it in the denominator of the fraction, obtaining that this simplifies to: $1/b^{21}$.


text:
## Is dynamic use of ngx-mask possible for telephone input at angle 8?

I used ngx-mask and could not apply the mask according to the text you entered.

Example: 10 or 11-digit telephone input.

Landline: (99) 999999999
Mobile: (99) 9999? 9999

## PHP dynamic array for pg_insert ()

As an example, I developed the following code:

`\$dados  = "nome-luiz-idade-21-status-true";`

`\$arraydados = explode("-", \$dados);`

I need to create a dynamic array in which: The even positions of `\$arraydados` are the names of each position in a new array and the odd positions of `\$arraydados` are the respective value of this position.

I will do that in one `for`, based on `count` from `\$arraydados`,

I tried to do it that way, but it did not work out:

`\$cntindice=0;`

`\$cntval=1;`

`\$arrayinsert(\$arraydados(\$cntindice)) = \$arraydados(\$cntval);`

Does anyone know where I am wrong?

Note: I will use this array in one `pg_insert()`,

## Dynamic Programming – Search for an algorithm for finding the partition of data at an interval that maximizes the minimum fitness between the blocks

In the work "An algorithm for optimal partitioning of data in an interval" (link), the authors describe an algorithm for partitioning data in an interval in order to maximize a fitness function. The fitness function they use is the sum of the fitness of each block in the partition.

My question is, how can this be done if the fitness function were the minimum fitness of each block instead? More specifically, what should the algorithm be like if the sum in the fitness function in equation (4) has been replaced by `min`?

I suspect that the same algorithm would work, replacing Equation (6) with the following:

$$Max_j , {min (opt (j-1), end (j, n + 1)) }.$$

I would think that this has been done before, but I can not find any references. Does anyone have a reference or does he agree that my change is correct?

## codenameone – Dynamic iOS library .framework in the native surface of codename One

I need to use a dynamic iOS .framework library codenamed One, but I have not found any instructions.

The developer's guide (section: https://www.codenameone.com/manual/advanced-topics.html#_bundling_native_ios_sdk) has the following tips, but they do not seem to work:

Locate the "Binary" file inside the framework and copy it to the native / ios directory. Rename it to libXXX.a (where XXX is the name of the binary file).

Copy all .h files from the framework to your native / ios directory.

Update all #import statements in the #import format headers to simply import "FileName.h".

This does not work if the `*.framework` Contains no static library, but a dynamic (as suggested in the answers to creating a static library from an existing framework in iOS).

Before iOS 8 all `.framework` Files contained only static libraries, but as of iOS 8 developers can create dynamic frameworks (see https://stackoverflow.com/a/15331319/1277576).

## Convert the boot disk from Dynamic to Basic without destroying the operating system

In the end, I converted my SSD into a dynamic instead of a hard drive. Is there a nondestructive way to restore the basic settings? I do not want to lose the built-in Windows 10. Is there a way?

## CSS – modal with dynamic height and footer

Hi!

I have a window with a dynamic height and a scroll. The problem is that the footer can not be displayed because the data list occupies the entire screen. I always want to see the footer.

Any ideas?

This is my CSS code:

.own modal {@media (min-height: 320px) {ion background {visibility:
visible, noticeable; }}

Position: absolutely; above: 0; right: 0; below: 0; left: 0; Display:
flex; Align Items: Center; Justification content: middle;

included: strict; .modal-wrappers {&, .ion-page, .ion-page .content,
.ion-page .content .scroll-content {contains: content; Position:
relative; above: car; left: car; } display: flex; Overflow: car;
Flex direction: column; maximum height: 100%; Opacity: 0; height: car;
maximum width: 100%; }}

The content of the modal window is very simple. In the content tag, I have a label and a list, and then a footer with a div and within the div an item with a button.

## vba – Excel import data from various dynamic workbook headers

I've copied this code below, which copies data into a master workbook in the "Inputs1" sheets by matching the column headings from the master workbook to the source workbook. If a column heading matches, that column will be copied and pasted into the appropriate column in the master workbook.

The macro works fine for smaller files, but once I've run it for larger files, it takes almost 2 minutes to run. I also noticed that it runs slower when called from a user form rather than directly from the Developer tab.

How can I improve this code to work more efficiently and faster? I also get side fibrillation.

``````Sub Import()

Application.ScreenUpdating = False

EventState = Application.EnableEvents
Application.EnableEvents = False

CalcState = Application.Calculation
Application.Calculation = xlCalculationManual

PageBreakState = ActiveSheet.DisplayPageBreaks
ActiveSheet.DisplayPageBreaks = False

Dim wbSource As Workbook
Dim wbDest As Workbook
Dim TargetSheet As Worksheet
Dim c As Range
Dim rng As Range
Dim i As Integer
Dim MyRange As Range
Dim SourceSheet As Worksheet
Dim source As String
Dim dest As String
Dim r As Range
Dim msg As String

'Source and destination workbooks defined by cell value

source = Worksheets("Set-Up").Range("B11")
dest = Worksheets("Set-Up").Range("B8")

Set wbSource = Workbooks(source)
Set SourceSheet = wbSource.Worksheets("HFL01 Extract")

Set wbDest = Workbooks(dest)
Set TargetSheet = wbDest.Worksheets("INPUTS1")

With SourceSheet.Range("A1").CurrentRegion
For Each r In TargetSheet.Range("A1:cc1")
Set c = .Rows(1).Find(r.Value, , , xlWhole, , 0)
If Not c Is Nothing Then
.Columns(c.Column).Copy
r.PasteSpecial xlPasteValues

End If
Next
Application.CutCopyMode = False
End With

Set fileDialog = Nothing
Set wbSource = Nothing

End Sub
``````

## hdr – How to correctly calculate the dynamic range of an image

First, regardless of the definition of the dynamic range, it does not make sense to compute the luminance "anything to zero" since the ratio then becomes infinite. Your:

``````log2(max)-log2(0)
``````

is another way of saying

``````log(max/0)
``````

and we can not divide by zero (and log2 (0) is undefined)

So let's forget the 0 for now (zero means that the image is not well exposed anyway, because you can not have details at level 0), then in fact:

``````log2(255)-log2(1) = ~8 (EV)
``````

However, this is not the dynamic range, as in JPEG (and sRGB in general) pixels values are not pixels luminance,

Taking into account the correct gamma formula, we finally get:

``````log2(1)-log2(1/3294.6) = ~12 (EV)
``````

## How do I create a dynamic DNS service?

How do I create a dynamic DNS service? | Web Hosting Talk

& # 39);
var sidebar_align = & right; & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;);
// ->

1. ## How do I create a dynamic DNS service?

Hi,
I have a question, I hope this is the right forum,
What are the requirements if I want to create a dynamic DNS service?

Greetings.

2. Nameserver to provide the records, the agent on the computer that updates the record, and the server script that accepts these updates and updates the record on the name server.

#### Publish permissions

• she not allowed post new topics
• she not allowed Post answers
• she not allowed Post attachments
• she not allowed Edit your posts

## How do I create a dynamic DNS service?

How do I create a dynamic DNS service? | Web Hosting Talk

& # 39);
var sidebar_align = & right; & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;);
// ->

1. ## How do I create a dynamic DNS service?

Hi,
I have a question, I hope this is the right forum,
What are the requirements if I want to create a dynamic DNS service?

Greetings.

#### Publish permissions

• she not allowed post new topics
• she not allowed Post answers
• she not allowed Post attachments
• she not allowed Edit your posts


text:
Quick Start Guide¶

This quick start guide will introduce the syntax of JuMPChance, again assuming familiarity with JuMP.

Creating a model¶

JuMPChance models should be created by using the following constructor:

m = ChanceModel()

All variables and constraints are associated with this model object. As in JuMP, solvers can be specified by using the solver= argument to the constructor. For example:

using CPLEX
m = ChanceModel(solver=CplexSolver())

will set the solver to CPLEX, assuming that both CPLEX and the corresponding Julia package are properly installed.

By default, JuMPChance will use ECOS, a lightweight open-source solver which supports the conic constraints needed for the reformulation method for solving chance-constrained problems.

Defining variables¶

In JuMPChance, you can mix decision variables and random variables in expressions. Decision variables are declared by using JuMP’s @variable syntax. Random variables are declared by using a similar syntax:

@indepnormal(m, x, mean=0, var=1)

creates a single independent normal random variable with the specified mean and variance. The mean and var arguments are always required. Variables indexed over a given set are supported, and the means and variances may depend on the given indices. For example:

@indepnormal(m, x[i=1:N,j=1:M], mean=i*j, var = 2j^2)

creates an N by M matrix of independent normally distributed random variables where the variable in index (i,j) has mean i*j and variance 2j^2.

Index sets do not need to be ranges; they may be arbitrary Julia lists:

S = [:cat, :dog]
@indepnormal(m, x[S], mean=0, var=1)

defines two variables x[:cat] and x[:dog].

Chance constraints¶

A JuMPChance model may contain a combination of standard JuMP constraints (linear and quadratic) and chance constraints.

Chance constraints are constraints which contain a mix of decision variables and random variables. Products with decision variables and random variables are allowed, but products between two decision variables or two random variables are not currently supported. This restriction ensures that the resulting chance constraint is a convex constraint on the decision variables.

Mathematically, the types of constraints supported are

$P\left(\sum_{i=1}^k \left(c_i^Tx +d_i\right)z_i \geq b\right) \geq 1- \epsilon$

and

$P\left(\sum_{i=1}^k \left(c_i^Tx +d_i\right)z_i \leq b\right) \geq 1-\epsilon$

where $$x$$ are the decision variables, $$c_i$$ are coefficient vectors, $$d_i$$ and $$b$$ are scalars, $$z_i$$ are independent jointly normal random variables with provided means and variances for $$i=1,\ldots,k$$, and $$\epsilon \in (0,1)$$.

Chance constraints of the above form are added by using the @constraint macro. For example:

@indepnormal(m, x, mean=0,var=1)
@variable(m, z)

@constraint(m, z*x >= -1, with_probability=0.95)

Adds the constraint $$P(z*x \geq -1) \geq 0.95$$. Note that the with_probability argument specifies the minimum probability $$\epsilon$$ with which the constraint may be satisfied, and so should be a number close to 1.

Distributionally robust chance constraints¶

One may also specify normally distributed random variables whose parameters (mean and variance) are uncertain, that is, known to fall within a certain interval. These random variables with uncertain distribution are declared as follows:

@indepnormal(m, x, mean=(-1,1), var=(20,30))

Any combination of the mean, variance, or both may be uncertain. When these variables appear in constraints, the constraint is interpreted to be robust, and implies that the the chance constraint must hold for all possible distributions, where the set of possible distributions will be defined more precisely below. Mathematically, this is

$P\left(\sum_{i=1}^k \left(c_i^Tx +d_i\right)z_i \leq b\right) \geq 1-\epsilon, \forall \text{ distributions of } z_1,\ldots,z_n$

Using the above notation, let the uncertainty interval on the mean of $$z_i$$ be $$[\hat\mu_i - \alpha_i,\hat\mu_i + \alpha_i]$$ and on the variance $$[\hat\sigma_i^2 - \beta_i, \hat\sigma_i^2 + \beta_i]$$ where $$\alpha_i \geq 0$$ and $$\beta_i \geq 0$$.

Currently JuMPChance supports only the following uncertainty sets on the means and variances:

\begin{align}\begin{aligned}M = \left\{ (\mu_1,\ldots,\mu_k) : \exists (s_1,\ldots,s_k) \text{ such that }\mu_i = \hat\mu_i + s_i, |s_i| \leq \alpha_i, \sum_{i=1}^k \frac{|s_i|}{\alpha_i} \leq \Gamma_\mu \right\}\\V = \left\{ (v_1,\ldots,v_k) : \exists (s_1,\ldots,s_k) \text{ such that }v_i = \hat\sigma_i + s_i, |s_i| \leq \beta_i, \sum_{i=1}^k \frac{|s_i|}{\beta_i} \leq \Gamma_\sigma \right\}\end{aligned}\end{align}

where $$\Gamma_\mu$$ and $$\Gamma_\sigma$$ and given (integer) constants, known as the uncertainty budgets. The interpretation of these sets is that at most $$\Gamma$$ out of $$k$$ uncertain parameters are allows to vary from their nominal values $$\hat\mu_i$$ and $$\hat\sigma_i^2$$. This is the uncertainty set proposed by Bertsimas and Sim (2004). Note that the means and variances are allowed to vary independently.

The uncertainty budgets $$\Gamma_\mu$$ and $$\Gamma_\sigma$$ are specified as parameters to @constraint as follows:

@constraint(m, z*x >= -1, with_probability=0.95,
uncertainty_budget_mean=1, uncertainty_budget_variance=1)

Solving the model¶

After the model m has been created and all constraints added, calling:

solve(m,method=:Cuts)

or:

solve(m,method=:Reformulate)

will tell JuMPChance to solve the model. The available solution methods are described in the following section.

The solve function also returns a solution status. This should be checked to confirm that the model was successfully solved to optimality, for example:

status = solve(m)
if status == :Optimal
println("Solved to optimality")
else
println("Not optimal, termination status \$status")
end

Optimal values of the decision variables are available by using getvalue, as with JuMP.


text:
# Is my conjecture, that sum of the exterior angles of a polygon is 360^@, is correct?

There is no need for conjecture. The sum of the exterior angles of a polygon is always ${360}^{\circ}$, irrespective of type of polygon i.e. whether regular or not or its number of sides.


text:
## What is “Naive” in a Naive Bayes classifier?

Naive Bayes is ‘naive’ because it makes the assumption that independent variables or features of an experiment are independent of each other which is not true in real world situations. Despite this, the Naive Bayes classifier works extremely well in lots of real world situations.

## Bayes Theorem:

Bayes’ theorem is used to describe conditional probability. Bayes theorem describes the probability of an event, based on prior knowledge of conditions that might be related to that particular event.

For example, if diabetes is related to age, then, using Bayes’ theorem, a person’s age can be used to more accurately assess the probability that they have diabetes, compared to the assessment of the probability of diabetes made without knowledge of the person’s age.

“Bayes theorem states that posterior probability equals prior probability times the likelihood ratio”

where A and B are events.

• We are trying to find probability of event A, given the event B is true. Event B is also termed as evidence.
• P(A|B) is a posterior probability, i.e. probability of event after evidence is seen.
• P(B|A) is prior probability that is probability before evidence.


text:
The stats module is composed of the wrappers for statistical distributions and wrappers for other statistical function and summaries. These two follow completely different approaches which are discussed in the two sections below, one per block.

There are only two classes that serve as wrappers to all statistical distributions in scipy.stats, one for continuous distributions and another for discrete ones. This has some drawbacks related to preservation of named dimensions and coordinates, but we believe its simplicity and ease of maintenance outweighs this drawbacks.

The two wrappers XrContinuousRV and XrDiscreteRV take as first argument the scipy distribution to be wrapped and then optional args and kwargs. Methods take also a mixture of args and kwargs, mimicking the behaviour of scipy distributions where the scale for example can be defined either at creation time or when calling a method and it can be passed as a positional or keyword argument.

The xarray einstats wrapper classes however, instead of initializing the distributions at creation store the distribution and initialization args and kwargs. Then, whenever a method is called the args and kwargs provided via the method and the ones provided at initialization are combined and broadcasted. This happens in the _broadcast_args method of xarray_einstats.stats.XrRV. The combined+broadcasted arguments are used to call the scipy distribution via xarray.apply_ufunc, which ensures that the shapes will be compatible.

As the same wrappers are used for all distributions, even if both positional and keyword arguments are broadcasted, they are used as provided when calling apply_ufunc. The main drawback of this approach is that apply_ufunc is only able to preserve the dimensions and coordinates of positional arguments. Therefore, given two equivalent wrappers, one using positional and another using keyword arguments, there are some edge cases where the one using keyword arguments will return numpy arrays instead of DataArrays. Values are the same in both cases, but one case has lost all information about named dimensions and coordinates. The arguably more common and annoying case of such behaviour is with the .rvs method.

import numpy as np
from scipy import stats
from xarray_einstats.tutorial import generate_mcmc_like_dataset
from xarray_einstats import stats as xtats
ds = generate_mcmc_like_dataset(3)

dist_pos = xtats.XrContinuousRV(stats.norm, ds["mu"], ds["sigma"])
dist_kw = xtats.XrContinuousRV(stats.norm, loc=ds["mu"], scale=ds["sigma"])

rvs_pos = dist_pos.rvs(size=5, random_state=7)
rvs_kw = dist_kw.rvs(size=5, random_state=7)
allclose = np.allclose(rvs_pos, rvs_kw)

print(f"Output type of rv_pos: {type(rvs_pos)}")
print(f"Output type of rv_kw:  {type(rvs_kw)}")
print(f"\nCheck all values are indeed equal in both cases: {allclose}")

Output type of rv_pos: <class 'xarray.core.dataarray.DataArray'>
Output type of rv_kw:  <class 'numpy.ndarray'>

Check all values are indeed equal in both cases: True

In other methods, this is more complicated to trigger, because only one positional argument is enough to preserve all information. As the rest of the methods convert array input to xarray under the hood, the following code doesn’t lose any labels:

dist_kw.pdf(np.linspace(-3, 3))

<xarray.DataArray (point: 50, chain: 4, draw: 10, team: 6)>
0.07148 0.06092 0.03051 0.01553 0.06261 ... 0.0711 0.08956 0.07408 0.05843
Coordinates:
* point    (point) float64 -3.0 -2.878 -2.755 -2.633 ... 2.633 2.755 2.878 3.0
* chain    (chain) int64 0 1 2 3
* draw     (draw) int64 0 1 2 3 4 5 6 7 8 9
* team     (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'

## About statistical function and summary wrappers#

Most wrappers here are minimal wrappers, that generally spend more time handling argument defaults. The general pattern of these wrappers is the following:

1. Handle arguments. Arguments whose information is not needed by the wrapper generally default to None and are not included in the dict passed to apply_ufunc as kwargs argument. This covers us from having to track changes in scipy and update our argument defaults.

2. (optional) Take care of arguments that accept array values, that in xarray_einstats take DataArrays. They are broadcasted and aligned so the computation works.

3. Stack/reshape if necessary. xarray_einstats uses a dims argument that differs from scipy axis because it takes strings and because sequences of strings are also valid. When multiple dimensions are provided via dims they are stacked before calling scipy as it only takes integer axis

4. Call the scipy function.

Steps 3 and 4 are generally done via xarray_einstats.stats._apply_reduce_func and xarray_einstats.stats._apply_nonreduce_func. However, if necessary, they are done manually (for now this only happens with median_abs_deviation)


text:
Updated: 5 hours 55 min ago

### Improved Factoring Attacks on Multi-Prime RSA with Small Prime Difference

Sun, 03/18/2018 - 10:09
In this paper, we study the security of multi-prime RSA with small prime difference and propose two improved factoring attacks. The modulus involved in this variant is the product of r distinct prime factors of the same bit-size. Zhang and Takagi (ACISP 2013) showed a Fermat-like factoring attack on multi-prime RSA. In order to improve the previous result, we gather more information about the prime factors to derive r simultaneous modular equations. The first attack is to combine all the equations and solve one multivariate equation by generic lattice approaches. Since the equation form is similar to multi-prime Phi-hiding problem, we propose the second attack by applying the optimal linearization technique. We also show that our attacks can achieve better bounds in the experiments.

### Practical Secure Aggregation for Privacy Preserving Machine Learning

Fri, 03/16/2018 - 13:35
We design a novel, communication-efficient, failure-robust protocol for secure aggregation of high-dimensional data. Our protocol allows a server to compute the sum of large, user-held data vectors from mobile devices in a secure manner (i.e. without learning each user's individual contribution), and can be used, for example, in a federated learning setting, to aggregate user-provided model updates for a deep neural network. We prove the security of our protocol in the honest-but-curious and malicious settings, and show that security is maintained even if an arbitrarily chosen subset of users drop out at any time. We evaluate the efficiency of our protocol and show, by complexity analysis and a concrete implementation, that its runtime and communication overhead remain low even on large data sets and client pools. For 16-bit input values, our protocol offers $1.73\times$ communication expansion for $2^{10}$ users and $2^{20}$-dimensional vectors, and $1.98\times$ expansion for $2^{14}$ users and $2^{24}$-dimensional vectors over sending data in the clear.

### Highly-Efficient Fully-Anonymous Dynamic Group Signatures

Fri, 03/16/2018 - 10:08
Group signatures are a central tool in privacy-enhancing cryptography, which allow members of a group to anonymously produce signatures on behalf of the group. Consequently, they are an attractive means to implement privacy-friendly authentication mechanisms. Ideally, group signatures are dynamic and thus allow to dynamically and concurrently enroll new members to a group. For such schemes, Bellare et al. (CT-RSA'05) proposed the currently strongest security model (BSZ model). This model, in particular, ensures desirable anonymity guarantees. Given the prevalence of the resource asymmetry in current computing scenarios, i.e., a multitude of (highly) resource-constrained devices are communicating with powerful (cloud-powered) services, it is of utmost importance to have group signatures that are highly-efficient and can be deployed in such scenarios. Satisfying these requirements in particular means that the signing (client) operations are lightweight. We propose a novel, generic approach to construct dynamic group signature schemes, being provably secure in the BSZ model and particularly suitable for resource-constrained devices. Our results are interesting for various reasons: We can prove our construction secure without requiring random oracles. Moreover, when opting for an instantiation in the random oracle model (ROM) the so obtained scheme is extremely efficient and outperforms the fastest constructions providing anonymity in the BSZ model - which also rely on the ROM - known to date. Regarding constructions providing a weaker anonymity notion than BSZ, we surprisingly outperform the popular short BBS group signature scheme (CRYPTO'04; also proven secure in the ROM) and thereby even obtain shorter signatures. We provide a rigorous comparison with existing schemes that highlights the benefits of our scheme. On a more theoretical side, we provide the first construction following the "without encryption" paradigm introduced by Bichsel et al. (SCN'10) in the strong BSZ model.

### CrowdBC: A Blockchain-based Decentralized Framework for Crowdsourcing

Thu, 03/15/2018 - 06:07
Crowdsourcing systems which utilize the human intelligence to solve complex tasks have gained considerable interest and adoption in recent years. However, the majority of existing crowdsourcing systems rely on central servers, which are subject to the weaknesses of traditional trust-based model, such as single point of failure. They are also vulnerable to distributed denial of service (DDoS) and Sybil attacks due to malicious users involvement. In addition, high service fees from the crowdsourcing platform may hinder the development of crowdsourcing. How to address these potential issues has both research and substantial value. In this paper, we conceptualize a blockchain-based decentralized framework for crowdsourcing named CrowdBC, in which a requester's task can be solved by a crowd of workers without relying on any third trusted institution, users' privacy can be guaranteed and only low transaction fees are required. In particular, we introduce the architecture of our proposed framework, based on which we give a concrete scheme. We further implement a software prototype on Ethereum with real-world dataset. Experiment results show the validity and effectiveness of our proposed crowdsourcing system.

### On the Limitations of Computational Fuzzy Extractors

Thu, 03/15/2018 - 03:29
We present a negative result of fuzzy extractors with computational security. Specifically, we show that, under a certain computational condition, the existence of a computational fuzzy extractor implies the existence of an information-theoretic fuzzy extractor with slightly weaker parameters. The condition is that the generation procedure of the fuzzy extractor is efficiently invertible by an injective function. Our result implies that to circumvent the limitations of information-theoretic fuzzy extractors, we need to employ computational fuzzy extractors that are not invertible by injective functions.

### MathCoin: A Blockchain Proposal that Helps Verify Mathematical Theorems In Public

Wed, 03/14/2018 - 17:06
A public blockchain is proposed in an attempt to enable the coin holders to participate in verifying mathematical theorems for public access. Incentives are designed to encourage any party to contribute their knowledge by buying tokens of mathematical propositions that they believe are true. The proposed blockchain is a platform for people to exchange their belief in mathematical propositions. An implementation of this blockchain proposal, once established, will provide the general public an easy and instant access to reliable knowledge without having to read difficult proofs or having to blindly trust a small number of experts. Conversely, experts from various fields may find it be much easier for making their work appreciated by more people, leading to a better impact. According to the incentive inherently provided by the blockchain, they can even earn significantly if they do prove some theorems that were not previously known by the blockchain. Foundations who are interested in the validity of a particular proposition not yet explicitly recorded on the blockchain can donate a fund, which will distribute to experts who contribute positive efforts toward solving the specified problems. Only the people who erroneously create or buy tokens of a proposition that is eventually proven false will lose money. A reference design of the proposed blockchain that attempts to achieve the above-mentioned goal is described and reasoned.

### A Brief Retrospective Look at the Cayley-Purser Public-key Cryptosystem, 19 Years Later

Wed, 03/14/2018 - 17:06
The purpose of this paper is to describe and analyze the Cayley-Purser algorithm, which is a public-key cryptosystem proposed by Flannery in 1999. I will present two attacks on it, one of which is apparently new. I will also examine a variant of the Cayley-Purser algorithm that was patented by Slavin in 2008, and show that it is also insecure.

### Vault: Fast Bootstrapping for Cryptocurrencies

Tue, 03/13/2018 - 15:53
Decentralized cryptocurrencies rely on participants to keep track of the state of the system in order to verify new transactions. As the number of users and transactions grows, this requirement places a significant burden on the users, as they need to download, verify, and store a large amount of data in order to participate. Vault is a new cryptocurrency designed to minimize these storage and bootstrapping costs for participants. Vault builds on Algorand’s proof-of-stake consensus protocol and uses several techniques to achieve its goals. First, Vault decouples the storage of recent transactions from the storage of account balances, which enables Vault to delete old account state. Second, Vault allows sharding state across participants in a way that preserves strong security guarantees. Finally, Vault introduces the notion of stamping certificates that allow a new client to catch up securely and efficiently in a proof-of-stake system without having to verify every single block. Experiments with a prototype implementation of Vault’s data structures shows that Vault reduces the bandwidth cost of joining the network as a full client by 99.7% compared to Bitcoin and 90.5% compared to Ethereum when downloading a ledger containing 500 million transactions.

### Oblivious RAM with Small Storage Overhead

Tue, 03/13/2018 - 15:52
In this work, we present a new approach to constructing Oblivious RAM (ORAM). Somewhat surprisingly, and despite the large amount of research interest that ORAM has received, all existing ORAM constructions are based on a handful of conceptually different approaches. We believe it is of theoretical and practical interest to explore new ways to construct this primitive. Our first construction is conceptually extremely simple and has a worst-case bandwidth overhead of $\mathcal{O}\left(\sqrt{N} \frac{\log{N}}{\log{\log{N}}}\right)$, where N is the number of data blocks. Our main construction, Lookahead ORAM, has a worst-case bandwidth overhead of $\mathcal{O}\left(\sqrt{N}\right)$ and an additive storage overhead of $\sqrt{2N}$, which is the smallest concrete storage overhead among all existing ORAM constructions with sublinear worst-case bandwidth overhead. A small storage overhead is particularly beneficial in outsourced storage settings, where data owners have to pay their storage provider for the amount of storage they consume. In addition to having a small storage overhead, Lookahead ORAM has perfect correctness, i.e. every operation on the ORAM data structure succeeds with probability 1 and, assuming the client stores some small stash of data locally, an online bandwidth overhead of $\mathcal{O}\left(1\right)$ without server-side computation. In comparison with prior work that has sublinear worst-case bandwidth overhead, Lookahead ORAM is asymptotically the most efficient ORAM with perfect correctness.

### Authenticated key exchange for SIDH

Tue, 03/13/2018 - 15:02
We survey authenticated key exchange (AKE) in the context of supersingular isogeny Diffie-Hellman key exchange (SIDH). We discuss different approaches to achieve authenticated key exchange, and survey the literature. We explain some challenges that arise in the SIDH setting if one wants to do a Diffie-Hellman-like'' AKE, and present several candidate authenticated key exchange protocols suitable for SIDH. We also discuss some open problems.

### Compact, Scalable, and Efficient Discrete Gaussian Samplers for Lattice-Based Cryptography

Tue, 03/13/2018 - 15:01
Lattice-based cryptography, one of the leading candidates for post-quantum security, relies heavily on discrete Gaussian samplers to provide necessary uncertainty, obfuscating computations on secret information. For reconfigurable hardware, the cumulative distribution table (CDT) scheme has previously been shown to achieve the highest throughput and the smallest resource utilisation, easily outperforming other existing samplers. However, the CDT sampler does not scale well. In fact, for large parameters, the lookup tables required are far too large to be practically implemented. This research proposes a hierarchy of multiple smaller samplers, extending the Gaussian convolution lemma to compute optimal parameters, where the individual samplers require much smaller lookup tables. A large range of parameter sets, covering encryption, signatures, and key exchange are evaluated. Hardware-optimised parameters are formulated and a practical implementation on Xilinx Artix- 7 FPGA device is realised. The proposed sampling designs demonstrate promising performance on reconfigurable hardware, even for large parameters, that were otherwise thought infeasible.

### Identification Protocols and Signature Schemes Based on Supersingular Isogeny Problems

Tue, 03/13/2018 - 15:01
We present signature schemes whose security relies on computational assumptions relating to isogeny graphs of supersingular elliptic curves. We give two schemes, both of them based on interactive identification protocols. The first identification protocol is due to De Feo, Jao and Pl{\^{u}}t. The second one, and the main contribution of the paper, makes novel use of an algorithm of Kohel-Lauter-Petit-Tignol for the quaternion version of the $\ell$-isogeny problem, for which we provide a more complete description and analysis, and is based on a more standard and potentially stronger computational problem. Both identification protocols lead to signatures that are existentially unforgeable under chosen message attacks in the random oracle model using the well-known Fiat-Shamir transform, and in the quantum random oracle model using another transform due to Unruh. A version of the first signature scheme was indepdendently published by Yoo, Azarderakhsh, Jalali, Jao and Soukharev. This is the full version of a paper published at ASIACRYPT 2017.

### Bulletproofs: Short Proofs for Confidential Transactions and More

Tue, 03/13/2018 - 03:36
We propose Bulletproofs, a new non-interactive zero-knowledge proof protocol with very short proofs and without a trusted setup; the proof size is only logarithmic in the witness size. Bulletproofs are especially well suited for efficient range proofs on committed values: they enable proving that a committed value is in a range using only $2\log_2(n)+9$ group and field elements, where $n$ is the bit length of the range. Proof generation and verification times are linear in $n$. Bulletproofs greatly improve on the linear (in $n$) sized range proofs in existing proposals for confidential transactions in Bitcoin and other cryptocurrencies. Moreover, Bulletproofs supports aggregation of range proofs, so that a party can prove that $m$ commitments lie in a given range by providing only an additive $O(\log(m))$ group elements over the length of a single proof. To aggregate proofs from multiple parties, we enable the parties to generate a single proof without revealing their inputs to each other via a simple multi-party computation (MPC) protocol for constructing Bulletproofs. This MPC protocol uses either a constant number of rounds and linear communication, or a logarithmic number of rounds and logarithmic communication. We show that verification time, while asymptotically linear, is very efficient in practice. Moreover, the verification of multiple Bulletproofs can be batched for further speed-up. Concretely, the marginal time to verify an aggregation of 16 range proofs is about the same as the time to verify 16 ECDSA signatures. Bulletproofs build on the techniques of Bootle et al. (EUROCRYPT 2016). Beyond range proofs, Bulletproofs provide short zero-knowledge proofs for general arithmetic circuits while only relying on the discrete logarithm assumption and without requiring a trusted setup. We discuss many applications that would benefit from Bulletproofs, primarily in the area of cryptocurrencies. The efficiency of Bulletproofs is particularly well suited for the distributed and trustless nature of blockchains.

### Detecting General Algebraic Manipulation Attacks

Tue, 03/13/2018 - 01:46
Algebraic manipulation detection codes are a class of error detecting codes which have found numerous applications in cryptography. In this paper we extend these codes to defeat general algebraic attacks - we call such codes general algebraic manipulation detection (GAMD) codes. Positive results are shown for the existence of GAMDs for the families of tampering functions corresponding to point additions and polynomial functions over a finite field. Compared to non-malleable codes, we demonstrate both positive and negative results regarding the existence of GAMDs for arbitrary families of tampering functions.

### Security proof for Quantum Key Recycling with noise

Mon, 03/12/2018 - 09:01
Quantum Key Recycling aims to re-use the keys employed in quantum encryption and quantum authentication schemes. We consider QKR protocols where classical information is embedded in qubit states. A partial security analysis for such protocols was done in [LS2018]. In the current paper we introduce a number of small protocol modifications and provide a security proof. Our proof is based on a computation of the statistical distance between the real quantum state of the system and a state in which the keys are completely secure. This is a non-asymptotic result. It also determines how much privacy amplification is needed as a function of the bit error rate. It turns out that less privacy amplification is needed than suggested by the min-entropy analysis in [LS2018].

### An Efficient and Secure Attribute-Based Signcryption Scheme for Smart Grid Applications

Mon, 03/12/2018 - 09:00
With regards to the development of modern power systems, Smart Grid (SG) as an intelligent generation of electricity networks has been faced with a tremendous attention. Fine-grained data sharing in SG plays a vital role in efficiently managing data flow in the SG. As these data commonly contain sensitive information, design of the secure and efficient privacy-preserving schemes for such networks with plenty of resource constrained devices is one of the most controversial issues. In this paper, we propose a secure Ciphertext-Policy Attribute-Based SignCryption (CP-ABSC) scheme which simultaneously provides the authenticity and privacy of the users by enforcing an arbitrary access control policy on encrypted data. Since the number of required pairings in the signcryption and designcryption algorithms are independent to the number of the involved attributes, the computational overhead is reduced in comparison with the existing schemes in the literature. In addition, we formally prove that the unforgeability and indistinguishability of the proposed scheme are reducible to the well-known hardness assumption of the q-Bilinear Diffie-Hellman Exponent (q-BDHE) problem. Moreover, we show that embedding a Physical Unclonable Function (PUF) in each smart meter will significantly reduce the storage overhead of the protocol and secure it against non-volatile memory attackers.

### Chimeric Ledgers: Translating and Unifying UTXO-based and Account-based Cryptocurrencies

Mon, 03/12/2018 - 08:58
Cryptocurrencies are historically divided in two broad groups with respect to the style of transactions that they accept. In the account-based style, each address is seen as an account with a balance, and transactions are transfers of value from one account to another. In the UTXO-based style, transactions inductively spend outputs generated by previous trans- actions and create new unspent outputs, and there is no intrinsic notion of account associated with an address. Each style has advantages and disadvantages. This paper formally defines: the two styles; translations that allow to simulate one style by the other; new transaction types that allow both styles of transactions to co-exist on the same ledger; and a new transaction type that combines features from both styles.

### Indifferentiability of 8-Round Feistel Networks

Mon, 03/12/2018 - 02:25
We prove that a balanced 8-round Feistel network is indifferentiable from a random permutation. This result comes on the heels of (and is part of the same body of work as) a 10-round indifferentiability result for Feistel network recently announced by the same team of authors. The current 8-round simulator achieves similar security, query complexity and runtime as the 10-round simulator and is not significantly more involved. The security of our simulator is also slightly better than the security of the 14-round simulator of Holenstein et al. for essentially the same runtime and query complexity.

### Post-Quantum Group Signatures from Symmetric Primitives

Sun, 03/11/2018 - 21:02
Group signatures are used extensively for privacy in anonymous credentials schemes and in real-world systems for hardware enclave attestation. As such, there is a strong interest in making these schemes post-quantum secure. In this paper we initiate the study of group signature schemes built only from symmetric primitives, such as hash functions and PRFs, widely regarded as the safest primitives for post-quantum security. We present two constructions in the random oracle model. The first is a group signature scheme satisfying the EPID group signature syntax and security definitions needed for private hardware attestation used in Intel’s SGX. The second achieves significantly shorter signatures for many applications, including the use case of remote hardware attestation. While our group signatures for attestation are longer than standard (nongroup) post-quantum signatures, they are short enough for applications where the data being signed is large, such as analytics on large private data sets, or streaming media to a trusted display. We evaluate several instantiations of our schemes so that the costs and benefits of these constructions are clear. Along the way we also give improvements to the zero-knowledge Merkle inclusion proofs of Derler et al. (2017).

### Deterministic Public-Key Encryption for Adaptively Chosen Plaintext Distributions

Sun, 03/11/2018 - 03:46
Bellare, Boldyreva, and O'Neill (CRYPTO '07) initiated the study of deterministic public-key encryption as an alternative in scenarios where randomized encryption has inherent drawbacks. The resulting line of research has so far guaranteed security only for adversarially-chosen plaintext distributions that are independent of the public key used by the scheme. In most scenarios, however, it is typically not realistic to assume that adversaries do not take the public key into account when attacking a scheme. We show that it is possible to guarantee meaningful security even for plaintext distributions that depend on the public key. We extend the previously proposed notions of security, allowing adversaries to adaptively choose plaintext distributions {\em after} seeing the public key, in an interactive manner. The only restrictions we make are that: (1) plaintext distributions are unpredictable (as is essential in deterministic public-key encryption), and (2) the number of plaintext distributions from which each adversary is allowed to adaptively choose is upper bounded by $2^{p}$, where $p$ can be any predetermined polynomial in the security parameter and plaintext length. For example, with $p = 0$ we capture plaintext distributions that are independent of the public key, and with $p = O(s \log s)$ we capture, in particular, all plaintext distributions that are samplable by circuits of size $s$. Within our framework we present both constructions in the random-oracle model based on any public-key encryption scheme, and constructions in the standard model based on lossy trapdoor functions (thus, based on a variety of number-theoretic assumptions). Previously known constructions heavily relied on the independence between the plaintext distributions and the public key for the purposes of randomness extraction. In our setting, however, randomness extraction becomes significantly more challenging once the plaintext distributions and the public key are no longer independent. Our approach is inspired by research on randomness extraction from seed-dependent distributions. Underlying our approach is a new generalization of a method for such randomness extraction, originally introduced by Trevisan and Vadhan (FOCS '00) and Dodis (PhD Thesis, MIT, '00).


text:
# Tension of an object hanging in an airplane

1. Oct 8, 2013

### Rubber Ducky

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

On her flight home at Thanksgiving, Margaret decides to apply the physics she has learned in PHYC1300 to measure the speed of the aircraft when it takes off. She dangles her watch from a string while the aircraft accelerates down the runway. Draw a free body diagram of the watch. Using her protractor, she notices that the string makes an angle of 22° with respect to the vertical edge of the window as the aircraft accelerates on the runway, which takes about 22 s. Estimate the takeoff speed of the aircraft.

2. Relevant equations

$\vec{F}_{net}=m\vec{a}$

$\vec{w}=-mg$

(here, $\vec{w}$ is the force of gravity)

3. The attempt at a solution

I find it difficult to draw diagrams for problems on computers, so hopefully words will suffice. I have the acceleration going to the left, and so the Cartesian axes are in the usual directions. $\vec{w}$ pulls straight down on the watch. Force of tension in the string, $\vec{T}$, points up and to the left, making the 22-degree angle with the y-axis. Breaking tension into components, I see that the x-component can be described with sine, because it is opposite the angle, and the y-component, with cosine, since it is adjacent:

$\vec{T}_{x}=-|\vec{T}|sinθ$
$\vec{T}_{y}=|\vec{T}|cosθ$

Also, since the acceleration is only in the x direction, $\vec{w}$ and $\vec{T}_{y}$ must be equal and opposite. Thus

$\vec{T}_{x}=m\vec{a}$

$-|\vec{T}|sinθ=m\vec{a}$

My goal for the moment is to find acceleration, and attempt to find speed from there. Unfortunately, you can see that I have an equation with two unknowns (mass and tension).

Last edited: Oct 8, 2013
2. Oct 8, 2013

### Staff: Mentor

This will give you a second equation that will allow you to solve for the acceleration.

3. Oct 8, 2013

### Rubber Ducky

Thanks, I'm not sure how I didn't see it, but just this little prompt helped me with the algebraic manipulation. In case anyone needs help with this sort of problem in the future:$$m=(|\vec{T}|cosθ)/g$$

$\vec{a}=(-g|\vec{T}|sinθ)/(|\vec{T}|cosθ)$
$\vec{a}=(-gsinθ)/(cosθ)$


text:
# Validity of this proof: Prove that $\cup \mathcal{F} \subseteq \cap \mathcal{G}$

Here's the question as well as my thought process:

Suppose $\mathcal{F}$ and $\mathcal{G}$ are nonempty families of sets, and every element of $\mathcal{F}$ is a subset of every element of $\mathcal{G}$. Prove that $\bigcup \mathcal{F} \subseteq \bigcap \mathcal{G}$.

$\underline{\textbf{Scratch work:}}$

Interpreting the statement "every element of $\mathcal{F}$ is a subset of every element of $\mathcal{G}$..."

$\Rightarrow \forall A \in \mathcal{F} \forall B \in \mathcal{G} (A \subseteq B)$

While the end goal $\bigcup \mathcal{F} \subseteq \bigcap \mathcal{G}$ can be read as

$\forall x (x \in \bigcup \mathcal{F} \to x \in \bigcap \mathcal{G})$

We now have as a list of givens,

• $\forall A \in \mathcal{F} \forall B \in \mathcal{G} (A \subseteq B)$

• $x \in \bigcup \mathcal{F}$

and the end goal of proving

• $x \in \bigcap \mathcal{G}$

Some of these expressions can be expanded

• $x \in \bigcap \mathcal{G} \Rightarrow \forall B (B \in \mathcal{G} \to x \in B)$

• $x \in \bigcup \mathcal{F} \Rightarrow \exists A (A \in \mathcal{F} \land x \in A)$

And we end up with a new list of givens,

• $\forall A \in \mathcal{F} \forall B \in \mathcal{G} (A \subseteq B)$

• $\exists A (A \in \mathcal{F} \land x \in A)$

• $B \in \mathcal{G}$

as well as a new goal to prove,

• $x \in B$

My final proof goes something like this:

"Suppose $B$ is an arbitrary set in $\mathcal{G}$. Suppose there is some set $A$ that is in $\mathcal{F}$ and that $x$ is an arbitrary element in that set $A$. Since every element in $\mathcal{F}$ is a subset of $\mathcal{G}$, it follows that $x$ is also an element in the arbitrary $B$ that is is $\mathcal{G}$. In other words, $x \in \bigcap \mathcal{G}$. Based on this, we can conclude that if $x \in \bigcup \mathcal{F}$ then $x \in \bigcap \mathcal{G}$. This proves $\bigcup\mathcal{F}\subseteq\bigcap\mathcal{G}$."

Does this line of thinking seem reasonable? In particular, I'm unsure about the idea that since $x$ is an element in some particular set $A$ in $\mathcal{F}$, it is then an element in every arbitrary set $B$ in $\mathcal{G}$.

I hope that this question makes sense - Working on proofs is new to me so I apologize in advance if this question seems somewhat elementary.

Thanks in advance for the help!

• sorry guys, I meant to say that "every element of $\mathcal{F}$ is a subset of $\textit{every}$ element of $\mathcal{G}$" – user268537 Jul 19 '17 at 7:01
• Yeah your argument is fine. – Ravi Jul 19 '17 at 7:05

The statement is false.

Say $\mathcal F=\{\{\{1\}\}\}$ (i.e., $\mathcal F$ has one element, and that element is $\{\{1\}\}$.

And say $\mathcal G=\{\{1\}\}$

Then, it is true that every element of $\mathcal F$ is an element of $\mathcal G$, however

$$\bigcup \mathcal F = \{\{1\}\}\neq \{1\}=\bigcap \mathcal G$$

You say

Interpreting the statement "every element of $\mathcal{F}$ is a subset of $\mathcal{G}$..." $$\Rightarrow \forall A \in \mathcal{F} \forall B \in \mathcal{G} (A \subseteq B)$$

But that logical statement would actually translate into

Every element of $\mathcal F$ is a subset of every element of $\mathcal G$.

which is a very different statement from the original "every element of $\mathcal{F}$ is a subset of $\mathcal{G}$"

After edit

Does this line of thinking seem reasonable? In particular, I'm unsure about the idea that since $x$ is an element in some particular set $A$ in $\mathcal{F}$, it is then an element in $\textit{every}$ arbitrary set $B$ in $\mathcal{G}$.

The line of thinking is reasonable, yes.

You start with an arbitrary $B\in\mathcal G$ and an arbitrary $x\in\bigcup\mathcal F$. All you know about $B$ is that it is an element of $\mathcal G$, and all you know about $x$ is that it is an element of $\bigcup \mathcal F$.

From here on, you then take a set $A\in\mathcal F$ such that $x\in A$ because you know such a set must exist. You now have a concrete $x, A$ and $B$, and you know that $A\subseteq B$ which means that $x\in B$.

Now you take a step back and remember that $x$ and $B$ were arbitrary. So, you can conclude, that whenever you have $x\in \bigcup F$ and whenever you have $B\in \mathcal G$, you also know that $x\in B$. In other words:

$$\forall x\in\bigcup \mathcal F: (\forall B\in \mathcal G: x\in B)$$

Now you just simplify that, since $(\forall B\in \mathcal G: x\in B)$ is equivalent to $(x\in\bigcap \mathcal G)$ and you get

$$\forall x\in\bigcup \mathcal F: (x\in\bigcap\mathcal G)$$

which is what you wanted to prove.

• yeah that is actually what I meant to say. sorry for the confusion – user268537 Jul 19 '17 at 7:03
• @AlexJ.Lim See my edited answer. – 5xum Jul 19 '17 at 7:11