text:
Copied to
clipboard

## G = C22×Dic6order 96 = 25·3

### Direct product of C22 and Dic6

Series: Derived Chief Lower central Upper central

 Derived series C1 — C6 — C22×Dic6
 Chief series C1 — C3 — C6 — Dic3 — C2×Dic3 — C22×Dic3 — C22×Dic6
 Lower central C3 — C6 — C22×Dic6
 Upper central C1 — C23 — C22×C4

Generators and relations for C22×Dic6
G = < a,b,c,d | a2=b2=c12=1, d2=c6, ab=ba, ac=ca, ad=da, bc=cb, bd=db, dcd-1=c-1 >

Subgroups: 258 in 156 conjugacy classes, 105 normal (9 characteristic)
C1, C2, C2, C3, C4, C4, C22, C6, C6, C2×C4, C2×C4, Q8, C23, Dic3, C12, C2×C6, C22×C4, C22×C4, C2×Q8, Dic6, C2×Dic3, C2×C12, C22×C6, C22×Q8, C2×Dic6, C22×Dic3, C22×C12, C22×Dic6
Quotients: C1, C2, C22, S3, Q8, C23, D6, C2×Q8, C24, Dic6, C22×S3, C22×Q8, C2×Dic6, S3×C23, C22×Dic6

Smallest permutation representation of C22×Dic6
Regular action on 96 points
Generators in S96
(1 56)(2 57)(3 58)(4 59)(5 60)(6 49)(7 50)(8 51)(9 52)(10 53)(11 54)(12 55)(13 70)(14 71)(15 72)(16 61)(17 62)(18 63)(19 64)(20 65)(21 66)(22 67)(23 68)(24 69)(25 93)(26 94)(27 95)(28 96)(29 85)(30 86)(31 87)(32 88)(33 89)(34 90)(35 91)(36 92)(37 79)(38 80)(39 81)(40 82)(41 83)(42 84)(43 73)(44 74)(45 75)(46 76)(47 77)(48 78)
(1 34)(2 35)(3 36)(4 25)(5 26)(6 27)(7 28)(8 29)(9 30)(10 31)(11 32)(12 33)(13 41)(14 42)(15 43)(16 44)(17 45)(18 46)(19 47)(20 48)(21 37)(22 38)(23 39)(24 40)(49 95)(50 96)(51 85)(52 86)(53 87)(54 88)(55 89)(56 90)(57 91)(58 92)(59 93)(60 94)(61 74)(62 75)(63 76)(64 77)(65 78)(66 79)(67 80)(68 81)(69 82)(70 83)(71 84)(72 73)
(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)
(1 24 7 18)(2 23 8 17)(3 22 9 16)(4 21 10 15)(5 20 11 14)(6 19 12 13)(25 37 31 43)(26 48 32 42)(27 47 33 41)(28 46 34 40)(29 45 35 39)(30 44 36 38)(49 64 55 70)(50 63 56 69)(51 62 57 68)(52 61 58 67)(53 72 59 66)(54 71 60 65)(73 93 79 87)(74 92 80 86)(75 91 81 85)(76 90 82 96)(77 89 83 95)(78 88 84 94)

G:=sub<Sym(96)| (1,56)(2,57)(3,58)(4,59)(5,60)(6,49)(7,50)(8,51)(9,52)(10,53)(11,54)(12,55)(13,70)(14,71)(15,72)(16,61)(17,62)(18,63)(19,64)(20,65)(21,66)(22,67)(23,68)(24,69)(25,93)(26,94)(27,95)(28,96)(29,85)(30,86)(31,87)(32,88)(33,89)(34,90)(35,91)(36,92)(37,79)(38,80)(39,81)(40,82)(41,83)(42,84)(43,73)(44,74)(45,75)(46,76)(47,77)(48,78), (1,34)(2,35)(3,36)(4,25)(5,26)(6,27)(7,28)(8,29)(9,30)(10,31)(11,32)(12,33)(13,41)(14,42)(15,43)(16,44)(17,45)(18,46)(19,47)(20,48)(21,37)(22,38)(23,39)(24,40)(49,95)(50,96)(51,85)(52,86)(53,87)(54,88)(55,89)(56,90)(57,91)(58,92)(59,93)(60,94)(61,74)(62,75)(63,76)(64,77)(65,78)(66,79)(67,80)(68,81)(69,82)(70,83)(71,84)(72,73), (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), (1,24,7,18)(2,23,8,17)(3,22,9,16)(4,21,10,15)(5,20,11,14)(6,19,12,13)(25,37,31,43)(26,48,32,42)(27,47,33,41)(28,46,34,40)(29,45,35,39)(30,44,36,38)(49,64,55,70)(50,63,56,69)(51,62,57,68)(52,61,58,67)(53,72,59,66)(54,71,60,65)(73,93,79,87)(74,92,80,86)(75,91,81,85)(76,90,82,96)(77,89,83,95)(78,88,84,94)>;

G:=Group( (1,56)(2,57)(3,58)(4,59)(5,60)(6,49)(7,50)(8,51)(9,52)(10,53)(11,54)(12,55)(13,70)(14,71)(15,72)(16,61)(17,62)(18,63)(19,64)(20,65)(21,66)(22,67)(23,68)(24,69)(25,93)(26,94)(27,95)(28,96)(29,85)(30,86)(31,87)(32,88)(33,89)(34,90)(35,91)(36,92)(37,79)(38,80)(39,81)(40,82)(41,83)(42,84)(43,73)(44,74)(45,75)(46,76)(47,77)(48,78), (1,34)(2,35)(3,36)(4,25)(5,26)(6,27)(7,28)(8,29)(9,30)(10,31)(11,32)(12,33)(13,41)(14,42)(15,43)(16,44)(17,45)(18,46)(19,47)(20,48)(21,37)(22,38)(23,39)(24,40)(49,95)(50,96)(51,85)(52,86)(53,87)(54,88)(55,89)(56,90)(57,91)(58,92)(59,93)(60,94)(61,74)(62,75)(63,76)(64,77)(65,78)(66,79)(67,80)(68,81)(69,82)(70,83)(71,84)(72,73), (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), (1,24,7,18)(2,23,8,17)(3,22,9,16)(4,21,10,15)(5,20,11,14)(6,19,12,13)(25,37,31,43)(26,48,32,42)(27,47,33,41)(28,46,34,40)(29,45,35,39)(30,44,36,38)(49,64,55,70)(50,63,56,69)(51,62,57,68)(52,61,58,67)(53,72,59,66)(54,71,60,65)(73,93,79,87)(74,92,80,86)(75,91,81,85)(76,90,82,96)(77,89,83,95)(78,88,84,94) );

G=PermutationGroup([[(1,56),(2,57),(3,58),(4,59),(5,60),(6,49),(7,50),(8,51),(9,52),(10,53),(11,54),(12,55),(13,70),(14,71),(15,72),(16,61),(17,62),(18,63),(19,64),(20,65),(21,66),(22,67),(23,68),(24,69),(25,93),(26,94),(27,95),(28,96),(29,85),(30,86),(31,87),(32,88),(33,89),(34,90),(35,91),(36,92),(37,79),(38,80),(39,81),(40,82),(41,83),(42,84),(43,73),(44,74),(45,75),(46,76),(47,77),(48,78)], [(1,34),(2,35),(3,36),(4,25),(5,26),(6,27),(7,28),(8,29),(9,30),(10,31),(11,32),(12,33),(13,41),(14,42),(15,43),(16,44),(17,45),(18,46),(19,47),(20,48),(21,37),(22,38),(23,39),(24,40),(49,95),(50,96),(51,85),(52,86),(53,87),(54,88),(55,89),(56,90),(57,91),(58,92),(59,93),(60,94),(61,74),(62,75),(63,76),(64,77),(65,78),(66,79),(67,80),(68,81),(69,82),(70,83),(71,84),(72,73)], [(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)], [(1,24,7,18),(2,23,8,17),(3,22,9,16),(4,21,10,15),(5,20,11,14),(6,19,12,13),(25,37,31,43),(26,48,32,42),(27,47,33,41),(28,46,34,40),(29,45,35,39),(30,44,36,38),(49,64,55,70),(50,63,56,69),(51,62,57,68),(52,61,58,67),(53,72,59,66),(54,71,60,65),(73,93,79,87),(74,92,80,86),(75,91,81,85),(76,90,82,96),(77,89,83,95),(78,88,84,94)]])

36 conjugacy classes

 class 1 2A ··· 2G 3 4A 4B 4C 4D 4E ··· 4L 6A ··· 6G 12A ··· 12H order 1 2 ··· 2 3 4 4 4 4 4 ··· 4 6 ··· 6 12 ··· 12 size 1 1 ··· 1 2 2 2 2 2 6 ··· 6 2 ··· 2 2 ··· 2

36 irreducible representations

 dim 1 1 1 1 2 2 2 2 2 type + + + + + - + + - image C1 C2 C2 C2 S3 Q8 D6 D6 Dic6 kernel C22×Dic6 C2×Dic6 C22×Dic3 C22×C12 C22×C4 C2×C6 C2×C4 C23 C22 # reps 1 12 2 1 1 4 6 1 8

Matrix representation of C22×Dic6 in GL5(𝔽13)

 12 0 0 0 0 0 12 0 0 0 0 0 12 0 0 0 0 0 12 0 0 0 0 0 12
,
 12 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
,
 12 0 0 0 0 0 1 12 0 0 0 1 0 0 0 0 0 0 6 3 0 0 0 10 3
,
 12 0 0 0 0 0 1 12 0 0 0 0 12 0 0 0 0 0 4 2 0 0 0 11 9

G:=sub<GL(5,GF(13))| [12,0,0,0,0,0,12,0,0,0,0,0,12,0,0,0,0,0,12,0,0,0,0,0,12],[12,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],[12,0,0,0,0,0,1,1,0,0,0,12,0,0,0,0,0,0,6,10,0,0,0,3,3],[12,0,0,0,0,0,1,0,0,0,0,12,12,0,0,0,0,0,4,11,0,0,0,2,9] >;

C22×Dic6 in GAP, Magma, Sage, TeX

C_2^2\times {\rm Dic}_6
% in TeX

G:=Group("C2^2xDic6");
// GroupNames label

G:=SmallGroup(96,205);
// by ID

G=gap.SmallGroup(96,205);
# by ID

G:=PCGroup([6,-2,-2,-2,-2,-2,-3,96,579,69,2309]);
// Polycyclic

G:=Group<a,b,c,d|a^2=b^2=c^12=1,d^2=c^6,a*b=b*a,a*c=c*a,a*d=d*a,b*c=c*b,b*d=d*b,d*c*d^-1=c^-1>;
// generators/relations

׿
×
𝔽


text:
Math Help - DE Parallel to BC?

1. DE Parallel to BC?

Given triangle ABC and segment DE, if AD =2, DB =3,
AE =4 and EC =4, is DE parallel to BC?

2. This is converse of Basic Proportionality Theorem

3. Originally Posted by magentarita
Given triangle ABC and segment DE, if AD =2, DB =3,
AE =4 and EC =4, is DE parallel to BC?
See diagram.

The "Triangle Proportionality Theroem" states: If a line is parallel to one side of a triangle and intersects the other two sides in two distinct points, then it separates these sides into segments of proportional length.

So, if $\overline{DE} \parallel \overline{BC}$, then

$\frac{AD}{DB}=\frac{AE}{EC}$

$\frac{2}{3} \neq \frac{4}{4}$

Therefore, $\overline{DE} \nparallel \overline{BC}$

4. ok...

Originally Posted by masters
See diagram.

The "Triangle Proportionality Theroem" states: If a line is parallel to one side of a triangle and intersects the other two sides in two distinct points, then it separates these sides into segments of proportional length.

So, if $\overline{DE} \parallel \overline{BC}$, then

$\frac{AD}{DB}=\frac{AE}{EC}$

$\frac{2}{3} \neq \frac{4}{4}$

Therefore, $\overline{DE} \nparallel \overline{BC}$
I thank both replies. I want to thank masters for always answering my questions quickly and professionally.

format: plain


text:
# Does electric charge affect space time fabric?

I am confused with this question. Does electric charge affect the space time fabric? If so, why? Also if electric charge does not affect the space time fabric, how can we interpret the origin of the electric field around a charge?

-

The The electric field around a charge has energy, and so contributes to the gravitational field around the charge. You can see the effect in the exact solution for charged black holes, where the curvature is nonzero everywhere because of the electric charge.

$$ds^2 = - f(r) dt^2 + {1\over f(r)} dr^2 + r^2 (d\theta^2 + \sin^2\theta d\phi^2)$$

$$f(r) = 1 - {2m\over r} + {Q^2\over r^2}$$

If you set Q to zero, you get a solution of the vacuum Einstein equations, so that there is no curvature away from the singular region at $r=0$. But if you have a nonzero Q, you get curvature at all points, and this is due to the stress-energy of the electric field.

$$E = {Q\over r^2} \hat{r}$$

leads to a local energy density which is

$${Q^2\over 2 r^4}$$

outside of the black hole, and this energy density makes a contribution to the total mass. It is a negligible fraction of the mass of the black hole, unless the black hole is extremal. This happens when $m=Q$, so that the solution degenerates, and the horizon becomes AdS as opposed to Rindler. In such a limit, the electric repulsion is equal and opposite to the gravitational attraction, and two such stationary black holes just sit next to each other, neither replling nor attracting. In this limit, you can consider the entire mass of the black hole as contained in the field.

But the question is not about the effect of electricity on space, but about the geometric interpretation of electromagnetic fields. What electromagnetism is a change in the "phase space fabric", not the "metric space" fabric. When you take a particle around a loop in space, there is quantum mechanical phase from doing this, and the extra phase $\Delta \Phi$ when the particle is charged is given by:

$$\Delta\Phi = q\oint A \cdot dx$$

This is the definition of the electromagnetic gauge field, and it is the fundamental geometric description of electromagnetism. It has nothing to do with the direct geometry of space time, it has to do with an internal geometry in the shape of a circle, which is the phase of the quantum wavefunction.

In Kaluza Klein theory, this circle becomes a geometrical circle, an extra dimension in the shape of a small circle, and the interpretation of the vector potential is that it is the amount of translation you get in the little circle when you go around a loop in our ordinary 4 dimensions. The charge is then interpreted as the momentum along this circle, and in quantum mechanics, the phase acquired from translation is the same as the momentum, so this embeds electromagnetism in geometry.

But within modern theories, a gauge field is as fundamental as a metric field, and if you have enough supersymmetry requiring the gauge field to be there, you can consider the gauge field to be just as geometrical. It is not the same geometry as the geometry that explains gravity, but it is geometry nonetheless, it is the geometry of a fibre bundle (a separate space attached to the main space at every point, like the extra circle in Kaluza Klein in the limit that it is infinitesimal).

So in the modern understanding, the notion of geometry is just general enough to make any gauge field geometrical, even if it isn't directly a change in the naive thing you would call the "space-time fabric".

-
How this equation will be modified if we get too close to the charge? I mean the $1/r^2$ looks like a coulomb term, so how the quantum mechanical/QED related formula look like? –  Revo Aug 25 '12 at 1:38
@Revo: The 1/r^2 is exact in GR, tit is geometrical, since Gauss's law still holds, and r in Schwarzschild coordinates is defined by areas of spheres. This is classical, in QED, you can't really ask the question inside the compton wavelength of the charged particle, because it isn't localized in space at this length scale. But the divergence in self-energy is modified from 1/a to log(a), so the field can be thought of as smeared out not quite uniformly in such a way as to leave a log-divergence. –  Ron Maimon Aug 25 '12 at 1:55
Yeah, well, does that smearness show up in the ds equation? –  Revo Aug 25 '12 at 2:15
@Revo: You can't use a "ds" equation for quantum particles, it doesn't make sense. The particle is superposed, and so is the gravitational field. You can't use classical equations for quantum systems, you need quantum description. I didn't do any of that, and it doesn't really help understand this thing. –  Ron Maimon Aug 25 '12 at 2:39
Oh thanks. I did not know that. So it is only pure GR with no quantum effects. –  Revo Aug 25 '12 at 3:18


text:
# zbMATH — the first resource for mathematics

Flapping dynamics of a flag in a uniform stream. (English) Zbl 1124.76011
The authors consider two-dimensional flag problem in an unbounded fluid domain. The effects of Reynolds number, structure-to-fluid mass ratio, and nondimensional bending rigidity on the system stability are examined. For the case of low bending frequency, the authors study the influence of the above mass ratio on the flag flapping.
At first, the linear analysis is performed to show how the relevant non-dimensional parameters of the system influence the onset of flapping instability. The structural tension in this theoretical stability analysis is modelled as a function of Reynolds number by using boundary-layer theory, and no attempt is made to model wake effects in the linear analysis. To examine the full nonlinear flapping problem, including wake effects and variable tension in the body, the authors develop a coupled fluid-structure direct simulation (FSDS) of Navier-Stokes equations and geometrically nonlinear structural equations. A systematic series of FSDS runs is performed to understand the trends of stability and response for the flag flapping problem. The simulations corroborate the stability criteria identified in the linear analysis: the destabilizing effect of increasing structure-to-fluid mass ratio, where a lesser proportion of the inertia is convecting with the flow as added mass; and a stabilizing effect of higher bending rigidity and lower Reynolds number, both of which increase the structural restoring force. For the case of very low bending rigidity and low-to-moderate Reynolds numbers ($$Re=100 \rightarrow 5000$$), the increase in the mass ratio is found to transfer the system through three distinct regimes: (I) fixed-point stability, (II) limit-cycle flapping, and (III) chaotic flapping; each with representative wake characteristics. Parametric stability is explained with a nonlinear softening spring model. The chaotic flapping response occurs as a breaking of the limit cycle by inclusion of 3/2 superharmonic components. This occurs when the increased flapping amplitude exhibits the flapping Strouhal number $$St \simeq 0.2$$ in a neighborhood of the natural vortex wake.

##### MSC:
 76D05 Navier-Stokes equations for incompressible viscous fluids 74F10 Fluid-solid interactions (including aero- and hydro-elasticity, porosity, etc.) 74E99 Material properties given special treatment
Full Text:


text:
# zbMATH — the first resource for mathematics

A note on stability of additive mappings. (English) Zbl 0844.39012
Rassias, Themistocles M. (ed.) et al., Stability of mappings of Hyers-Ulam type. Palm Harbor, FL: Hadronic Press. 19-22 (1994).
It is known that the following theorem is valid:
Let $$E_1$$, $$E_2$$ be two real normed linear spaces and assume that $$E_2$$ is complete. Let $$f : E_1 \to E_2$$ be a mapping for which there are $$c \in [0, + \infty)$$ and $$p \in \mathbb{R} \backslash \{1\}$$ such that $\bigl |f(x + y) - f(x) - f(y) \bigr |\leq c \bigl (|x |^p + |y |^p \bigr) \tag{1}$ for $$x,y \in E_1$$. Then there exists a unique additive mapping $$T : E_1 \to E_2$$ with $\bigl |f(x) - T(x) \bigr |\leq c |2^{p - 1} - 1 |^{-1} |x |^p \tag{2}$ for every $$x \in E_1$$.
It is also known that the theorem is not true for $$p = 1$$. We show that (2) gives the best possible estimate of the difference $$|f(x) - T(x) |$$ for every $$p \in (0, + \infty)$$, $$p \neq 1$$.
For the entire collection see [Zbl 0835.00001].

##### MSC:
 39B72 Systems of functional equations and inequalities 39B52 Functional equations for functions with more general domains and/or ranges
##### Keywords:
stability; normed linear spaces; additive mapping


text:
Uncertainty Problem

Here's the problem:

A magazine publishes lateral acceleration capability from cars it tests. Measurements are made using a 150' diameter skidpad, the vehicle path deviates from the circle +/- 2 ft and the vehicle speed is read from a fifth wheel sensor measuring the system to +/- .5 mph. Then it says to estimate the experimental uncertainty if the reported lateral acceleration is .7g.

All I can think of is A=v^2/r...and some how i would have to cut the 150 diameter into 75 as a radius. I got 75 +/- .0133. then i found v = to 22.69, and you have to square that...I'm basically stumped...the answer is like 4.XX%

I did the calculation and I got 8%.

hmm well its supposedly like 4.45%, i have a feeling this has something to do with partial derivatives?

no, you dont need partial derivatives to solve it. Ill get back to you with the answer, by the way, how many feet in a mile?

5280 feet in mile

I Still cant get it, I get something liek 3.8%.

Chronos
Gold Member
See if this helps
$$A = \frac{1.226r}{t^2}$$
where
A = acceleration in g's
t = time [in seconds] to complete 1 lap
This is how g's are calculated on a skidpad
re: http://www.carcraft.com/howto/53698/index7.html

yeah but im not given any information about times

Chronos
$$A = \frac{1.226rv^2}{d^2}$$ Does that help?


text:
# Solved (Free): The following table lists midterm and final exam grades for randomly selected students in a statistics course

#### ByDr. Raju Chaudhari

Mar 15, 2021

The following table lists midterm and final exam grades for randomly selected students in a statistics course:

Midterm (x) 82 65 93 70 80
Final (y) 94 77 94 79 91

a. Plot the scatter diagram for the paired data.
b. Assume a 5% level of significance, use hypothesis testing and the linear correlation coefficient (r) to determine if there is a linear correlation. $\alpha = 0.05$.
c. Find the equation of the regression line and plot it on your scatter diagram using an x of 80 and an x of 93.
d. Determine the residual value for an x of 80and explain its meaning.

#### Solution

a. Scatter diagram

b. Let $x$ denote Midterm grades and $y$ denote Final grades.

$x$ $y$ $x^2$ $y^2$ $xy$
82 94 6724 8836 7708
65 77 4225 5929 5005
93 94 8649 8836 8742
70 79 4900 6241 5530
80 91 6400 8281 7280
390 435 30898 38123 34265

The correlation coefficient $r$ is given by
 \begin{aligned} r & = \frac{n \sum xy - (\sum x)(\sum y)}{\sqrt{\big(n(\sum x^2) -(\sum x)^2\big)\times \big(n(\sum y^2) -(\sum y)^2\big)}}\\ & = \frac{5*34265-(390)(435)}{\sqrt{\big(5*(30898)-(390)^2\big)\times\big(5*(38123)-(435)^2\big)}}\\ &= 0.919. \end{aligned}

Given that $n = 5$, $r=0.919$, $\alpha =0.05$.

State the hypothesis testing problem

The hypothesis testing problem is $H_0: \rho = 0$ against $H_a: \rho \neq 0$.

Define the test statistic

The test statistic for testing above hypothesis is

 \begin{aligned} t&=\dfrac{r\sqrt{n-2}}{\sqrt{1-r^2}}\\ &=\frac{0.919\sqrt{5 -2}}{\sqrt{1-0.919^2}}\\ &=4.037 \end{aligned}

The test statistic $t$ follows Students' $t$ distribution with $n-2=5-2 =3$ degrees of freedom.

The level of significance is $\alpha = 0.05$.

Determine the critical values
For the specified value of $\alpha$ determine the critical region.

 \begin{aligned} P(t < t_{1-\alpha/2,n-2} \text{ or } t > t_{\alpha/2,n-2}) = \alpha. \end{aligned}

The critical values are $t_{\alpha/2,n-2}=-3.182$ and $t_{1-\alpha/2,n-2}=3.182$.

Decision

As the observed value of test statistic $t$ falls inside the critical region, we reject the null hypothesis.

We conclude that there is a linear correlation between Midterm and Final grades.

c. The slope $b_1$ is given by

 \begin{aligned} b_1 & = \frac{n \sum xy - (\sum x)(\sum y)}{n(\sum x^2) -(\sum x)^2}\\ & = \frac{5*34265-(390)(435)}{5*(30898)-(390)^2}\\ &= \frac{1675}{2390}\\ &= 0.7008. \end{aligned}

The estimate of intercept is

 $$b_0=\overline{y}-b_1\overline{x}=\bigg(\frac{435}{5}\bigg)-0.7008*\bigg(\frac{390}{5}\bigg).$$
The best fitted linear regression equation is
 $$\hat{y} = 32.3347+ (0.7008)*x$$

d. Estimated value for an $x$ of 80 is

 $$\hat{y}_{x=80} = 32.3347+ (0.7008)*80 = 88.402$$
The residual for an $x=80$ is

 $y-\hat{y}_{x=80} = 90-88.402 =2.598$.

The estimate of true error for Midterm score of 80 is $2.598$.


text:
GIF – Graphics Interchange Format¶

Driver short name

GIF

GDAL supports reading and writing of normal, and interlaced GIF files. Gif files always appear as having one colormapped eight bit band. GIF files have no support for georeferencing.

A GIF image with transparency will have that entry marked as having an alpha value of 0.0 (transparent). Also, the transparent value will be returned as the NoData value for the band.

If an ESRI world file exists with the .gfw, .gifw or .wld extension, it will be read and used to establish the geotransform for the image.

XMP metadata can be extracted from the file, and will be stored as XML raw content in the xml:XMP metadata domain.

Driver capabilities¶

Supports CreateCopy()

This driver supports the GDALDriver::CreateCopy() operation

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

Creation Issues¶

GIF files can only be created as 1 8bit band using the “CreateCopy” mechanism. If written from a file that is not colormapped, a default greyscale colormap is generated. Transparent GIFs are not currently supported on creation.

WORLDFILE=ON: Force the generation of an associated ESRI world file (.wld).

Interlaced (progressive) GIF files can be generated by supplying the INTERLACING=ON option on creation.

Starting with GDAL 1.7.0, GDAL’s internal GIF support is implemented based on source from the giflib 4.1.6 library (written by Gershon Elbor, Eric Raymond and Toshio Kuratomi), hence generating LZW compressed GIF.

The driver was written with the financial support of the DM Solutions Group, and CIET International.


text:
## hwk12.1 - due tues 4/23

M & W
webwork12 #1-16

Prove fact #5 about the characteristic polynomial (below)

tr(A)=sum of the eigenvalues of A

You should use facts #1 and #3 in a fashion similar to how we proved fact #4.  Please note that fact #1 is also known as Thm 7.2.5 and we did not prove it in class.  The proof given in Bretscher involves an alternate approach to the determinant (called "patterns") that we did not use in this class.  As such, you can (and should) use this fact without proof.

Another comment here.  Facts #4 and #5 are clearly true for TRIANGULAR matrices; this follows easily from Thm 7.2.2.  But we want to show that fact #4 and #5 are true for NON-TRIANGULAR matrices too.  For this, we need this more general approach using characteristic polynomials.

F
Yatzi worksheet posted below


text:
# How can I bevel the edges of a cube with geometry nodes?

I would like to use Geometry Nodes to add beveled edges to a cube, exactly (!) like the modifier Bevel would do.

I am interested in reconstructing the effect as detailed as possible.

Any ideas?

Since you're creating a new cube, it makes the problem simpler, as you can easily create a desired topology when creating a new cube (subdivision has limitations). And since you're using default profile, the problem comes down to casting a cube to a sphere...

1. First squeeze middle faces (those that are supposed to be flat and that visually are the original geometry remaining after beveling) to 0:

1. Now cast to a sphere: (shader shows distance to origin)

Reproducing the modifier in geometry nodes is trivial:

1. Finally reverse the move towards 0 offset from p. 1. This could be done by capturing the attribute before Set Position node, and saving it on geometry, but instead, let's do it all in a single node tree, with a single Set Position:

The shader below is Normal -> Vector Math: Snap to 0.999×3 to show only normals aligned with axes:

So that's it, a beveled cube. It might not seem like it, it might look more like a sphere (in fact it's almost a perfect sphere), but that's because the bevel width is very high, you can decrease it, by multiplying the last step. Normalizing the resulting shape is easy with dividing the coordinates by range...

## Spacing the edges correctly

How to ensure bevel segments of equal width? Working backwards, knowing where the vertices are going to end (on a sphere, on the diagram where the orange dotted lines $$\color{#D60}{·····}$$ and blue dashed lines $${\color{#44D}{---}}$$ meet), calculate where they have to be before normalization - that's where the green arrows $$\color{#080}{→}$$ point:

So the angle increments are constant: $$\color{#B00}{∡}α = {{45°}\over{\mathrm{resolution}-1}}$$

It's the horizontal increment that is variable and needs to be calculated. It's sine, but we don't know the ("radius") multiplier.

Positions of those arrows could be discovered with raycasting, but obviously a math solution is faster. Calculate the $$\cos(α)$$, then the reciprocal $$1\over{\cos(α)}$$ is the "radius". Let's try it:

The function works: $${1\over\cos(α)}\times\sin(α)$$ which btw is just $$\tan(α)$$ (reinventing the wheel again).

## Correct Bevel Width

Reversing the offset was stupid. After normalization the sphere's radius (and so bevel width) is $$1$$, so:

• multiply the coords by bevel %, and then offset them by (1 - bevel%)*sign to get a normalized beveled cube, then scale to the desired size;

or to allow for a cuboid:

• multiply the coords by bevel width (not percent), then offset them by (axis size - bevel width)*sign

I chose the first solution, since the question asks for a cube:

White cube is mine, black is the vanilla Bevel modifier. The z-fighting shows the edges are great, but the corners are clearly not-so-great ;)

• This is incredibly great, brilliant approach to the solution! I am very excited to see the finished answer, because it definitely deserves a star! May 21 at 15:43
• ... a gold star, and I'll polish it for you. :) May 21 at 18:23
• just....amazing Jun 16 at 19:17
• Thanks for the reward, @RobinBetts! I've been looking into improving the corners, but it seems the procedural nature of the intersection grid fill Blender does is hard to reproduce mathematically (I didn't investigate the source code, though). Jun 20 at 11:13
• @MarkusvonBroady ...that's exactly what I meant, it's really not an easy task. I have now also come to take a closer look at your solution, and still find it ingenious! I am very curious if you manage to solve the puzzle completely. ;-) Jun 20 at 22:30

An exact reconstruction would probably require studying the source code, as well as a myriad of nodes.

Therefore, there can really only be one approximation to the optimal reconstruction.

Here's how I would do it:

1. Create a cube and extrude the faces.

2. Then create another cube, in the size of your beveled edge, and apply the node Subdivision Surface.

This will give you a (relatively accurately) mesh for the corners.

However, applying Subdivision Surface also made the mesh a little smaller, so capture the size of the result and scale the mesh again to match the specified radius of the beveled edge.

Unfortunately, the node doesn't really produce a sphere either, so I additionally bring the individual points to the radius of a sphere here.

3. Then instantiate the "spheres" at the vertices of your cube and merge the previously extruded shape with these instantiated objects.

4. Finally, use the Convex Hull node, which turns the outer hull of all objects into a new mesh.

5. Since this method triangulates the mesh at the corners, I have to use the modifier Decimate to convert these triangulated faces back into quads.

Except for this last step, this produces a similar result as the modifier with Geometry Nodes only. Similar and not the same, because I did not reproduce the algorithm here, but only used similar shapes.

On the left is the result created with Geometry Nodes, on the right a cube with the Bevel modifier.

However, if you want to keep it simple, you can directly apply the node Convex Hull to the cube with the extruded faces:

• great work! +1 so we need a tris to quad and a quad to tris node, we need bevel node and a decimate node ;) May 21 at 6:42


text:
# What is the necessary and sufficient condition for abelian categories to have arbitrary direct limit?

As a beginner to learn homological algebra, I have just learned about the direct system and its direct limit.As R-mod categories have arbitrary coproducts indexed by a set, any direct system in R-mod indexed by J has direct limit which is defined as the quotient mod of the direct product. Then，there comes a further question: Since R-mod category is a special abelian category with arbitrary direct limit and not all of abelian categories have this property, what is the necessary and sufficient condition ?  And a different question is: when does a direct system in an abelian category has direct limit? A direct system in category C indexed by a quasi-ordered set J is a covariant functor from J to C.
It seems that an abelian category has arbitrary direct limit indexed by a set iff it has arbitrary coproducts. But I can't prove it. If this is right, could you give me some hints?

• It would be nice to restrict one question per post – Shailesh Oct 17 '15 at 2:31
• Well, My major point is to decide the necessary and sufficient condition. The latter one is less distressing since every finite set J has its corresponding direct limit. Owing to my region(PRC),it's hard for me to search for English texts. While ,I still get the information that an abelian category with AB3* has colimit without any proof of it. Do I need to define the so-called "quotient category"? – user12580 Oct 17 '15 at 2:46
• $R$-mod does not have arbitrary co-products, it has co-products indexed over a set. One can prove that if a category has arbitrary co-products then it has at most one morphism between any pair of objects. – Nex Oct 17 '15 at 3:05
• To be definite,you are right. I missed the part"indexed over a set". The direct system is indexed by a quasi-ordered set, and I guess it's right that an abelian category with arbitrary coproducts indexed by a set has direct limit.If so,could you give me some hints? – user12580 Oct 17 '15 at 3:12
• This question is related: mathoverflow.net/questions/112574/… – Nex Oct 17 '15 at 4:33

You are correct that every abelian category has coequalizers given by cokernels. So if the category has all small coproducts, it has all colimits (aka directed limits).

Another approach is the following: an abelian category has filtered colimits (aka filtered directed limits) iff it has all colimits.

Clearly, if it has all colimits, then it also has filtered colimits. Now let us prove the converse.

An abelian category has finite coproducts, given by direct sums. Then given a set of objects $\{A_i\}_{i\in I}$ of objects in our category, we have the coproduct as the filtered colimit of all finite coproducts of the $A_i$. Therefore, we have coproducts and coequalizers, hence all colimits.

The more interesting question is when a filtered colimit of exact sequences remains exact. This condition is part of the definition of Grothendieck categories (which also includes the existence of a generator).

• My definition of Grothendieck category includes the assumption of a generator. – Zhen Lin Oct 17 '15 at 9:15
• Thank you! I've got the solution to this problem: using coequalizers to get colimit. It's shown in this way:functor F:J-->C, with u:j-->k denoting an arrow of the index set J.The coproducts of {Fk} (with u:j-->k) and the coproducts of {Fj} (j∈J) exist by assumption.Then use these two coproducts to acquire the colimit. Is it the right way? – user12580 Oct 17 '15 at 10:23
• @Zhen Lin Yes, you are right, changed the wording. – Rachmaninoff Oct 18 '15 at 22:54


text:
# Zhurnal SVMO

Scientific Journal

ISSN 2079-6900

MVMS Journal

### Theorems of existence and sufficiency connected with local transformations of graphs for the $k$-colourability problem

#### D. V. Sirotkin1

Annotation In the paper we consider some class of replacements of subgraphs in graphs, while replacements in this class preserve $k$-colorability. One define each local transformantion from this class by a pattern – the set of partitions of a set into subsets. The paper shows that a replacing subgraph exists for any pattern, and it gives an estimation for the number of its vertices depending on size of the pattern. This is the main result of the paper, one used methods from graph theory and combinatorial analysis. Said class of replacements might be useful for creating polynomial reductions for the $k$-colorability problem. In particular, together with main result of the paper one can use it for input reduction for solving the $k$-colorability problem. $k$-colourability problem, local transformation, realization problem, Shannon function

1Dmitry V. Sirotkin, laboratory assistant, Laboratory of Theory and Practice of Decision Support Systems, National Research University Higher School of Economics (25/12 Bolshaja Pecherskaja Str., Nizhny Novgorod 603155, Russia); laboratory assistant, Department of Algebra, Geometry and Discrete Mathematics, National Research Lobachevsky University of Nizhny Novgorod (23 Gagarina avenue, Nizhny Novgorod, 603950, Russia), ORCID: http://orcid.org/ 0000-0002-2682-9867, dmitriy.v.sirotkin@gmail.com

Citation: D. V. Sirotkin, "[Theorems of existence and sufficiency connected with local transformations of graphs for the $k$-colourability problem]", Zhurnal Srednevolzhskogo matematicheskogo obshchestva,19:2 (2017) 98–104 (In Russian)


text:
# Revision history [back]

### VideoCapture from file

Hi, I'm kinda new to opencv, and cant figure out what i'm doing wrong while opening a video file with VideoCapture. I only use this simple code:

#

import cv2

cap = cv2.VideoCapture()

cap.open("Field.avi")

print cap.isOpened()

#

I tried installing k-lite's most updated codec pack, and several more. Still, I get 'False'.

Needless to say, the video is in the same folder as the py file.

The video works on the media player.

Thanks!

 2 No.2 Revision StevenPuttemans 19866 ●14 ●82 ●205 http://stevenputtemans...

### VideoCapture from file

Hi, Hi,

I'm kinda new to opencv, and cant figure out what i'm doing wrong while while opening a video file with VideoCapture. VideoCapture functionality.

I only use this simple code:

#

import cv2 cv2
cap = cv2.VideoCapture() cap.open("Field.avi") cv2.VideoCapture()
cap.open("Field.avi")
print cap.isOpened() #cap.isOpened()

I tried installing k-lite's most updated codec pack, and several more. more. Still, I get 'False'.

'False'. Needless to say, the video is in the same folder as the py file.

The video works on the media player.

Thanks!


text:
Comment
Share
Q)

# The $\lambda$ of light from the spectral emission line of sodium is $589\: nm$. Find the $KE$ at which an electron would have the same de Broglie wavelength.

$\begin {array} {1 1} (a)\;69 \times 10^{-26} J & \quad (b)\;4.31 \: neV \\ (c)\;3.78 \times 106{-28} J & \quad (d)\;2.36\: \mu\: eV \end {array}$

For the $KE,\: K$ of an electron with velocity v, we have
$K=\large\frac{1}{2}\: m_ev^2$………..(i)
$\lambda=h/m_ev$
$\Rightarrow \large\frac{v^2 = h^2 }{ \lambda^2m_e^2}$……….(ii)
$K = \large\frac{m_eh^2}{2 \lambda^2m_e} \large\frac{h^2}{2\lambda^2m_e}$...........(iii)
$=\large\frac{ (6.6 \times 10^{-34} )^2 }{[2 \times (589 \times 10^{-9} )^2 \times 9.1 \times 10^{-31} ]}$
$≈ 69 \times 10^{-26}\: J$


text:
Public Group

# Class Interaction

This topic is 3798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Say I had three classes: Battle, Monster, Skill. The monster class has attributes like Attack power and Defense as well as things like HP and XP plus a list of skills that it has. The skill class has a damage amount and then some representation of side-effects that it can impose. Side-effects are something like temporarily reducing the defense of the enemy, or raising your own attack, or a healing spell, etc etc. Damage that a certain Skill deals is based on a simple formula ATK + Damage - DEF. This game is loosely based off of Pokemon. So a battle would be something very similar to one in that series. It's turn based and on your turn you select one of your attacks. So my question is the best way to have these three classes interact?

##### Share on other sites
You don't say what would be included in the "Battle" class, but I'd wager that Battle itself wouldn't be so much of a class as a single looping function that took in two monster classes as arguments. Purely from an abstract standpoint, I'd have a set of "states" (possibly booleans) that can be set in the Monster class, so that if a skill causes, lets say, poison, then in that particular skill's function you would set the target monster's isPoisoned state to true when used.

Are you still planning code, or is any of this written yet? Also, what language are you writing this in?

##### Share on other sites
You're right about the battle class. I envision it as a sort of the game loop for the battle. I included it because maybe some of the temporary changes could go there. I'm using C++ and there isn't too much code to write until I've figured this out. I have outlined the Skill and Monster classes with what I stated in my first post however. The problem with states is say I had two skills. Scare and SuperScare that both lowered the attack of the enemy. These are essentially the same skill with SuperScare lowering the attack even more. States wouldn't be a great choice for this and instead a variable containing the amount the attack has been lowered would be a better choice.

This is one of the ways I have thought about implementing the interaction. I could have the Monster class contain a second variable for each of its attributes that is the current change. And the beginning or end of a battle these are reset. The main problem I have is where to have these variables be set. Is it the skill that changes them? The other Monster? I could try something like Skill::doIt(Attacker, Defender). But that's lots of accessors being called and lots of functions that have to be written (even if they're very small).

##### Share on other sites
As for temporary effects:

// something like this?template <class T>class Attribute{public:	// Constructor	Attribute (T value = T()) m_Initial (value), m_Effective (value) { }	// Sets the initial value (retains the effective offset)	void SetInitial (T value) {		T delta = m_Initial - m_Effective;		m_Initial = value;		m_Effective = delta + m_Initial;	}	// Gets the initial value	T GetInitial (void) {		return m_Initial;	}	// Adds an effect to the current value	void AddEffect (T effect) {		m_Effective += effect;	}	// Removes an effect on the current value	void RemoveEffect (T effect) {		m_Effective -= effect;	}	// Gets the effective value (assuming all effects are monitored)	T Get (void) {		return m_Effective;	}private:	T m_Effective;	T m_Initial;};int main (){	Attribute<int> defense (100);	// when you strike a monster with a spell it reduces its defense for 2 seconds	defense .AddEffect (-40);		// ... wait 2 seconds in your loop then remove the effect	defense .RemoveEffect (-40);}

This is a fast way of doing attribute effects though its probably not that robust.

##### Share on other sites
I never would've thought about moving an attribute into it's own class to have all the functions there. That's a pretty good idea.

However, that only solves the problem of writing lots of functions, unless I make the attributes public I'd still have the same issues of how to get Skills to modify members of the Monster.

##### Share on other sites
Quote:
 Original post by starrulerI never would've thought about moving an attribute into it's own class to have all the functions there. That's a pretty good idea.However, that only solves the problem of writing lots of functions, unless I make the attributes public I'd still have the same issues of how to get Skills to modify members of the Monster.

One idea?
class Character{protected:	std::map <std::string, Attribute <int>> m_Skills;	std::map <std::string, Weapon*> m_Weapons;public:	// Constructor	Character (void) {		m_Skills["health"].SetInitial (100);		m_Skills["attack"].SetInitial (50);		m_Skills["defense"].SetInitial (50);		m_Skills["magic"].SetInitial (50);	}	// Get an attribute	Attribute <int>& GetSkill (const char* skillname)	{		return m_Skills[skillname];	}};// monster derivationclass Monster : public Character{public:	Monster () {		m_Weapons["axe"] = new AxeWeapon();		m_Skills["attack"].SetInitial (75);		m_Skills["defense"].SetInitial (45);		m_Skills["axe"].SetInitial (10);	}};int main (){	Character* monster = new Monster();	monster->GetSkill ("health").AddEffect (-20);	delete monster;}

##### Share on other sites
While that class would provide the ability to modify all the attributes, like attack power, or defense rating. But my skills are like certain kinds of attacks that the monster can use, say, scratch or tackle.

A user selects the attack by some means and then the attack is imposed on the enemy creature, or in some cases our own creature as well. This would occur if the skill increased the attack power of its user. I'm wondering about how to achieve this in a manner that is "good". Not something that smells of a hack. A lot of the ideas I've come up with that smell that way.

##### Share on other sites
Quote:
 Original post by starrulerSay I had three classes: Battle, Monster, Skill. [...]So my question is the best way to have these three classes interact?

Battle should contain the algorithm. That algorithm can call methods on the Monsters and Skills to gather data, calculate the results, and then apply them to the Monsters.

Quote:
 ...how to get Skills to modify members of the Monster

The Battle class queries the Skill for the relevant values, then applies them to the Monster in question. Each skill can return a list of side-effects to apply to the user and a list to apply to the victim.

Having a generic representation for these side-effects is probably crucial if this code is to be short and simple. If you draw up a list of all your attributes, give them unique names or IDs, then applying a side-effect is typically as easy as "applySideEffect(attributeId, amount, duration)". Call that once on the Monster in question for every side-effect returned from the Skill.

##### Share on other sites
So something sort of like what thre3Dee drew up. I like his idea of having the temporary value encapsulated, it makes the Monster class much cleaner.

Do you think that having the attributes in a map is a good idea? Or using an enum for the AttributeType.

Here's what I'm seeing:
The user somehow tells the battle which skill they would like to use. The battle calls a function UseSkill(name) that takes care of maybe lowering MP on the attacking monster. The battle queries the two monsters for relevant attack and defense values and calculates the damage it deals to the defender. It then calls getSideEffects on the skill which returns a list of some generic representation of a sideEffect ( Maybe it has which monster to affect, which attribute, and the amount ). I like how that sounds.

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633410
• Total Posts
3011726
• ### Who's Online (See full list)

There are no registered users currently online

×


text:
Ma5termind's Birthday Party
/

## Basic Programming, Mathematics, Primality test, Sieve

Problem
Editorial
Analytics

Ma5termind is having his birthday this weekend. Yeah !! You all are invited . Ma5termind wants to send an invitation to those groups of people which he finds interesting. A group of N people is said to be interesting only if the number of their possible circular permutations is divisible by N. Now, Ma5termind got confused as he is having all the groups having number of people belongs to [L,R] (both inclusive). Help him in find the minimum number of invitation cards required and win yourself a chance to attend Ma5termind's birthday party .

[INPUT:]

First line of the input contains a single integer T denoting the number of test cases. First and the only line of each test case consists of two space separated integers L and R denoting the range such that N belongs to [L,R] (both inclusive).

[OUTPUT:]

Output consists of T lines each containing the answer to the corresponding test case denoting the minimum number of invitation cards required by the Ma5termind.

[CONSTRAINTS:]

T<=10^6

1<=L<=R<=10^6

SAMPLE INPUT
1
10 15

SAMPLE OUTPUT
4

Explanation

For all 'n' belongs to the set {10,12,14,15} people . Group is interesting so, ma5termind will require 4 invitation cards in all.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

## This Problem was Asked in

Initializing Code Editor...


text:
# Partial derivative of a multiclass linear classifier

I'm currently looking at the equation for a multiclass classifier of the form

$$\sum\limits_{i=1}^{N_I} \sum\limits_{k=1,\atop k \neq y_i}^{N_K} L(1+ \mathbf{w_k}\cdot\mathbf{x_i}-\mathbf{w_{y_i}}\cdot\mathbf{x_i})$$

where
$X$ is a $N_K \times N_F$ data matrix
$y$ is a vector of class labels
$W$ is an $N_K \times N_I$ matrix where each corresponds to the weights for the hyperplane splitting one class from the rest
$L$ is some arbitrary loss function returning a real number eg square loss, absolute, hinge etc

I've been told that an answer for the above equation looks like

$$\partial_{w_k} = \sum\limits_{i=1 \atop y_i \neq k}^{N_I} \ L'(1+ \mathbf{w_k}\cdot\mathbf{x_i}-\mathbf{w_{y_i}}\cdot\mathbf{x_i})\cdot\mathbf{x_i} - \sum\limits_{i=1 \atop y_i =k}^{N_I} \sum\limits_{l=1,\atop l \neq k}^{N_K} L'(1+ \mathbf{w_k}\cdot\mathbf{x_i}-\mathbf{w_{y_i}}\cdot\mathbf{x_i})\cdot\mathbf{x_i}$$ Where $L'$ is the derivative of the loss function

This answer doesn't make sense to me. Where does the second summation ($\sum\limits_{i=1 \atop y_i =k}^{N_I} \sum\limits_{l=1,\atop l \neq k}^{N_K} )$ come from? After all, in the initial equation, when $i$ is such that $y_i=k$, we skip over it. How then does this case have a large impact on the partial derivative? When I've attempted to do this myself, I've gotten the first part of the derivative but not the second.

-
You remembered to apply the chain rule, didn't you? –  Guess who it is. Dec 1 '10 at 23:57
Yes. Thats why the x_i appears at the end of the first summation –  brcs Dec 2 '10 at 3:18


text:
This tutorial classifies movie reviews as positive or negative using the text of the review. This is an example of binary — or two-class — classification, an important and widely applicable kind of machine learning problem.

We’ll use the IMDB dataset that contains the text of 50,000 movie reviews from the Internet Movie Database. These are split into 25,000 reviews for training and 25,000 reviews for testing. The training and testing sets are balanced, meaning they contain an equal number of positive and negative reviews.

Let’s start and load Keras, as well as a few other required libraries.

library(keras)
library(dplyr)
library(ggplot2)
library(purrr)

The IMDB dataset comes packaged with Keras. It has already been preprocessed such that the reviews (sequences of words) have been converted to sequences of integers, where each integer represents a specific word in a dictionary.

imdb <- dataset_imdb(num_words = 10000)

c(train_data, train_labels) %<-% imdb$train c(test_data, test_labels) %<-% imdb$test

The argument num_words = 10000 keeps the top 10,000 most frequently occurring words in the training data. The rare words are discarded to keep the size of the data manageable.

Conveniently, the dataset comes with an index mapping words to integers, which has to be downloaded separately:

word_index <- dataset_imdb_word_index()

## Explore the data

Let’s take a moment to understand the format of the data. The dataset comes preprocessed: each example is an array of integers representing the words of the movie review. Each label is an integer value of either 0 or 1, where 0 is a negative review, and 1 is a positive review.

paste0("Training entries: ", length(train_data), ", labels: ", length(train_labels))
[1] "Training entries: 25000, labels: 25000"

The texts of the reviews have been converted to integers, where each integer represents a specific word in a dictionary. Here’s what the first review looks like:

train_data[[1]]
  [1]    1   14   22   16   43  530  973 1622 1385   65  458 4468   66 3941    4  173
[17]   36  256    5   25  100   43  838  112   50  670    2    9   35  480  284    5
[33]  150    4  172  112  167    2  336  385   39    4  172 4536 1111   17  546   38
[49]   13  447    4  192   50   16    6  147 2025   19   14   22    4 1920 4613  469
[65]    4   22   71   87   12   16   43  530   38   76   15   13 1247    4   22   17
[81]  515   17   12   16  626   18    2    5   62  386   12    8  316    8  106    5
[97]    4 2223 5244   16  480   66 3785   33    4  130   12   16   38  619    5   25
[113]  124   51   36  135   48   25 1415   33    6   22   12  215   28   77   52    5
[129]   14  407   16   82    2    8    4  107  117 5952   15  256    4    2    7 3766
[145]    5  723   36   71   43  530  476   26  400  317   46    7    4    2 1029   13
[161]  104   88    4  381   15  297   98   32 2071   56   26  141    6  194 7486   18
[177]    4  226   22   21  134  476   26  480    5  144   30 5535   18   51   36   28
[193]  224   92   25  104    4  226   65   16   38 1334   88   12   16  283    5   16
[209] 4472  113  103   32   15   16 5345   19  178   32

Movie reviews may be different lengths. The below code shows the number of words in the first and second reviews. Since inputs to a neural network must be the same length, we’ll need to resolve this later.

length(train_data[[1]])
length(train_data[[2]])
[1] 218
[1] 189

#### Convert the integers back to words

It may be useful to know how to convert integers back to text. We already have the word_index we downloaded above — a list with words as keys and integers as values. If we create a data frame from it, we can conveniently use it in both directions.

word_index_df <- data.frame(
word = names(word_index),
idx = unlist(word_index, use.names = FALSE),
stringsAsFactors = FALSE
)

# The first indices are reserved
word_index_df <- word_index_df %>% mutate(idx = idx + 3)
word_index_df <- word_index_df %>%
add_row(word = "<START>", idx = 1)%>%
add_row(word = "<UNK>", idx = 2)%>%
add_row(word = "<UNUSED>", idx = 3)

word_index_df <- word_index_df %>% arrange(idx)

decode_review <- function(text){
paste(map(text, function(number) word_index_df %>%
filter(idx == number) %>%
select(word) %>%
pull()),
collapse = " ")
}

Now we can use the decode_review function to display the text for the first review:

decode_review(train_data[[1]])
[1] "<START> this film was just brilliant casting location scenery story direction
everyone's really suited the part they played and you could just imagine being there
robert <UNK> is an amazing actor and now the same being director <UNK> father came from
the same scottish island as myself so i loved the fact there was a real connection with
this film the witty remarks throughout the film were great it was just brilliant so much
that i bought the film as soon as it was released for <UNK> and would recommend it to
everyone to watch and the fly fishing was amazing really cried at the end it was so sad
and you know what they say if you cry at a film it must have been good and this
definitely was also <UNK> to the two little boy's that played the <UNK> of norman and
paul they were just brilliant children are often left out of the <UNK> list i think
because the stars that play them all grown up are such a big profile for the whole film
but these children are amazing and should be praised for what they have done don't you
think the whole story was so lovely because it was true and was someone's life after all
that was shared with us all"

## Prepare the data

The reviews — the arrays of integers — must be converted to tensors before fed into the neural network. This conversion can be done a couple of ways:

• One-hot-encode the arrays to convert them into vectors of 0s and 1s. For example, the sequence [3, 5] would become a 10,000-dimensional vector that is all zeros except for indices 3 and 5, which are ones. Then, make this the first layer in our network — a dense layer — that can handle floating point vector data. This approach is memory intensive, though, requiring a num_words * num_reviews size matrix.

• Alternatively, we can pad the arrays so they all have the same length, then create an integer tensor of shape num_examples * max_length. We can use an embedding layer capable of handling this shape as the first layer in our network.

In this tutorial, we will use the second approach.

Since the movie reviews must be the same length, we will use the pad_sequences function to standardize the lengths:

train_data <- pad_sequences(
train_data,
value = word_index_df %>% filter(word == "<PAD>") %>% select(idx) %>% pull(),
maxlen = 256
)

test_data,
value = word_index_df %>% filter(word == "<PAD>") %>% select(idx) %>% pull(),
maxlen = 256
)

Let’s look at the length of the examples now:

length(train_data[1, ])
length(train_data[2, ])
[1] 256
[1] 256

And inspect the (now padded) first review:

train_data[1, ]
  [1]    1   14   22   16   43  530  973 1622 1385   65  458 4468   66 3941    4
[16]  173   36  256    5   25  100   43  838  112   50  670    2    9   35  480
[31]  284    5  150    4  172  112  167    2  336  385   39    4  172 4536 1111
[46]   17  546   38   13  447    4  192   50   16    6  147 2025   19   14   22
[61]    4 1920 4613  469    4   22   71   87   12   16   43  530   38   76   15
[76]   13 1247    4   22   17  515   17   12   16  626   18    2    5   62  386
[91]   12    8  316    8  106    5    4 2223 5244   16  480   66 3785   33    4
[106]  130   12   16   38  619    5   25  124   51   36  135   48   25 1415   33
[121]    6   22   12  215   28   77   52    5   14  407   16   82    2    8    4
[136]  107  117 5952   15  256    4    2    7 3766    5  723   36   71   43  530
[151]  476   26  400  317   46    7    4    2 1029   13  104   88    4  381   15
[166]  297   98   32 2071   56   26  141    6  194 7486   18    4  226   22   21
[181]  134  476   26  480    5  144   30 5535   18   51   36   28  224   92   25
[196]  104    4  226   65   16   38 1334   88   12   16  283    5   16 4472  113
[211]  103   32   15   16 5345   19  178   32    0    0    0    0    0    0    0
[226]    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
[241]    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
[256]    0

## Build the model

The neural network is created by stacking layers — this requires two main architectural decisions:

• How many layers to use in the model?
• How many hidden units to use for each layer?

In this example, the input data consists of an array of word-indices. The labels to predict are either 0 or 1. Let’s build a model for this problem:

# input shape is the vocabulary count used for the movie reviews (10,000 words)
vocab_size <- 10000

model <- keras_model_sequential()
model %>%
layer_embedding(input_dim = vocab_size, output_dim = 16) %>%
layer_global_average_pooling_1d() %>%
layer_dense(units = 16, activation = "relu") %>%
layer_dense(units = 1, activation = "sigmoid")

model %>% summary()
____________________________________________________________________________________
Layer (type)                         Output Shape                      Param #
====================================================================================
embedding_1 (Embedding)              (None, None, 16)                  160000
____________________________________________________________________________________
global_average_pooling1d_1 (GlobalAv (None, 16)                        0
____________________________________________________________________________________
dense_3 (Dense)                      (None, 16)                        272
____________________________________________________________________________________
dense_4 (Dense)                      (None, 1)                         17
====================================================================================
Total params: 160,289
Trainable params: 160,289
Non-trainable params: 0
____________________________________________________________________________________

The layers are stacked sequentially to build the classifier:

• The first layer is an embedding layer. This layer takes the integer-encoded vocabulary and looks up the embedding vector for each word-index. These vectors are learned as the model trains. The vectors add a dimension to the output array. The resulting dimensions are: (batch, sequence, embedding).
• Next, a global_average_pooling_1d layer returns a fixed-length output vector for each example by averaging over the sequence dimension. This allows the model to handle input of variable length, in the simplest way possible.
• This fixed-length output vector is piped through a fully-connected (dense) layer with 16 hidden units.
• The last layer is densely connected with a single output node. Using the sigmoid activation function, this value is a float between 0 and 1, representing a probability, or confidence level.

### Hidden units

The above model has two intermediate or “hidden” layers, between the input and output. The number of outputs (units, nodes, or neurons) is the dimension of the representational space for the layer. In other words, the amount of freedom the network is allowed when learning an internal representation.

If a model has more hidden units (a higher-dimensional representation space), and/or more layers, then the network can learn more complex representations. However, it makes the network more computationally expensive and may lead to learning unwanted patterns — patterns that improve performance on training data but not on the test data. This is called overfitting, and we’ll explore it later.

### Loss function and optimizer

A model needs a loss function and an optimizer for training. Since this is a binary classification problem and the model outputs a probability (a single-unit layer with a sigmoid activation), we’ll use the binary_crossentropy loss function.

This isn’t the only choice for a loss function, you could, for instance, choose mean_squared_error. But, generally, binary_crossentropy is better for dealing with probabilities — it measures the “distance” between probability distributions, or in our case, between the ground-truth distribution and the predictions.

Later, when we are exploring regression problems (say, to predict the price of a house), we will see how to use another loss function called mean squared error.

Now, configure the model to use an optimizer and a loss function:

model %>% compile(
loss = 'binary_crossentropy',
metrics = list('accuracy')
)

## Create a validation set

When training, we want to check the accuracy of the model on data it hasn’t seen before. Create a validation set by setting apart 10,000 examples from the original training data. (Why not use the testing set now? Our goal is to develop and tune our model using only the training data, then use the test data just once to evaluate our accuracy).

x_val <- train_data[1:10000, ]
partial_x_train <- train_data[10001:nrow(train_data), ]

y_val <- train_labels[1:10000]
partial_y_train <- train_labels[10001:length(train_labels)]

## Train the model

Train the model for 20 epochs in mini-batches of 512 samples. This is 20 iterations over all samples in the x_train and y_train tensors. While training, monitor the model’s loss and accuracy on the 10,000 samples from the validation set:

history <- model %>% fit(
partial_x_train,
partial_y_train,
epochs = 40,
batch_size = 512,
validation_data = list(x_val, y_val),
verbose=1
)
Train on 15000 samples, validate on 10000 samples
Epoch 1/40
15000/15000 [==============================] - 1s 56us/step - loss: 0.6916 - acc: 0.6060 - val_loss: 0.6895 - val_acc: 0.5805
Epoch 2/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.6851 - acc: 0.7123 - val_loss: 0.6804 - val_acc: 0.7446
Epoch 3/40
15000/15000 [==============================] - 0s 32us/step - loss: 0.6713 - acc: 0.7484 - val_loss: 0.6625 - val_acc: 0.7322
Epoch 4/40
15000/15000 [==============================] - 1s 33us/step - loss: 0.6454 - acc: 0.7679 - val_loss: 0.6329 - val_acc: 0.7712
Epoch 5/40
15000/15000 [==============================] - 1s 42us/step - loss: 0.6068 - acc: 0.7939 - val_loss: 0.5929 - val_acc: 0.7876
Epoch 6/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.5597 - acc: 0.8133 - val_loss: 0.5490 - val_acc: 0.8033
Epoch 7/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.5087 - acc: 0.8345 - val_loss: 0.5020 - val_acc: 0.8210
Epoch 8/40
15000/15000 [==============================] - 1s 38us/step - loss: 0.4595 - acc: 0.8512 - val_loss: 0.4601 - val_acc: 0.8369
Epoch 9/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.4154 - acc: 0.8650 - val_loss: 0.4242 - val_acc: 0.8476
Epoch 10/40
15000/15000 [==============================] - 1s 38us/step - loss: 0.3780 - acc: 0.8770 - val_loss: 0.3956 - val_acc: 0.8535
Epoch 11/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.3467 - acc: 0.8862 - val_loss: 0.3725 - val_acc: 0.8612
Epoch 12/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.3209 - acc: 0.8931 - val_loss: 0.3542 - val_acc: 0.8673
Epoch 13/40
15000/15000 [==============================] - 1s 37us/step - loss: 0.2989 - acc: 0.8989 - val_loss: 0.3414 - val_acc: 0.8662
Epoch 14/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.2800 - acc: 0.9038 - val_loss: 0.3285 - val_acc: 0.8736
Epoch 15/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.2633 - acc: 0.9090 - val_loss: 0.3189 - val_acc: 0.8759
Epoch 16/40
15000/15000 [==============================] - 1s 41us/step - loss: 0.2485 - acc: 0.9148 - val_loss: 0.3119 - val_acc: 0.8778
Epoch 17/40
15000/15000 [==============================] - 1s 33us/step - loss: 0.2355 - acc: 0.9193 - val_loss: 0.3051 - val_acc: 0.8796
Epoch 18/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.2234 - acc: 0.9233 - val_loss: 0.3004 - val_acc: 0.8801
Epoch 19/40
15000/15000 [==============================] - 1s 39us/step - loss: 0.2124 - acc: 0.9266 - val_loss: 0.2965 - val_acc: 0.8812
Epoch 20/40
15000/15000 [==============================] - 1s 35us/step - loss: 0.2021 - acc: 0.9300 - val_loss: 0.2931 - val_acc: 0.8823
Epoch 21/40
15000/15000 [==============================] - 1s 35us/step - loss: 0.1927 - acc: 0.9347 - val_loss: 0.2904 - val_acc: 0.8830
Epoch 22/40
15000/15000 [==============================] - 1s 39us/step - loss: 0.1839 - acc: 0.9395 - val_loss: 0.2886 - val_acc: 0.8840
Epoch 23/40
15000/15000 [==============================] - 1s 33us/step - loss: 0.1761 - acc: 0.9426 - val_loss: 0.2873 - val_acc: 0.8841
Epoch 24/40
15000/15000 [==============================] - 1s 35us/step - loss: 0.1690 - acc: 0.9459 - val_loss: 0.2866 - val_acc: 0.8850
Epoch 25/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.1606 - acc: 0.9497 - val_loss: 0.2864 - val_acc: 0.8845
Epoch 26/40
15000/15000 [==============================] - 1s 35us/step - loss: 0.1540 - acc: 0.9519 - val_loss: 0.2871 - val_acc: 0.8839
Epoch 27/40
15000/15000 [==============================] - 1s 38us/step - loss: 0.1475 - acc: 0.9548 - val_loss: 0.2877 - val_acc: 0.8855
Epoch 28/40
15000/15000 [==============================] - 1s 39us/step - loss: 0.1412 - acc: 0.9570 - val_loss: 0.2878 - val_acc: 0.8855
Epoch 29/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.1354 - acc: 0.9597 - val_loss: 0.2891 - val_acc: 0.8857
Epoch 30/40
15000/15000 [==============================] - 1s 39us/step - loss: 0.1299 - acc: 0.9617 - val_loss: 0.2911 - val_acc: 0.8862
Epoch 31/40
15000/15000 [==============================] - 1s 33us/step - loss: 0.1250 - acc: 0.9632 - val_loss: 0.2920 - val_acc: 0.8863
Epoch 32/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.1197 - acc: 0.9653 - val_loss: 0.2939 - val_acc: 0.8868
Epoch 33/40
15000/15000 [==============================] - 1s 37us/step - loss: 0.1150 - acc: 0.9679 - val_loss: 0.2960 - val_acc: 0.8854
Epoch 34/40
15000/15000 [==============================] - 0s 33us/step - loss: 0.1101 - acc: 0.9697 - val_loss: 0.2989 - val_acc: 0.8847
Epoch 35/40
15000/15000 [==============================] - 1s 35us/step - loss: 0.1061 - acc: 0.9702 - val_loss: 0.3026 - val_acc: 0.8857
Epoch 36/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.1021 - acc: 0.9722 - val_loss: 0.3057 - val_acc: 0.8830
Epoch 37/40
15000/15000 [==============================] - 0s 32us/step - loss: 0.0978 - acc: 0.9745 - val_loss: 0.3086 - val_acc: 0.8830
Epoch 38/40
15000/15000 [==============================] - 1s 37us/step - loss: 0.0939 - acc: 0.9762 - val_loss: 0.3110 - val_acc: 0.8825
Epoch 39/40
15000/15000 [==============================] - 1s 36us/step - loss: 0.0897 - acc: 0.9771 - val_loss: 0.3142 - val_acc: 0.8823
Epoch 40/40
15000/15000 [==============================] - 1s 34us/step - loss: 0.0861 - acc: 0.9786 - val_loss: 0.3181 - val_acc: 0.8818

## Evaluate the model

And let’s see how the model performs. Two values will be returned. Loss (a number which represents our error, lower values are better), and accuracy.

results <- model %>% evaluate(test_data, test_labels)
results
25000/25000 [==============================] - 0s 15us/step
$loss [1] 0.34057$acc
[1] 0.8696

This fairly naive approach achieves an accuracy of about 87%. With more advanced approaches, the model should get closer to 95%.

## Create a graph of accuracy and loss over time

fit returns a keras_training_history object whose metrics slot contains loss and metrics values recorded during training. You can conveniently plot the loss and metrics curves like so:

plot(history)

The evolution of loss and metrics can also be seen during training in the RStudio Viewer pane.

Notice the training loss decreases with each epoch and the training accuracy increases with each epoch. This is expected when using gradient descent optimization — it should minimize the desired quantity on every iteration.

This isn’t the case for the validation loss and accuracy — they seem to peak after about twenty epochs. This is an example of overfitting: the model performs better on the training data than it does on data it has never seen before. After this point, the model over-optimizes and learns representations specific to the training data that do not generalize to test data.

For this particular case, we could prevent overfitting by simply stopping the training after twenty or so epochs. Later, you’ll see how to do this automatically with a callback.


text:
ghc-8.4.3: The GHC API

RnTypes

Synopsis

# Documentation

Extract all wild cards from a type.

bindLRdrNames :: [Located RdrName] -> ([Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars) Source #

Simply bring a bunch of RdrNames into scope. No checking for validity, at all. The binding location is taken from the location on each name.

extractFilteredRdrTyVars :: LHsType GhcPs -> RnM FreeKiTyVarsNoDups Source #

Finds free type and kind variables in a type, without duplicates, and without variables that are already in scope in LocalRdrEnv NB: this includes named wildcards, which look like perfectly ordinary type variables at this point

extractFilteredRdrTyVarsDups :: LHsType GhcPs -> RnM FreeKiTyVarsWithDups Source #

Finds free type and kind variables in a type, with duplicates, but without variables that are already in scope in LocalRdrEnv NB: this includes named wildcards, which look like perfectly ordinary type variables at this point

extractHsTyRdrTyVars :: LHsType GhcPs -> RnM FreeKiTyVarsNoDups Source #

extractHsTyRdrTyVars finds the free (kind, type) variables of an HsType or the free (sort, kind) variables of an HsKind. It's used when making the foralls explicit. Does not return any wildcards. When the same name occurs multiple times in the types, only the first occurrence is returned. See Note [Kind and type-variable binders]

Extracts the free kind variables (but not the type variables) of an HsType. Does not return any wildcards. When the same name occurs multiple times in the type, only the first occurrence is returned. See Note [Kind and type-variable binders]

extractHsTyRdrTyVarsDups :: LHsType GhcPs -> RnM FreeKiTyVarsWithDups Source #

extractHsTyRdrTyVarsDups find the free (kind, type) variables of an HsType or the free (sort, kind) variables of an HsKind. It's used when making the foralls explicit. Does not return any wildcards. When the same name occurs multiple times in the types, all occurrences are returned.

extractHsTysRdrTyVars :: [LHsType GhcPs] -> RnM FreeKiTyVarsNoDups Source #

Extracts free type and kind variables from types in a list. When the same name occurs multiple times in the types, only the first occurrence is returned and the rest is filtered out. See Note [Kind and type-variable binders]

extractHsTysRdrTyVarsDups :: [LHsType GhcPs] -> RnM FreeKiTyVarsWithDups Source #

Extracts free type and kind variables from types in a list. When the same name occurs multiple times in the types, all occurrences are returned.

rmDupsInRdrTyVars :: FreeKiTyVarsWithDups -> FreeKiTyVarsNoDups Source #

Removes multiple occurrences of the same name from FreeKiTyVars. If a variable occurs as both a kind and a type variable, only keep the occurrence as a kind variable. See also Note [Kind and type-variable binders]