text:
# IntMath Newsletter: Graph dispute, math resources and capabilities

By Murray Bourne, 05 May 2011

5 May 2011

1. Resource: Top 10 math help sites
2. Which is the correct graph of arccot x?
3. Math tip: Learning math formulas
4. Friday math movie: OK Go This Too Shall Pass
5. Math resource: NSDL
6. Final thought: capabilities

## 0. Teacher Appreciation Week

Good teachers are vital for good learning. In many countries, sadly, the teaching profession is not all that highly regarded. One of the reasons I love living in Asia is that teachers here, on the whole, are respected and valued.

This week (2nd to 6th May) is Teacher Appreciation Week. There are many math educators who receive the IntMath Newsletter. Here's wishing you all a great week!

Hint to students: Your teachers really, really appreciate a "thank you" every now and then. This is a good week to do so. 🙂

## 1. Resource: Top 10 math help sites

Suitable for: Students, or those who sometimes get stuck with math.

 Which are the best math forums? Where can you ask for homework help? I've done the research for you. Top 10 math help sites

## 2. Which is the correct graph of arccot x?

Suitable for: Those who have studied some trigonometry- and those who enjoy a good controversy!

 Math text books and math software disagree on the correct graph of arccot(x). Which one do you think is right? Which is the correct graph of arccot x?

## 3. Math tip: Learning math formulas

Suitable for: Those who have math examinations coming up soon.

 This is one of the most popular posts from the squareCircleZ archive. It's a good one to read as exam season approaches. Read more: How to learn math formulas

## 4. Friday math movie: OK Go This Too Shall Pass

Suitable for: Everyone.

 This is an excellent video, showing how much fun you can have with physics, math and creativity. Friday math movie: OK Go This Too Shall Pass

## 5. Math resource: NSDL (National Science Digital Library)

Suitable for: Teachers

 This set of resources is aimed at addressing state standards in math Math Collection

## 6. Final thought: capabilities

Here's something to ponder from the great inventor, Thomas Edison.

If we did all the things we were capable of doing, we would literally astound ourselves. [Thomas Edison]

So please astound yourself in your next math exam! Good luck with it, from IntMath.com.

Until next time, enjoy whatever you learn.

Be the first to comment below.

### Comment Preview

HTML: You can use simple tags like <b>, <a href="...">, etc.

To enter math, you can can either:

1. Use simple calculator-like input in the following format (surround your math in backticks, or qq on tablet or phone):
a^2 = sqrt(b^2 + c^2)
(See more on ASCIIMath syntax); or
2. Use simple LaTeX in the following format. Surround your math with $$ and $$.
$$\int g dx = \sqrt{\frac{a}{b}}$$
(This is standard simple LaTeX.)

NOTE: You can mix both types of math entry in your comment.

## Subscribe

* indicates required

From Math Blogs

format: plain


text:
a, b,c are three complex numbers on the unit circle |z|=1, such th | Filo

Class 12

Math

Algebra

542
150

, , are three complex numbers on the unit circle , such that . Then is equal to

542
150

Connecting you to a tutor in 60 seconds.


text:
# How do you find the equation for a circle that passes through (2,-3) with center (1,3)?

${\left(x - 1\right)}^{2} + {\left(y - 3\right)}^{2} = 13$
Any circle with centre $\left(a , b\right)$ and radius $r = \sqrt{{x}^{2} + {y}^{2}}$ has equation ${\left(x - a\right)}^{2} + {\left(y - b\right)}^{2} = {r}^{2}$.
So in this case, $r = \sqrt{{2}^{2} + {3}^{2}} = \sqrt{13}$.
So equation is ${\left(x - 1\right)}^{2} + {\left(y - 3\right)}^{2} = 13$.


text:
#### Advances in Mathematics: Scientific Journal

Journal Information
ISSN / EISSN : 1857-8365 / 1857-8438
Total articles ≅ 1,333
Current Coverage
SCOPUS
Filter:

#### Latest articles in this journal

Published: 19 July 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2977-2998; doi:10.37418/amsj.10.7.5

Abstract:
In this paper, we present some fixed point results for a generalized class of nonexpansive mappings in the framework of uniformly convex hyperbolic space and also propose a new iterative scheme for approximating the fixed point of this class of mappings in the framework of uniformly convex hyperbolic spaces. Furthermore, we establish some basic properties and some strong and $\triangle$-convergence theorems for these mappings in uniformly convex hyperbolic spaces. Finally, we present an application to the nonlinear integral equation and also, a numerical example to illustrate our main result and then display the efficiency of the proposed algorithm compared to different iterative algorithms in the literature with different choices of parameters and initial guesses. The results obtained in this paper extends and generalizes corresponding results in uniformly convex Banach spaces, CAT(0) spaces and other related results in literature.
A. Akpolile, E. Mokobia, J. Ikubor
Published: 16 July 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2957-2976; doi:10.37418/amsj.10.7.4

Abstract:
In clinical practice, body temperature is an acclaimed indicator for diagnosis and treatments amongst other follow - ups. This work studied the temperature distribution in deep-seated tissues using Penne’s bio-heat equation (PBE). The analytical solution of the PBE was formulated using the separation of variable technique. The resulting solution gives an expression for tissue temperature in organs that are located inside the body. This revealed that the tissue temperature is subject to changes in tissue thickness, the distance of tissue from the skin surface and other thermal properties of tissues under consideration.
I. Bozorov, U. Shadiev, G. Yodgorov
Published: 10 July 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2933-2946; doi:10.37418/amsj.10.7.2

Abstract:
In this paper, we consider the four-particle Schr\"{o}dinger operator corresponding to the Hamiltonian of a system of four arbitrary quantum particles via a three-particle contact interaction potential on a three-dimensional lattice. The finiteness of the number of eigenvalues of the Schr\"{o}dinger operator lying to the left of the essential spectrum for zero value of the total quasi-momentum is proved.
Yaogan Mensah
Published: 10 July 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2947-2955; doi:10.37418/amsj.10.7.3

Abstract:
In this paper, we define Sobolev spaces on a locally compact unimodular group in link with the spherical Fourier transform of type $\delta$. Properties of these spaces are obtained. Analogues of Sobolev embedding theorems are proved.
Y. Ahmed, M. Aslam
Published: 4 July 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2919-2931; doi:10.37418/amsj.10.7.1

Abstract:
In this article, $Top(X_{n})$ is the collection of all topologies on a given set $X_{n}$ having cardinality $n$. We introduce the method to find the number of topologies of finite sets of cardinality up to $5$ by combinations and counting principles, which enable us to enumerate the classes of homeomorphic disconnected topologies as well as the connected topologies. Moreover we study the graphical aspects of the connected and disconnected topologies.
G. Sheeja, E. Rupavathi
Published: 30 June 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2909-2917; doi:10.37418/amsj.10.6.16

Abstract:
In this paper, medical diagnosis concerning isolated systolic hypertension and a study on implication operators is introduced, but fuzzy pentagonal number matrix concepts developed to give a numerical example and graphical representation are also established.
N. Zahra, M. Ibrahim
Published: 24 June 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2887-2908; doi:10.37418/amsj.10.6.15

Abstract:
The optical transpose interconnection system (OTIS) arrange has numerous application in designed for equal just as in conveyed arrange. Distinctive interconnection networks has contemplated identified with topological descriptors in [\cite{25,26}]. The present article is a contribution to Ve-degree and Ev-degree base topological indices of biswapped network with premise diagram as path and complete graph. In addition, some delicated recipes are too gotten for various kinds of topological records for the OTIS biswapped network by taking the path and complete graph on $n$ vertices as premise of diagram.
N. Faried, M.S.S. Ali, A.A. Badr
Published: 22 June 2021
Advances in Mathematics: Scientific Journal, Volume 10, pp 2865-2876; doi:10.37418/amsj.10.6.13

Abstract:
The aim of this article is to introduce the definition of the conjugate of sub $E$-functions, which plays an important role in linking the concept of duality among sub $E$-functions. Furthermore, some properties for this class are established.
In this article, the notions of $I_{2}$-localized and $I_{2}^{*}$-localized sequences in metric spaces are defined. Besides, we study some properties associated to $I_{2}$-localized and $I_{2}$-Cauchy sequences. On the other hand, we define the notion of uniformly $I_{2}$-localized sequences in metric spaces.


text:
# LaTeX help

1. Nov 19, 2006

### lo2

Hi there

I was just wondering how to type Optimatiozion of a Parametric equation, in LaTeX?

2. Nov 19, 2006

### HallsofIvy

??? If you mean the words "Optimization of Paratric equation", just use the words, not LaTex! If you mean writing the formulas for finding the optimum value of a parametric equation, it would depend on the equation.
I really don't understand what you are asking!


text:
# What needs to be done to the equation 3(x+2)=2(y+3) before you can use either method to find its intercepts?

Nov 11, 2014

Nothing needs to be done. For the $x$-intercept, plug $0$ for $y$ then solve for $x$. For the $y$-intercept, plug $0$ for $x$ then solve for $y$.

I hope that this was helpful.


text:
### Fitting distributions in R

Posted by Francesco Gadaleta on February 4, 2014

One recurrent problem that we are experiencing in the office is, as the title suggests, about fitting statistical distributions. Given data from physical experiments, or somehow related to them (such as be gene expression profiles or parameters of a gene selection method), we are spending some time to figure out the distribution that generated those data.

Well, not just a distribution. Just the best one. One naive way of doing this is, of course, to plot the data (e.g. plot the histogram) and inspect the distribution in a graphical way. For instance the R code below

dataN <- rnorm(1000, mean=3, sd= 7.5)
hist(dataN, breaks=15)

would plot a gaussian-like histogram, suggesting that the data have been indeed generated by a normal distribution.

dataP <- rpois(n=1000, lambda=4.9)
hist(dataP, breaks=15)

would plot the histogram of a poisson-like distribution, indeed. Yet another example (trying not to be annoying here) would assume that the shape of the distribution is a Gamma

dataG <- rgamma(1000, shape=1.2, scale=1.3)
hist(dataG, breaks=15)

So far so good. Once we are “sure” about the shape of the distribution, the next big step is to guess the right parameters that govern the real trends within that distribution. Therefore, in the case of a Normal distribution we should estimate the right $\mu$ and $\sigma$, or for a Poisson distribution we might need to estimate the $\lambda$ parameter.

If our assumptions are all about a Gamma distribution, then parameters $latex k$ and $latex theta$ should be estimated.

## How about the shape?

Even though it’s quite nice to see curves on the screen, the graphical way of guessing the best distribution of unknown data, is not really the most suitable one. Quantile-quantile plots are much better in that sense. It’s still a graphical technique. But much more explicit since it plots empirical quantiles and theoretical quantiles on the two axes, giving a straight line in case the two match consistently. Therefore:

qqplot(dataN, rnorm(1000, 3, 7.5), main="QQ-plot Normal")
qqplot(dataP, rpois(1000, 4.9), main="QQ-plot Poisson")
qqplot(dataG, rgamma(1000, 1.2, 1.3), main="QQ-plot Gamma")

would plot (almost) a straight line, or points aligned onto it. [caption id=”attachment_1704” align=”alignnone” width=”640”] Quantile-quantile plot of a gamma

## How about the parameters?

This is indeed the biggest deal. Statisticians know about several methods to estimate parameters of a distribution, assuming the shape has been correctly identified. One is the method of moments in which all parameters sampled directly from data will be assumed as parameters of the candidate distribution. For instance, if we assume that data have been generated from a Normal distribution, we should estimate the mean and the variance. Who better than the sample mean and sample variance could do that? An approximation would be: $% $ and $% $ that will be thrown into the normal distribution analytical form we are familiar with $% $

Another method I personally prefer is the Maximum Likelihood Estimation. Of course it relies on the assumed distribution, as the method of moments. Here is an analytical example for the Gamma distribution. The maximum likelihood estimation method consists in maximising the likelihood function which is (in general for any distribution) $% $ The MLE consists in finding the $% $ that miximises the likelihood (or equivalently its logarithmic function).

For the Gamma distribution it would be something like $% $ and the logarithmic function is $% $ As a Pig in love with Math I would keep it like that.

But my room mate, the engineer, usually dislikes that form and prefers to see it in a more “useful” way, as he claims, whenever he applies this masterpiece to real data. In R there is a function that does all that, in just one line of code

library(MASS)
fd_g <- fitdistr(dataG, "gamma")
est_shape = fd_g$estimate[[1]] est_rate = fd_g$estimate[[2]]

The estimated parameters of the assumed Gamma distribution are stored in est_shape and est_rate. I have the shape, I have the parameters. What now? The final step of any distribution fitting procedure consists in measuring how good the estimated distribution (shape and parameters) fit the data. Several possibilities are offered by mathematical statistics that usually go under the name of goodness of fit.

These measures basically match the empirical frequencies of observed data with the ones fitted by a theoretical distribution (the assumed one). The literature is offering absolute and relative measures. Two absolute measures are $% $ $% $ where $% $ and $% $ are the empirical frequencies and the theoretical ones respectively. Some relative measures are: $% $ $% $ $% $

Again, I found the engineer somewhere between disgusted and scared.

He wanted me to pull some numbers out and he translated this in R code

#assume dataP come from a Poisson distribution
emp_freq <- table(dataP)       # table of empirical frequencies
freq <- vector()               # vector of empirical frequencies
for(i in 1:length(emp_freq))
freq[i] <- emp_freq[[i]]
# vector of expected frequencies
exp_freq <- dpois(0:max(dataP), lambda=est_lambda)
gf_a <- mean(abs(freq - trunc(exp_freq)))  #absolute goodness of fit
gf_r <- gf_a/mean(freq) * 100   # relative goodness of fit

Even though hypothesis testing might reveal also the significance of the difference between the two distributions under investigation, the two measures explained above are  usually good indicators of how good (or bad) the assumed distribution is.

Next time we’ll try to put everything together and write some code that automatically selects the best in a list of distributions given as candidates.

(oo)

## Before you go

If you enjoyed this post, you will love the newsletter of Data Science at Home. It’s my FREE digest of the best content in Artificial Intelligence, data science, predictive analytics and computer science. Subscribe!


text:
# Balancing all but one weight

You have an odd number of tokens whose weights are known whole numbers, and they don't all have the same weight. Show that there's a token you can remove so that the remaining tokens can't be split into two equal-size sets that have the same total weight.

Mathier bonus questions:

• The weights are instead positive rational numbers.

• The weights are instead positive real numbers.

• Show that this doesn't necessary hold for an Abelian group, where weights are non-identity elements that are summed with the group operation.

• 1, 1, 1, 1, 3? – Lopsy Jan 15 '15 at 0:38
• @Lopsy Whoops, I forgot the condition that you must partition into two equal-size sets. Thanks for catching that. – xnor Jan 15 '15 at 0:45
• I'm confused. If I have tokens that weigh 2, 3, 4 and I remove any one of them, the remaining two tokens can't be split into equal-sized groups of the same weight... – EFrog Jan 15 '15 at 6:07
• @EFrog That's fine, the claim is there will be at least one such choice of token. – xnor Jan 15 '15 at 6:11
• Essentially the same problem (with real number weights) in Math.SE, answered: math.stackexchange.com/questions/1002267/… Comments include perhaps a simpler answer to the integer case. – JiK Jan 15 '15 at 9:35

To split it in two equal sets, the total must be even. If you start with an even total, just remove an odd weight, the total becomes odd and can't be split in two equal sets any more. If you start with an odd total, remove an even weight.

If all weights are even or all are odd, you'll need to do the following: Write down the weights in binary. Ignore the least significant bits that are equal among the weights. The operation is equivalent to subtracting a constant value of all weights and divide all weights by the same power of 2. Neither operation affects the balance since there are the same number of weights on both side. After this operation you are guaranteed to have even and odd weights and you can then apply the initial method above. Note that you don't actually change the weights, you just change the scale to measure them.

If you have rationals, you can multiply all weights by the smallest multiple of their denominators. You then have all integer weights.

• I fixed the problem by adding the condition that the split must put the same number of weights on each side. – xnor Jan 15 '15 at 0:50

Consider an arbitrary system of non-negative integer weights.

Repeat

1. If all weights are even, then divide each weight by 2.

2. If all weighst are odd, then subtract 1 from each weight.

until (at least one weight is even and at least one weight is odd)

Then remove one weight (odd or even) so that the sum of the remaining weights is odd.

• 3, 5, 7, 9, 11. According to your rules, I should subtract 1 from each to make 2, 4, 6, 8, 10. Now all are even so divide by 2. 1, 2, 3, 4, 5. If I remove the 5 weight, I can divide the remaining weights equally (2 and 3, 1 and 4). – EFrog Jan 15 '15 at 11:00
• @EFrog Then remove one weight (odd or even) so that the sum of the remaining weights is odd. it works for at least of them, but not necessarily for every one (in your case you could remove any even-weighted token). – Cthulhu Jan 15 '15 at 11:25
• @EFrog: But the claim is that you can remove some element so that the remaining tokens can't be split into two equal-size sets that have the same total weight. In your example, we would remove 4 (so that the sum of the remaining elements 1, 2, 3, 5 is odd). – Gamow Jan 15 '15 at 12:31


text:
# Integrating for logistic growth model

1. Feb 6, 2010

### Darkmisc

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

Hi, can anyone help me solve a differential equation for the logistic growth model?

2. Relevant equations

M'(t) = M(S-M) + I, where M(t) represents the growth of a biomass. "I" represents immigration (in a coral reef) and there is no breeding.

3. The attempt at a solution

I've treated it as a separable differential equation, but get the term

(integral of) 1/(M(S-M)+I) dM

A solution is possible using wolfram mathematica, but it doesn't isolate M.

I'd solve the equation using partial fractions, but the "I" term seems to make it impossible. Am I right in saying that?

Also, going back a step, can anyone explain how to use partial fractions to derive the general logistic equation. Wikipedia has a section on it: http://en.wikipedia.org/wiki/Partial_fraction

but there's a step I don't understand, namely: A=B, A=1/M, B=1/M. On what basis was this assumed?

In trying to solve it myself, I let A=0 and got B= 1/P, then let B=0 and got A=1/(M-P).

When these figures for A and B are substituted back into the original equation, I get 2/(P(M-P)) .

Can anyone explain what I'm doing wrong?

Thanks,

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

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

2. Feb 6, 2010

### LCKurtz

Say you are trying to set up this partial fraction expansion and figure out A and B:

$$\frac 1 {m(s-m)} = \frac A m+ \frac B {s-m}$$

Add the two fractions on the right to get:

$$\frac 1 {m(s-m)} = \frac {A(s-m)+Bm}{(m)(s-m)}$$

For these to be equal, the numerators must be equal:

$$1 = A(s-m)+Bm$$

If you put m = 0 you get A = 1/s and if you put m =s you get B = 1/s. So your partial fraction expansion becomes:

$$\frac 1 {m(s-m)} = \frac {\frac 1 s} m+ \frac {\frac 1 s} {s-m}$$


text:
This is “Solving Linear Equations”, section 1.7 from the book Advanced Algebra (v. 1.0). For details on it (including licensing), click here.

Has this book helped you? Consider passing it on:
Creative Commons supports free culture from music to education. Their licenses helped make this book available to you.
DonorsChoose.org helps people like you help teachers fund their classroom projects, from art supplies to books to calculators.

## 1.7 Solving Linear Equations

### Learning Objectives

1. Use the properties of equality to solve basic linear equations.
2. Identify and solve conditional linear equations, identities, and contradictions.
3. Clear fractions from equations.
4. Set up and solve linear applications.

## Solving Basic Linear Equations

An equationStatement indicating that two algebraic expressions are equal. is a statement indicating that two algebraic expressions are equal. A linear equation with one variableAn equation that can be written in the standard form $ax+b=0$, where a and b are real numbers and $a≠0.$, x, is an equation that can be written in the standard form $ax+b=0$ where a and b are real numbers and $a≠0.$ For example,

$3x−12=0$

A solutionAny value that can replace the variable in an equation to produce a true statement. to a linear equation is any value that can replace the variable to produce a true statement. The variable in the linear equation $3x−12=0$ is x and the solution is $x=4.$ To verify this, substitute the value 4 in for x and check that you obtain a true statement.

$3x−12=03(4)−12=012−12=00=0 ✓$

Alternatively, when an equation is equal to a constant, we may verify a solution by substituting the value in for the variable and showing that the result is equal to that constant. In this sense, we say that solutions “satisfy the equation.”

### Example 1

Is $a=−12$ a solution to $−10a+5=25$?

Solution:

Recall that when evaluating expressions, it is a good practice to first replace all variables with parentheses, and then substitute the appropriate values. By making use of parentheses, we avoid some common errors when working the order of operations.

$−10a+5=−10(−12)+5=5+5=10≠25 ✗$

Answer: No, $a=−12$ does not satisfy the equation.

Developing techniques for solving various algebraic equations is one of our main goals in algebra. This section reviews the basic techniques used for solving linear equations with one variable. We begin by defining equivalent equationsEquations with the same solution set. as equations with the same solution set.

$3x−5=16 3x=21 x=7} Equivalent equations$

Here we can see that the three linear equations are equivalent because they share the same solution set, namely, {7}. To obtain equivalent equations, use the following properties of equalityProperties that allow us to obtain equivalent equations by adding, subtracting, multiplying, and dividing both sides of an equation by nonzero real numbers.. Given algebraic expressions A and B, where c is a nonzero number:

 Addition property of equality: $If A=B, then A + c=B + c$ Subtraction property of equality: $If A=B, then A−c=B−c$ Multiplication property of equality: $If A=B, then cA=cB$ Division property of equality: $If A=B, then Ac=Bc$

Note: Multiplying or dividing both sides of an equation by 0 is carefully avoided. Dividing by 0 is undefined and multiplying both sides by 0 results in the equation 0 = 0.

We solve algebraic equations by isolating the variable with a coefficient of 1. If given a linear equation of the form $ax+b=c$, then we can solve it in two steps. First, use the appropriate equality property of addition or subtraction to isolate the variable term. Next, isolate the variable using the equality property of multiplication or division. Checking the solution in the following examples is left to the reader.

### Example 2

Solve: $7x−2=19.$

Solution:

$7x−2=197x−2 + 2=19 + 2 Add 2 to both sides. 7x=217x7=217 Divide both sides by 7.x=3$

### Example 3

Solve: $56=8+12y.$

Solution:

When no sign precedes the term, it is understood to be positive. In other words, think of this as $56=+8+12y.$ Therefore, we begin by subtracting 8 on both sides of the equal sign.

$56−8=8+12y−848=12y4812=12y124=y$

It does not matter on which side we choose to isolate the variable because the symmetric propertyAllows you to solve for the variable on either side of the equal sign, because $x=5$ is equivalent to $5=x.$ states that $4=y$ is equivalent to $y=4.$

### Example 4

Solve: $53x+2=−8.$

Solution:

Isolate the variable term using the addition property of equality, and then multiply both sides of the equation by the reciprocal of the coefficient $53.$

$53x+2=−853x+2−2=−8−2 Subtract 2 on both sides.53x=−1035⋅53x=35⋅(−10)−2 Multiply both sides by 35.1x=3⋅(−2)x=−6$

In summary, to retain equivalent equations, we must perform the same operation on both sides of the equation.

Try this! Solve: $23x+12=−56.$

Answer: $x=−2$

## General Guidelines for Solving Linear Equations

Typically linear equations are not given in standard form, and so solving them requires additional steps. When solving linear equations, the goal is to determine what value, if any, will produce a true statement when substituted in the original equation. Do this by isolating the variable using the following steps:

• Step 1: Simplify both sides of the equation using the order of operations and combine all like terms on the same side of the equal sign.
• Step 2: Use the appropriate properties of equality to combine like terms on opposite sides of the equal sign. The goal is to obtain the variable term on one side of the equation and the constant term on the other.
• Step 3: Divide or multiply as needed to isolate the variable.
• Step 4: Check to see if the answer solves the original equation.

We will often encounter linear equations where the expressions on each side of the equal sign can be simplified. If this is the case, then it is best to simplify each side first before solving. Normally this involves combining same-side like terms.

Note: At this point in our study of algebra the use of the properties of equality should seem routine. Therefore, displaying these steps in this text, usually in blue, becomes optional.

### Example 5

Solve: $−4a+2−a=1.$

Solution:

First combine the like terms on the left side of the equal sign.

$−4a+2−a=1 Combine same-side like terms.−5a+2=1 Subtract 2 on both sides.−5a=−1 Divide both sides by −5.a=−1−5=15$

Always use the original equation to check to see if the solution is correct.

$−4a+2−a=−4(15)+2−15=−45+21⋅55−15=−4+10+15=55=1 ✓$

Answer: The solution is $15.$

Given a linear equation in the form $ax+b=cx+d$, we begin the solving process by combining like terms on opposite sides of the equal sign. To do this, use the addition or subtraction property of equality to place like terms on the same side so that they can be combined. In the examples that remain, the check is left to the reader.

### Example 6

Solve: $−2y−3=5y+11.$

Solution:

Subtract $5y$ on both sides so that we can combine the terms involving y on the left side.

$−2y−3−5y=5y+11−5y−7y−3=11$

From here, solve using the techniques developed previously.

$−7y−3=11 Add 3 to both sides.−7y = 14y=14−7 Divide both sides by −7.y = −2$

Solving will often require the application of the distributive property.

### Example 7

Solve: $−12(10x−2)+3=7(1−2x).$

Solution:

Simplify the linear expressions on either side of the equal sign first.

$−12(10x−2)+3=7(1−2x) Distribute.−5x+1+3=7−14x Combine same-side like terms.−5x+4=7−14x Combine opposite-side like terms.9x=3 Solve.x=39=13$

Answer: The solution is $13.$

### Example 8

Solve: $5(3−a)−2(5−2a)=3.$

Solution:

Begin by applying the distributive property.

$5(3−a)−2(5−2a)=315−5a−10+4a=35−a=3−a=−2$

Here we point out that $−a$ is equivalent to $−1a$; therefore, we choose to divide both sides of the equation by −1.

$−a=−2−1a−1=−2−1a=2$

Alternatively, we can multiply both sides of $−a=−2$ by negative one and achieve the same result.

$−a=−2(−1)(−a)=(−1)(−2)a=2$

Try this! Solve: $6−3(4x−1)=4x−7.$

Answer: $x=1$

There are three different types of equations. Up to this point, we have been solving conditional equationsEquations that are true for particular values.. These are equations that are true for particular values. An identityAn equation that is true for all possible values. is an equation that is true for all possible values of the variable. For example, $x = x Identity$ has a solution set consisting of all real numbers, $ℝ.$ A contradictionAn equation that is never true and has no solution. is an equation that is never true and thus has no solutions. For example, $x + 1 = x Contradiction$ has no solution. We use the empty set, $Ø$, to indicate that there are no solutions.

If the end result of solving an equation is a true statement, like 0 = 0, then the equation is an identity and any real number is a solution. If solving results in a false statement, like 0 = 1, then the equation is a contradiction and there is no solution.

### Example 9

Solve: $4(x+5)+6=2(2x+3).$

Solution:

$4(x+5)+6=2(2x+3)4x+20+6=4x+64x+26=4x+626=6 ✗$

Solving leads to a false statement; therefore, the equation is a contradiction and there is no solution.

Answer: $Ø$

### Example 10

Solve: $3(3y+5)+5=10(y+2)−y.$

Solution:

$3(3y+5)+5=10(y+2)−y9y+15+5=10y+20−y9y+20=9y+209y=9y0=0 ✓$

Solving leads to a true statement; therefore, the equation is an identity and any real number is a solution.

Answer: $ℝ$

The coefficients of linear equations may be any real number, even decimals and fractions. When this is the case it is possible to use the multiplication property of equality to clear the fractional coefficients and obtain integer coefficients in a single step. If given fractional coefficients, then multiply both sides of the equation by the least common multiple of the denominators (LCD).

### Example 11

Solve: $13x+15=15x−1.$

Solution:

Clear the fractions by multiplying both sides by the least common multiple of the given denominators. In this case, it is the $LCD(3,5)=15.$

$15⋅(13x+15)=15⋅(15x−1) Multiply both sides by 15.15⋅13x+15⋅15=15⋅15x−15⋅1 Simplify.5x+3=3x−15 Solve.2x=−18x=−182=−9$

It is important to know that this technique only works for equations. Do not try to clear fractions when simplifying expressions. As a reminder:

Expression

Equation

$12x+53$

$12x+53=0$

We simplify expressions and solve equations. If you multiply an expression by 6, you will change the problem. However, if you multiply both sides of an equation by 6, you obtain an equivalent equation.

Incorrect

Correct

$12x+53≠6⋅(12x+53)=3x+10 ✗$

$12x+53=06⋅(12x+53)=6⋅03x+10=0 ✓$

## Applications Involving Linear Equations

Algebra simplifies the process of solving real-world problems. This is done by using letters to represent unknowns, restating problems in the form of equations, and by offering systematic techniques for solving those equations. To solve problems using algebra, first translate the wording of the problem into mathematical statements that describe the relationships between the given information and the unknowns. Usually, this translation to mathematical statements is the difficult step in the process. The key to the translation is to carefully read the problem and identify certain key words and phrases.

Key Words

Translation

Sum, increased by, more than, plus, added to, total

+

Difference, decreased by, subtracted from, less, minus

−

Product, multiplied by, of, times, twice

$⋅$

Quotient, divided by, ratio, per

$÷$

Is, total, result

=

When translating sentences into mathematical statements, be sure to read the sentence several times and parse out the key words and phrases. It is important to first identify the variable, “let x represent…” and state in words what the unknown quantity is. This step not only makes our work more readable, but also forces us to think about what we are looking for.

### Example 12

When 6 is subtracted from twice the sum of a number and 8 the result is 5. Find the number.

Solution:

Let n represent the unknown number.

To understand why we included the parentheses in the set up, you must study the structure of the following two sentences and their translations:

 “twice the sum of a number and 8” $2(n+8)$ “the sum of twice a number and 8” $2n+8$

The key was to focus on the phrase “twice the sum,” this prompted us to group the sum within parentheses and then multiply by 2. After translating the sentence into a mathematical statement we then solve.

$2(n+8)−6=52n+16−6=52n+10=52n=−5n=−52$

Check.

$2(n+8)−6=2(−52+8)−6=2(112)−6=11−6=5 ✓$

Answer: The number is $−52.$

General guidelines for setting up and solving word problems follow.

• Step 1: Read the problem several times, identify the key words and phrases, and organize the given information.
• Step 2: Identify the variables by assigning a letter or expression to the unknown quantities.
• Step 3: Translate and set up an algebraic equation that models the problem.
• Step 4: Solve the resulting algebraic equation.
• Step 5: Finally, answer the question in sentence form and make sure it makes sense (check it).

For now, set up all of your equations using only one variable. Avoid two variables by looking for a relationship between the unknowns.

### Example 13

A rectangle has a perimeter measuring 92 meters. The length is 2 meters less than 3 times the width. Find the dimensions of the rectangle.

Solution:

The sentence “The length is 2 meters less than 3 times the width,” gives us the relationship between the two variables.

Let w represent the width of the rectangle.

Let $3w−2$ represent the length.

The sentence “A rectangle has a perimeter measuring 92 meters” suggests an algebraic set up. Substitute 92 for the perimeter and the expression $3w−2$ for the length into the appropriate formula as follows:

$P=2l+2w↓ ↓92=2(3w−2)+2w$

Once you have set up an algebraic equation with one variable, solve for the width, w.

$92=2(3w−2)+2wDistribute.92=6w−4+2wCombine like terms.92=8w−4Solve for w.96=8w12=w$

Use $3w−2$ to find the length.

$l=3w−2=3(12)−2=36−2=34$

To check, make sure the perimeter is 92 meters.

$P=2l + 2w=2(34)+2(12)=68+24=92$

Answer: The rectangle measures 12 meters by 34 meters.

### Example 14

Given a $438%$ annual interest rate, how long will it take $2,500 to yield$437.50 in simple interest?

Solution:

Let t represent the time needed to earn $437.50 at $438%.$ Organize the information needed to use the formula for simple interest, $I=prt.$  Given interest for the time period: $I=437.50$ Given principal: $p=2,500$ Given rate: $r= 438%=4.375%=0.04375$ Next, substitute all of the known quantities into the formula and then solve for the only unknown, t. $I=prt437.50=2500(0.04375)t437.50=109.375t437.50109.375=109.375t109.3754=t$ Answer: It takes 4 years for$2,500 invested at $438%$ to earn $437.50 in simple interest. ### Example 15 Susan invested her total savings of$12,500 in two accounts earning simple interest. Her mutual fund account earned 7% last year and her CD earned 4.5%. If her total interest for the year was $670, how much was in each account? Solution: The relationship between the two unknowns is that they total$12,500. When a total is involved, a common technique used to avoid two variables is to represent the second unknown as the difference of the total and the first unknown.

Let x represent the amount invested in the mutual fund.

Let 12,500 − x represent the remaining amount invested in the CD.

Organize the data.

 Interest earned in the mutual fund: $I=prt=x⋅0.07⋅1=0.07x$ Interest earned in the CD: $I=prt=(12,500−x)⋅0.045⋅1=0.045(12,500−x)$ Total interest: $670$

The total interest is the sum of the interest earned from each account.

$mutual fund interest + CD interest = total interest 0.07x + 0.045(12,500−x) = 670$

This equation models the problem with one variable. Solve for x.

$0.07x+0.045(12,500−x) =6700.07x+562.5−0.045x=6700.025x+562.5=6700.025x=107.5x=107.50.025x=4,300$

Use $12,500−x$ to find the amount in the CD.

$12,500−x=12,500−4,300=8,200$

Answer: Susan invested $4,300 at 7% in a mutual fund and$8,200 at 4.5% in a CD.

### Key Takeaways

• Solving general linear equations involves isolating the variable, with coefficient 1, on one side of the equal sign. To do this, first use the appropriate equality property of addition or subtraction to isolate the variable term on one side of the equal sign. Next, isolate the variable using the equality property of multiplication or division. Finally, check to verify that your solution solves the original equation.
• If solving a linear equation leads to a true statement like 0 = 0, then the equation is an identity and the solution set consists of all real numbers, $ℝ.$
• If solving a linear equation leads to a false statement like 0 = 5, then the equation is a contradiction and there is no solution, $Ø.$
• Clear fractions by multiplying both sides of an equation by the least common multiple of all the denominators. Distribute and multiply all terms by the LCD to obtain an equivalent equation with integer coefficients.
• Simplify the process of solving real-world problems by creating mathematical models that describe the relationship between unknowns. Use algebra to solve the resulting equations.

### Part A: Solving Basic Linear Equations

Determine whether or not the given value is a solution.

1. $−5x+4=−1$;   $x=−1$

2. $4x−3=−7$;   $x=−1$

3. $3y−4=5$;   $y=93$

4. $−2y+7=12$;   $y=−52$

5. $3a−6=18−a$;   $a=−3$

6. $5(2t−1)=2−t$;   $t=2$

7. $ax−b=0$;   $x=ba$

8. $ax+b=2b$;   $x=ba$

Solve.

1. $5x−3=27$

2. $6x−7=47$

3. $4x+13=35$

4. $6x−9=18$

5. $9a+10=10$

6. $5−3a=5$

7. $−8t+5=15$

8. $−9t+12=33$

9. $23x+12=1$
10. $38x+54=32$
11. $1−3y5=2$
12. $2−5y6=−8$
13. $7−y=22$

14. $6−y=12$

15. Solve for x: $ax−b=c$

16. Solve for x: $ax+b=0$

### Part B: Solving Linear Equations

Solve.

1. $6x−5+2x=19$

2. $7−2x+9=24$

3. $12x−2−9x=5x+8$

4. $16−3x−22=8−4x$

5. $5y−6−9y=3−2y+8$

6. $7−9y+12=3y+11−11y$

7. $3+3a−11=5a−8−2a$

8. $2−3a=5a+7−8a$

9. $13x−32+52x=56x+14$

10. $58+15x−34=310x−14$

11. $1.2x−0.5−2.6x=2−2.4x$

12. $1.59−3.87x=3.48−4.1x−0.51$

13. $5−10x=2x+8−12x$

14. $8x−3−3x=5x−3$

15. $5(y+2)=3(2y−1)+10$

16. $7(y−3)=4(2y+1)−21$

17. $7−5(3t−9)=22$

18. $10−5(3t+7)=20$

19. $5−2x=4−2(x−4)$

20. $2(4x−5)+7x=5(3x−2)$

21. $4(4a−1)=5(a−3)+2(a−2)$

22. $6(2b−1)+24b=8(3b−1)$

23. $23(x+18)+2=13x−13$

24. $25x−12(6x−3)=43$

25. $1.2(2x+1)+0.6x=4x$

26. $6+0.5(7x−5)=2.5x+0.3$

27. $5(y+3)=15(y+1)−10y$

28. $3(4−y)−2(y+7)=−5y$

29. $15(2a+3)−12=13a+110$

30. $32a=34(1+2a)−15(a+5)$

31. $6−3(7x+1)=7(4−3x)$

32. $6(x−6)−3(2x−9)=−9$

33. $34(y−2)+23(2y+3)=3$

34. $54−12(4y−3)=25(y−1)$

35. $−2(3x+1)−(x−3)=−7x+1$

36. $6(2x+1)−(10x+9)=0$

37. Solve for w: $P=2l+2w$

38. Solve for a: $P=a+b+c$

39. Solve for t: $D=rt$

40. Solve for w: $V=lwh$

41. Solve for b: $A=12bh$

42. Solve for a: $s=12at2$

43. Solve for a: $A=12h(a+b)$

44. Solve for h: $V=13πr2h$

45. Solve for F: $C=59(F−32)$

46. Solve for x: $ax+b=c$

### Part C: Applications

Set up an algebraic equation then solve.

Number Problems

1. When 3 is subtracted from the sum of a number and 10 the result is 2. Find the number.

2. The sum of 3 times a number and 12 is equal to 3. Find the number.

3. Three times the sum of a number and 6 is equal to 5 times the number. Find the number.

4. Twice the sum of a number and 4 is equal to 3 times the sum of the number and 1. Find the number.

5. A larger integer is 1 more than 3 times another integer. If the sum of the integers is 57, find the integers.

6. A larger integer is 5 more than twice another integer. If the sum of the integers is 83, find the integers.

7. One integer is 3 less than twice another integer. Find the integers if their sum is 135.

8. One integer is 10 less than 4 times another integer. Find the integers if their sum is 100.

9. The sum of three consecutive integers is 339. Find the integers.

10. The sum of four consecutive integers is 130. Find the integers.

11. The sum of three consecutive even integers is 174. Find the integers.

12. The sum of four consecutive even integers is 116. Find the integers.

13. The sum of three consecutive odd integers is 81. Find the integers.

14. The sum of four consecutive odd integers is 176. Find the integers.

Geometry Problems

1. The length of a rectangle is 5 centimeters less than twice its width. If the perimeter is 134 centimeters, find the length and width.

2. The length of a rectangle is 4 centimeters more than 3 times its width. If the perimeter is 64 centimeters, find the length and width.

3. The width of a rectangle is one-half that of its length. If the perimeter measures 36 inches, find the dimensions of the rectangle.

4. The width of a rectangle is 4 inches less than its length. If the perimeter measures 72 inches, find the dimensions of the rectangle.

5. The perimeter of a square is 48 inches. Find the length of each side.

6. The perimeter of an equilateral triangle is 96 inches. Find the length of each side.

7. The circumference of a circle measures $80π$ units. Find the radius.

8. The circumference of a circle measures 25 centimeters. Find the radius rounded off to the nearest hundredth.

Simple Interest Problems

1. For how many years must $1,000 be invested at $512$% to earn$165 in simple interest?

2. For how many years must $20,000 be invested at $614$% to earn$3,125 in simple interest?

3. At what annual interest rate must $6500 be invested for 2 years to yield$1,040 in simple interest?

4. At what annual interest rate must $5,750 be invested for 1 year to yield$333.50 in simple interest?

5. If the simple interest earned for 5 years was $1,860 and the annual interest rate was 6%, what was the principal? 6. If the simple interest earned for 2 years was$543.75 and the annual interest rate was $334%$, what was the principal?

7. How many years will it take $600 to double earning simple interest at a 5% annual rate? (Hint: To double, the investment must earn$600 in simple interest.)

8. How many years will it take $10,000 to double earning simple interest at a 5% annual rate? (Hint: To double, the investment must earn$10,000 in simple interest.)

9. Jim invested $4,200 in two accounts. One account earns 3% simple interest and the other earns 6%. If the interest after 1 year was$159, how much did he invest in each account?

10. Jane has her $6,500 savings invested in two accounts. She has part of it in a CD at 5% annual interest and the rest in a savings account that earns 4% annual interest. If the simple interest earned from both accounts is$303 for the year, then how much does she have in each account?

11. Jose put last year’s bonus of $8,400 into two accounts. He invested part in a CD with 2.5% annual interest and the rest in a money market fund with 1.5% annual interest. His total interest for the year was$198. How much did he invest in each account?

12. Mary invested her total savings of $3,300 in two accounts. Her mutual fund account earned 6.2% last year and her CD earned 2.4%. If her total interest for the year was$124.80, how much was in each account?

13. Alice invests money into two accounts, one with 3% annual interest and another with 5% annual interest. She invests 3 times as much in the higher yielding account as she does in the lower yielding account. If her total interest for the year is $126, how much did she invest in each account? 14. James invested an inheritance in two separate banks. One bank offered $512$% annual interest rate and the other $614$%. He invested twice as much in the higher yielding bank account than he did in the other. If his total simple interest for 1 year was$5,760, then what was the amount of his inheritance?

Uniform Motion Problems

1. If it takes Jim $114$ hours to drive the 40 miles to work, then what is Jim’s average speed?

2. It took Jill $312$ hours to drive the 189 miles home from college. What was her average speed?

3. At what speed should Jim drive if he wishes to travel 176 miles in $234$ hours?

4. James and Martin were able to drive the 1,140 miles from Los Angeles to Seattle. If the total trip took 19 hours, then what was their average speed?

### Part D: Discussion Board

1. What is regarded as the main business of algebra? Explain.

2. What is the origin of the word algebra?

3. Create an identity or contradiction of your own and share it on the discussion board. Provide a solution and explain how you found it.

4. Post something you found particularly useful or interesting in this section. Explain why.

5. Conduct a web search for “solving linear equations.” Share a link to website or video tutorial that you think is helpful.

1. No

2. Yes

3. No

4. Yes

5. 6

6. $112$

7. 0

8. $−54$

9. $34$

10. −3

11. −15

12. $x=b+ca$

1. 3

2. −5

3. $−172$

4. $ℝ$

5. $78$

6. 2.5

7. Ø

8. 3

9. 2

10. Ø

11. $−53$

12. −81

13. 1.2

14. $ℝ$

15. 0

16. Ø

17. $65$

18. $ℝ$

19. $w=P−2l2$
20. $t=Dr$
21. $b=2Ah$
22. $a=2Ah−b$
23. $F=95C+32$
1. −5

2. 9

3. 14, 43

4. 46, 89

5. 112, 113, 114

6. 56, 58, 60

7. 25, 27, 29

8. Width: 24 centimeters; length: 43 centimeters

9. Width: 6 inches; length: 12 inches

10. 12 inches

11. 40 units

12. 3 years

13. 8%

14. $6,200 15. 20 years 16. He invested$3,100 at 3% and $1,100 at 6%. 17. Jose invested$7,200 in the CD and $1,200 in the money market fund. 18. Alice invested$700 at 3% and \$2,100 at 5%.

19. 32 miles per hour

20. 64 miles per hour


text:
# Python Program to Find majority element (Boyer–Moore Majority Vote Algorithm)

Don’t miss the chance of Java programs examples with output pdf free download as it is very essential for all beginners to experienced programmers for cracking the interviews.

Given a list, the task is to find the majority element of the given list.

Majority Element:

A majority element appears more than n/2 times, where n is the size of the array.

Boyer–Moore Majority Vote Algorithm History and Introduction:

The Boyer–Moore majority vote algorithm uses linear time and constant space to determine the majority of a series of elements. It is named after Robert S. Boyer and J Strother Moore, who published it in 1981, and is an example of a streaming algorithm.

In its most basic version, the algorithm looks for a majority element, which is an element that appears frequently for more than half of the items in the input. A version of the procedure that performs a second pass through the data can be used to confirm that the element found in the first pass is truly a majority.

If no second pass is conducted and there is no majority, the algorithm will not identify that there is no majority. In the absence of a rigorous majority, the returned element can be random; it is not guaranteed to be the most frequently occurring element (the mode of the sequence). A streaming method cannot discover the most frequent element in less than linear space for sequences with a limited number of repetitions.

## Program to Find majority element (Boyer–Moore Majority Vote Algorithm)

Below is the full approach for finding the majority element present in the given array using Boyer-Moore Majority Vote Algorithm.

### 1)Algorithm:

The algorithm takes up O(1) more space and runs in O(N) time. It takes exactly two traverses across the input list. It’s also pretty straightforward to implement, however understanding how it works is a little more difficult.

We generate a single candidate value in the first traversal, which is the majority value if there is one. To confirm, the second pass simply counts the frequency of that value. The first pass is the most interesting.

We require two values in the first pass:

A candidate value, which can be set to any value at first.
A count, which is originally set to 0.
We begin by looking at the count value for each entry in our input list. If the count is equal to zero, the candidate is set to the value at the current element. Then, compare the value of the element to the current candidate value. If they are the same, we add one to the count. If they vary, we reduce the count by one.
If a majority value exists at the end of all inputs, the candidate will be the majority value. A second O(N) traversal can be used to ensure that the candidate is the majority element.

Initialize an element ele and a counter in = 0

for each element x of the input sequence:
if in = 0, then
assign ele = x and in = 1
else
else
return ele

### 2)Implementation(Static Input)

Give the list as static input and store it in a variable.

Pass the given list to the majoElement function which accepts the given list as an argument and implement the Boyer–Moore majority vote algorithm.

It returns the majority element.

Each element of the sequence is processed one at a time by the algorithm. When working with an element x.
If the counter is zero, set the current candidate to x, and the counter to one.
If the counter is not zero, it should be incremented or decremented depending on whether x is a current contender.
If the sequence has a majority at the end of this phase, it will be the element stored by the algorithm. If there is no majority element, the algorithm will fail to detect it and may output the incorrect element. In other words, when the majority element is present in the input, the Boyer–Moore majority vote algorithm delivers proper results.

Below is the implementation:

# Function to find the majority element present in a given list
def majoElement(given_list):
# majo stores the majority element (if present in the given list)
majo = -1
# initializing counter index with 0
ind = 0
# do for each element A[j] in the list
for j in range(len(given_list)):
# check if the counter index is zero or not.
if ind == 0:
# set the current candidate of the given list to givenlist[j]
majo = given_list[j]
# change the counter index to 1.
ind = 1
# Otherwise, if givenlist[j] is a current candidate, increment the counter.
elif majo == given_list[j]:
ind = ind + 1
# Otherwise, if givenlist[j] is a current candidate, decrement the counter.
else:
ind = ind - 1
# return the majority element
return majo

# Driver Code
# Give the list as static input and store it in a variable.
given_list = [4, 11, 13, 9, 11, 11, 11, 3, 15, 28, 11, 11, 11, 11]
# Pass the given list to the majoElement function which accepts
# the given list as an argument
# and implement the Boyer–Moore majority vote algorithm.

print("The majority element present in the givenlist",
given_list, '=', majoElement(given_list))

Output:

The majority element present in the givenlist [4, 11, 13, 9, 11, 11, 11, 3, 15, 28, 11, 11, 11, 11] = 11

### 3)Implementation(User Input)

i)Integer List

Give the Integer list as user input using map(), int, split(), and list() functions.

store it in a variable.

Pass the given list to the majoElement function which accepts the given list as an argument and implement the Boyer–Moore majority vote algorithm.

It returns the majority element.

Each element of the sequence is processed one at a time by the algorithm. When working with an element x.
If the counter is zero, set the current candidate to x, and the counter to one.
If the counter is not zero, it should be incremented or decremented depending on whether x is a current contender.
If the sequence has a majority at the end of this phase, it will be the element stored by the algorithm. If there is no majority element, the algorithm will fail to detect it and may output the incorrect element. In other words, when the majority element is present in the input, the Boyer–Moore majority vote algorithm delivers proper results.

Below is the implementation:

# Function to find the majority element present in a given list
def majoElement(given_list):
# majo stores the majority element (if present in the given list)
majo = -1
# initializing counter index with 0
ind = 0
# do for each element A[j] in the list
for j in range(len(given_list)):
# check if the counter index is zero or not.
if ind == 0:
# set the current candidate of the given list to givenlist[j]
majo = given_list[j]
# change the counter index to 1.
ind = 1
# Otherwise, if givenlist[j] is a current candidate, increment the counter.
elif majo == given_list[j]:
ind = ind + 1
# Otherwise, if givenlist[j] is a current candidate, decrement the counter.
else:
ind = ind - 1
# return the majority element
return majo

# Driver Code
# Give the list as user input using map(), int, split(), and list() functions.

# store it in a variable.
given_list = list(map(int,
input('Enter some random elements of the given list separated by spaces = ').split()))
# Pass the given list to the majoElement function which accepts
# the given list as an argument
# and implement the Boyer–Moore majority vote algorithm.

print("The majority element present in the givenlist",
given_list, '=', majoElement(given_list))

Output:

Enter some random elements of the given list separated by spaces = 8 12 45 96 3 7 7 1 5 7 7 7 5
The majority element present in the givenlist [8, 12, 45, 96, 3, 7, 7, 1, 5, 7, 7, 7, 5] = 7

ii)String List

Give the string list as user input using split(), and list() functions.

store it in a variable.

Below is the implementation:

# Function to find the majority element present in a given list
def majoElement(given_list):
# majo stores the majority element (if present in the given list)
majo = -1
# initializing counter index with 0
ind = 0
# do for each element A[j] in the list
for j in range(len(given_list)):
# check if the counter index is zero or not.
if ind == 0:
# set the current candidate of the given list to givenlist[j]
majo = given_list[j]
# change the counter index to 1.
ind = 1
# Otherwise, if givenlist[j] is a current candidate, increment the counter.
elif majo == given_list[j]:
ind = ind + 1
# Otherwise, if givenlist[j] is a current candidate, decrement the counter.
else:
ind = ind - 1
# return the majority element
return majo

# Driver Code
# Give the string list as user input using split(), and list() functions.

# store it in a variable.
given_list = list(input('Enter some random elements of the given list separated by spaces = ').split())
# Pass the given list to the majoElement function which accepts
# the given list as an argument
# and implement the Boyer–Moore majority vote algorithm.

print("The majority element present in the givenlist",
given_list, '=', majoElement(given_list))

Output:

Enter some random elements of the given list separated by spaces = hello this is btechgeeks is is is si is is
The majority element present in the givenlist ['hello', 'this', 'is', 'btechgeeks', 'is', 'is', 'is', 'si', 'is', 'is'] = is

Related Programs:


text:
# Three segments

The circle is divided into 3 segments. Segment A occupies 1/4 of the area, segment B occupies 1/3 of the area. What part is occupied by section C? In what proportion are areas A: B: C?

Result

C =  0.4167
r = (Correct answer is: 3/4:5)

#### Solution:

$C=1-\frac{1}{4}-\frac{1}{3}=\frac{5}{12}=0.4167$

We would be pleased if you find an error in the word problem, spelling mistakes, or inaccuracies and send it to us. Thank you!

Tips to related online calculators
Need help calculate sum, simplify or multiply fractions? Try our fraction calculator.
Check out our ratio calculator.

#### You need to know the following knowledge to solve this word math problem:

We encourage you to watch this tutorial video on this math problem:

## Next similar math problems:

• Arc
What area of a circle occupied the flowers planted in the arc of a circle with radius 4 m with central angle 45°?
• Ratio of volumes
If the heights of two cylindrical drums are in the ratio 7:8 and their base radii are in the ratio 4:3. What is the ratio of their volumes?
• In the
In the national park, the ratio of the wooded area to grassland is 4: 1. The total area is 385km2. What area is wooded?
• Composite ratio
Jakub, Aneta, and Lenka divided 1342 USD in the ratio 5/2: 3/10: 1/4. How much did Lenka take?
• MO - triangles
On the AB and AC sides of the triangle ABC lies successive points E and F, on segment EF lie point D. The EF and BC lines are parallel and is true this ratio FD:DE = AE:EB = 2:1. The area of ABC triangle is 27 hectares and line segments EF, AD, and DB seg
• Land area
A land area of Asia and Africa are in a 3: 2 ratio, the European and African are is 1:3. What are the proportions of Asia, Africa, and Europe?
• Dividing walnuts into crates
There are 8 and 2 over 3 pounds of walnuts in a container, which will be divided equally into containers that hold 1 and 1 over 5 pounds. This would fill n and 4 over 18 containers. What is n?
• Triangle in circle
Vertices of the triangle ABC lies on a circle with radius 3 so that it is divided into three parts in the ratio 4:4:4. Calculate the circumference of the triangle ABC.
• 1.5 divided
1.5 divided by 1 = w divided by 4
• Unknown integer
Find the smallest integer that: divided by 2, the remainder is 1 divided by 3 the remainder is 2, divided by 4 remainder is 3, ... divided by eight reminder is 7, by 9 reminder is 8.
• Line segment
Cut a line segment of 15 cm into two line segments so that their lengths are in ratio 2:1. What length will each have?
• Sector
The perimeter of a circular sector with an angle 1.8 rad is 64 cm. Determine the radius of the circle from which the sector comes.
• Three 43
Three brothers inherited a cash amount of 62,000, and they divided it among themselves in the ratio of 5:4:1. How much more is the largest share than the smallest share?
• Proportion 3
For every 8 mango trees in the orchard, there are 4-star apple trees. If there are 1320 trees, how many trees of each kind are there?
• Three numbers
The sum of the three numbers is 287. These numbers are in a ratio of 3: 7: 1/4 Define these numbers
• Ratio - proportion
Reduce the number 16 in proportion 3:2 5:4 11:8
• Boats
Three-quarters of boats are white, 1/7 are blue and 9 are red. How many boats do we have?


text:
This notebook was prepared by Donne Martin. Source and license info is on GitHub.

# Challenge Notebook¶

## Problem: Sum of Two Integers.¶

See the LeetCode problem page.

## Constraints¶

• Can we assume we're working with 32 bit ints?
• Yes
• Can we assume the inputs are valid?
• No, check for None
• Can we assume this fits memory?
• Yes

## Test Cases¶

See the LeetCode problem page.

## Algorithm¶

Refer to the Solution Notebook. If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start.

## Code¶

In [ ]:
class Solution(object):

def sum_two(self, val):
# TODO: Implement me
pass

## Unit Test¶

The following unit test is expected to fail until you solve the challenge.

In [ ]:
# %load test_sum_two.py
import unittest

class TestSumTwo(unittest.TestCase):

def test_sum_two(self):
solution = Solution()
self.assertRaises(TypeError, solution.sum_two, None)
self.assertEqual(solution.sum_two(5, 7), 12)
self.assertEqual(solution.sum_two(-5, -7), -12)
self.assertEqual(solution.sum_two(5, -7), -2)
print('Success: test_sum_two')

def main():
test = TestSumTwo()
test.test_sum_two()

if __name__ == '__main__':
main()

## Solution Notebook¶

Review the Solution Notebook for a discussion on algorithms and code solutions.


text:
# I’ve just custom-compiled ‘Aqsis’.

To give some context to this proclamation, I had written an earlier posting, about adapting the non-packaged software named ‘Ayam‘ to Debian / Stretch, that had worked just fine under Debian / Jessie. This is a GUI which constructs complex ‘Renderman‘-Compliant rendering instructions, in this case in the form of .RIB-Files, which in turn, ‘Aqsis’ can turn into 2D perspective views of 3D scenes, that have been software-rendered. OTOH, Ayam itself uses OpenGL and H/W rendering, for its GUI.

What I had found before, was that Ayam did not seem stable anymore under Debian / Stretch. I apologize for this assessment. Under close scrutiny, my computer has revealed, that it was really Aqsis giving the problems, not Ayam. Aqsis is a text-based tool in effect.

Ayam does not specifically need to be used with Aqsis to do its rendering. It can be set up to use other rendering-engines, most of which are quite expensive. Aqsis just happens to be the best Open-Source rendering-engine, whose language Ayam speaks. And at this point I’d say that Ayam is still quite stable, after all, under Debian / Stretch.

As is often the case with such troubles, I next sought to custom-compile Aqsis, to see whether doing so could get rid of its quirks. What were its quirks?

Finally, the only problem with Aqsis was and remains, that it cannot produce a real-time preview of the scene being edited, which it used to provide using a component-program named ‘piqsl’. And the reason why the packaged version of Aqsis does not have ‘piqsl’ under Debian / Stretch, is because this distribution of Linux has a very new ‘Boost’ library ( v1.62 ) , and the visual component to Aqsis, that could produce a display, still relies on the Qt4 libraries and their API, which have begun to bit-rot. The Qt4-specific code of Aqsis cannot parse the newest usage of the Boost libraries, and Debian maintainers have long since discovered this. They are shunning the use of ‘libqt4-dev’ and of ‘libqt4-opengl-dev’ to build any of their packages. So they were effectively forced to package a version of Aqsis, which was missing some important components.

(Updated 12/12/2017 … )

I have sad news for the reader. What the professional maintainers cannot do, I cannot do either. So my custom-compiled version of Aqsis, still does not have its Qt-feature enabled, and therefore still does not offer me previews. But, from within Ayam, I can get the ‘Render To File’ feature working, and can view the resulting .TIFF-Files using ‘ImageMagick’, within just a few more mouse-clicks.

(Edit 12/12/2017 : Contrarily to what I first intended, at the bottom of this posting, I’m going to give some details, about how to custom-compile Aqsis… )

But what are the advantages to me, of having done this? I’ve compiled Aqsis with some other features enabled, which are deemed either experimental, or non-essential, by the package-maintainers:

• OpenEXR‘-Support, which is for Extended Dynamic-Range Images. I.e., for 16-bit, half-precision, floating-point pixel-depth. Ayam won’t invoke this. But for some hypothetical usage, it might be interesting. If the package-maintainers had built this feature, it would have added a dependency.
• Multi-Threading support, which the maintainers deem Experimental, and which could cause complaints about lack of stability from some users.

Having this installed on an octa-core machine, I can appreciate that the software was somewhat pointless out-of-the-box, because any serious graphics work would benefit from multi-threaded rendering!

And everything works – again. That’s all I have to show for it!

(Edited 18h00 Same Day : )

When users try to render an Ayam-scene to an OpenEXR-File, by editing the RIB-File which gets sent to Aqsis, with a Text-Editor, then there are some difficulties to point out, as I’ve just discovered.

Assuming that the brightness values are correct when the TIFF-File is first rendered, not only does the RIB-File Format line need to be changed to:

Display "exr_test_2.exr" "exr" "rgba"

But we can also not assume, that ‘Quantizing’ can just be forgotten. Instead, we must give Aqsis the parameters:

Quantize "rgba" 0 0 0 0

Thereby switching quantization off explicitly, because we’re using half-precision floating-point numbers, where they used to be

255 0 255 0.5

After that, my attempts to view the EXR-File succeeded, using ‘Krita’.

(Edit 12/08/2017 : )

More serious use of OpenEXR-format does not only require that we achieve the basic format, but may also suggest, that we compress the resulting OpenEXR-File in some way. Well, the format allows for RLE (Run-Length Encoding), plus, ‘Aqsis’ specifically offers support for it, with the following extension of the previous example:

Display "exr_test_2.exr" "exr" "rgba" "string compression" "lzw"

In my experience, the EXR-File which results may be half the length, and ‘Krita’ will display it exactly as above, because under Linux, the library for OpenEXR-support is system-installed. Under Linux, the key question is whether Aqsis offers the semantics, for the correct syntax in the RIB-File.

The success of this exercise suggest, that instead of storing them pixel-by-pixel, the EXR-File stores each channel-plane by itself, and then the values as if characters belonging to the given plane.

If given a much-more-rich type of image-file – i.e., a picture that has fine details filling most of its surface – then RLE will not compress it as much. But in such cases, the Alpha-channel is likely still to contain uniform surfaces, which RLE should compress fine.

(Edit 12/12/2017 : )

When I download and custom-compile source-trees, those source-code archives usually involve one out of two, commonly-used build-types:

1. They can be prepared for compiling under Linux, by running the command ‘./configure’ in the root of the source-directory-tree, or
2. They can involve the use of ‘cmake‘.

‘Aqsis’ is an example of a project, whose source-code has been prepared to use ‘cmake’. First of all, to get the most-up-to-date source code, I used the git-repository linked to here, which requires that we have ‘git’ or ‘svn’ installed on our computers. ‘svn’ stands for ‘Subversion‘, and it’s one of several tools which can allow users to download the most-up-to-date version of any source-code.

Next, typically for how cmake works, we create a sub-directory of the main source-directory, and arbitrarily, I name this sub-directory ‘build’. I then ‘cd’ to this directory, and run either ‘ccmake’ or ‘cmake-gui’.

The way cmake works, we can have one version of the source-code, and its cmake configuration, in one source-directory, but when we configure the project with ccmake or cmake-gui, a local configuration of the build process will be stored in another directory, which in my case is usually the ‘build’ sub-directory. Then, building or reconfiguring the project within the sub-directory, has no effect on the source-code stored in the source-directory, and it would even be possible to create several build-configurations, of the same source-directory, but each stored in a different sub-directory. In practice, I only need 1 build-configuration.

The advantage to using ‘ccmake’ or ‘cmake-gui’ over simply using ‘cmake’, is that we can customize certain features of the project to be built, or not to be built, contrarily to how this would be set by default. So in this case, to build with OpenEXR support, with threading-support, but without Qt-support, were options which I specified in ‘cmake-gui’.

In that GUI, I needed to specify that I wanted “Unix Makefiles” to be generated, which we can also do on the command-line with the -G option, like so:

ccmake -G “Unix Makefiles”

If the reader is interested in compiling a Windows version of this project, then he might specify to have the Visual Studio Solution generated instead, like so:

ccmake -G “Visual Studio 12 2013″

or,

ccmake -G “Visual Studio 8 2005″

At that point, our cmake GUI will allow us to give two commands in sequence

1. Configure
2. Generate

After Configuring has determined that all our prerequisites are installed, Generating is supposed to generate, either the Makefiles, or the Visual Studio Solution, or whatever else we’ve chosen to generate.

Note: cmake is not a compiler. We need to have, whichever type of compiler installed, so that we can then use the Makefiles, or the Visual Studio Solutions, in order actually to compile the project. After setting up the project in cmake, configuring, and generating, we must therefore either run

• ‘make’ and ‘make install’
• …or, run Visual Studio, to compile the project !

With ccmake or cmake-gui, for this project, we actually need to open the Advanced Configuration view, i.e. while Configuring and before Generating, because this project has a glitch, as it was stored in the Git-repository.

Normally, when we next run ‘make’ and then, as root, ‘make install’, the project should be installed and ready-to-run. 95% of the time, that is my experience. But in my example this was not so, and there were two complications which made it not so:

1. Aqsis needs to have a configuration-file stored in the directory ‘/etc/aqsis’, and
2. My desktop would only display the file-associations correctly, i.e. offer me to Aqsis-render a RIB-File, just by clicking on it, if its mime-database was updated next, to reflect the new associations.

Problem (1) had as its cause, the fact that in the advanced configuration view, the variable:

SYSCONFDIR

etc/aqsis

I assume that this was due to a typo, and it may not stay that way for very long. The problem is, that as long as my Prefix is set to ‘/usr/local’, the above mistake will actually install the configuration-file to

/usr/local/etc/aqsis

Which is completely wrong. What needs to be done correctly, is that this variable needs to be set to

/etc/aqsis

…where, the program has been written, to look for its system-wide configuration-file. In my case, I was able to make up for this error instead, by just creating the directory as part of the root file-system, as root, and then just copying the file ‘aqsisrc’ from the build-directory, where the ‘cmake’ configuration-process created it, to this directory, as root.

Problem (2) was a more-universal issue. The desktop-configuration will only be updated, while our newly-installed project has as its prefix ‘/usr/local’, If we next run, as root,

update-mime-database /usr/local/share/mime

This last step is something which the post-install process would normally do, but because we’re not installing anything from the package-manager, we need to do it ourselves, as root, because the package-manager is run as root.

There is a complementary post-install which we’d need to run as root, which is the command:

update-desktop-database

…run on directory:

/usr/local/share/applications

Simply relying on our next use of the package-manager to install software will not take care of this, because package-installed software has as its prefix:

/usr

…and not:

/usr/local

If we did everything correctly, then we should be able to use Aqsis, as we configured it to work.

Dirk

## 2 thoughts on “I’ve just custom-compiled ‘Aqsis’.”

This site uses Akismet to reduce spam. Learn how your comment data is processed.


text:
# 10 Days Of Grad: Deep Learning From The First Principles

## Day 1: Learning Neural Networks The Hard Way

Neural networks is a topic that recurrently appears throughout my life. Once, when I was a BSc student, I got obsessed with the idea to build an "intelligent" machine1. I spent a couple of sleepless nights thinking. I read a few essays shedding some light on this philosophical subject, among which the most prominent, perhaps, stand Marvin Minsky's writings2. As a result, I came across neural networks idea. It was 2010, and deep learning was not nearly as popular as it is now3. Moreover, no one made much effort linking to neural networks in calculus or linear algebra curricula. Even guys doing classical optimization and statistics sometimes seemed puzzled when hearing about neural nets. Some year later, I have implemented a simple neural net with sigmoid activations as a part of a decision-making course. At the time I realized that existing state of our knowledge was still lacking to really build "thinking computers"4.

It was 2012, the conference in Crimea, Ukraine where I attended a brilliant talk by Prof. Laurent Larger. He explained how to build a high-speed hardware for speech recognition using a laser. The talk really inspired me, and a year later I have started a PhD with an aim to develop reservoir computing, recurrent neural networks implemented directly in hardware. Finally, now I am using deep neural networks as a part of my job.

In this series of posts I will highlight some curious details of problem solving with neural networks. I am pretty much against duplicate efforts, therefore I would avoid repeating aspects described many times somewhere else. For those who are completely new to the subject, instead of introducing neural networks all over again I would refer to Chapter 1.2 of my PhD thesis. Here I will only summarize that neural networks are to some extent inspired by biological neurons. Similarly to its biological counterpart, artificial neuron receives many inputs, performs a nonlinear transformation, and produces an output. The equation below formalizes this kind of behavior:

$$$$y = f(w_1 x_1 + w_2 x_2 + \dots + w_N x_N) = f(\sum_i w_i x_i),$$$$

where $N$ is the number of inputs $x_i$, $w_i$ are synaptic weights5, and $y$ is the result. Surprising as it may appear, in a modern neural network $f$ can be practically any nonlinear function. This nonlinear function is often called an activation function. Congratulations, we have arrived at a neural network from 1950-s.

This series of posts practically illustrate all the concepts in Haskell programming language. To motivate you, here are some Q & A you always wanted to know.

Q: Is there anything that makes Haskell particularly good for Neural Networks or are you simply doing it because you prefer to use Haskell?

A: Neural networks are very "function objects". A network is just a big composition of functions. These kinds of things are very natural in a functional language.

Q: As I am completely new to Haskell, would like to know what are the benefits of using Haskell vs python or other languages?

A: The benefits of using Haskell:

1. It is much easier to reason about what your program is doing.
2. Great when refactoring existing code base.
3. Haskell shapes your thinking towards problem solving in a pragmatic way.

Q: I figured my lack of Haskell knowledge would make it hard to read, but your code examples still make sense to me.

A: Thank you. I find Haskell to be very intuitive when explaining neural nets.

## Gradient Descent: A CS Freshman Year

The very basic idea behind neural networks training and deep learning is a local optimization method known as gradient descent. For those who have hard time remembering their freshman year, just watch an introductory video explaining the idea.

How does a concept as simple as gradient descent work for a neural network? Well, a neural network is only a function6, mapping an input to some output. By comparing the neural network's output to some desired output, one can obtain another function known as an error function. This error function has a certain error landscape, like in the mountains. By using gradient descent, we modify our neural network in such a way that we are descending this landscape. Therefore, we aim at finding an error minimum. The key concept of the optimization method is that the error gradients give us a direction in which to change the neural network. In a similar way one would be able to descend a hill covered with a thick fog. In both cases only a local gradient (slope) is available.

Gradient descent can be described by a formula:

$$$$x_{n+1} = x_n - \gamma \cdot \nabla F(x_n),$$$$

where constant $\gamma$ is what is referred to in deep learning as the learning rate, i.e. the amount of learning per iteration $n$. In the simplest case, $x$ is a scalar variable. The gradient descent method can be implemented in few lines of code. The Haskell code snippet below is interactive. Press the green triangle button to Run the code.

That outputs the following sequence: $0.0,2.4,2.88,2.976,2.9952,2.99904,2.999808,2.9999616,\dots$ Indeed, the value minimizing function $f(x)$ is $3$, i.e. $\min f(x) = f(3) = (x-3)^2 = 0$. And the sequence is gradually converging towards that number. Let us look more carefully what does the code above do.

Lines 1-3: We define the gradient descent method, which iteratively applies the function step implementing equation (2). We provide the intermediate results taking the first iterN values.

Line 5: Suppose, we would like to optimize a function $f(x) = (x-3)^2$. Its gradient gradF_test is then $\nabla f(x) = 2\cdot(x-3)$.

Lines 7-10: Finally, we run our gradient descent using learning rate $\gamma = 0.4$.

It is crucial to realize that the value of $\gamma$ affects the convergence. When $\gamma$ is too small, the algorithm will take many more iterations to converge, however, when $\gamma$ is too large the algorithm will never converge. At the moment, I am not aware of a good way how to determine the best $\gamma$ for a given problem. Therefore, often different $\gamma$ values have to be tried. Feel free to modify the code above and see what comes out! For example, you can try out different values of gamma, such as gamma = 0.01, gamma = 0.1, gamma = 1.1. The method is generalizable to $N$ dimensions. Essentially, we would replace the gradF_test function with the one operating on vectors rather than scalars.

## Neural Network Ingredients For Classification

Now that we realize how the gradient descent works, we may want to train a moderately useful network. Let's say we want to perform Iris flower classification using four distinctive features7: sepal length, sepal width, petal length, petal width. There are three classes of flowers we want to be able to recognize: Setosa, Versicolour, and Virginica. Now, there is a problem: how do we encode those three classes so that our neural network can handle them?

### Naive Solution And Why It Does Not Work

The most simple solution to indicate each species would be using natural numbers. For instance, Iris Setosa can be encoded as 1, Versicolour, as 2, and Virginica, as 3. There is, however, a problem with this kind of encoding: we impose a bias. First, by encoding those classes as numbers, we impose a linear order over those three classes. It means, we start our count with Setosa, then, Versicolour, and then we arrive at Virginica. However, in reality it doesn't really matter if we end with Virginica or Vernicolour. Second, we also assume that the distance between Virginica and Setosa 3 - 1 = 2 is larger than between Virginica and Versicolor 3 - 2 = 1, which is a priory wrong.

### One-Hot Encoding

So which kind of encoding do we need? First, we want not to impose any restriction on ordering and second, we want the distances between classes to be equal. Therefore, we would prefer encoding each class to be orthogonal, i.e. independent from the other two. That becomes possible if we use vectors of three dimensions (as there are three classes). Therefore, now Setosa class is encoded as $[1, 0, 0]$, Versicolour, as $[0, 1, 0]$, and Virginica as $[0, 0, 1]$. The Euclidean distance between any pair of classes is equal to $\sqrt 2$. Update8: For example, the distance between Setosa and Versicolour is computed as

$$\sqrt{(1-0)^2 + (0-1)^2 + (0-0)^2}=\sqrt{2}.$$

### Putting It All Together

Now that we are familiar with basic neural networks and gradient descent and also have some data to play with7, let the fun begin!

First, we create a network of three neurons. To do that, we generalize formula (1):

$$$$y_{i}=f (\sum_k w_{ik} x_k),$$$$ where $(x_1, x_2, x_3, x_4) = \mathbf{x}$ is a 4D input vector, $w_{ik} \in \mathbf{W}, i=1 \dots 3, k=1 \dots 4$ is synaptic weights matrix, and result $(y_1, y_2, y_3) = \mathbf{y}$ is a 3D vector. Generally speaking, we perform a matrix-vector multiplication with a subsequent element-wise activation:

$$$$\mathbf y = f (\mathbf {W x}).$$$$

As a nonlinear activation function $f$ we will use the sigmoid function9 $\sigma(x) = [1 + e^{-x}]^{-1}$. We will exploit hmatrix Haskell library for linear algebra operations such as matrix multiplication. With hmatrix, Equation (4) can be written as:

import Numeric.LinearAlgebra as LA

sigmoid = cmap f
where
f x = recip $1.0 + exp (-x) forward x w = let h = x LA.<> w y = sigmoid h in [h, y] where <> denotes the matrix product function from LA module. Note that x can be a vector, but it can be also a dataset matrix. In the latter case, forward will transform our entire dataset. Notice that we provide not only the result of our computation y, but also an intermediate step h since it will be later reused for w gradient computation. Each neuron$y_i$is supposed to fire when it 'thinks' that it has detected one of the three species. E.g. when we have an output [0.89, 0.1, 0.2], we would assume that the fist neuron is the most 'confident', i.e. we interpret the result as Setosa. In other words, this output is treated as similar to [1, 0, 0]. As you can see, the maximal element was set to one and others, to zero. This is a so-called 'winner takes all' rule. Before training the neural network, we need some measure of error or loss function to minimize. For instance, we can use the Euclidean loss$\text{loss} = \sum_i (\hat y_i - y_i)^2$where$\hat y_i$is a prediction and$y_i$is a real answer from our dataset: loss y tgt = let diff = y - tgt in sumElements$ cmap (^2) diff

For the sake of gradient descend illustration, we will reuse the descend function defined above. Now, we have to specify the gradient function for our neural network equation (4). We use what is called a backpropagation or shortly backprop method, which is essentially a result of the chain rule and is illustrated for an individual neuron in the figure below10.

Now we can calculate the weights gradient dW using the backprop method from above:

grad (x, y) w = dW
where
[h, y_pred] = forward x w
dE = loss' y_pred y
dY = sigmoid' h dE
dW = linear' x dY

Here linear', sigmoid', loss' are gradients of linear operation (multiplication), sigmoid activation $\sigma(x)$, and the loss function. Note that by operating on matrices rather than scalar values we calculate the gradients vector dW denoting every synaptic weight gradient $dw_i$. Below are those "vectorized" functions definitions in Haskell using hmatrix library11:

linear' x dy = cmap (/ m) (tr' x LA.<> dy)
where
m = fromIntegral $rows x sigmoid' x dY = dY * y * (ones - y) where y = sigmoid x ones = (rows y) >< (cols y)$ repeat 1.0

loss' y tgt =
let diff = y - tgt
in cmap (* 2) diff

To test our network, we download the dataset here (there are two files: x.dat and y.dat) and the code here. As instructed in the comments, we run our program:

$stack --resolver lts-10.6 --install-ghc runghc --package hmatrix-0.18.2.0 Iris.hs Initial loss 169.33744797846379 Loss after training 61.41242708538934 Some predictions by an untrained network: (5><3) [ 8.797633210095851e-2, 0.15127581829026382, 0.9482351750129188 , 0.11279346747947296, 0.1733431584272155, 0.9502442520696124 , 0.10592462402394615, 0.17057190568339017, 0.9367875655363787 , 0.10167941966201806, 0.20651101803783944, 0.9300343579182122 , 8.328154248684484e-2, 0.15568011758813116, 0.940816298954776 ] Some predictions by a trained network: (5><3) [ 0.6989749292681016, 0.14916793398555747, 0.1442697900857393 , 0.678406436711954, 0.1691062984304366, 0.2052955124240905 , 0.6842327447503195, 0.16782087736820395, 0.16721778476233148 , 0.6262988163006756, 0.19656943129188192, 0.17521133197774072 , 0.6905553549763312, 0.15299944611286123, 0.12910826989854146 ] Targets (5><3) [ 1.0, 0.0, 0.0 , 1.0, 0.0, 0.0 , 1.0, 0.0, 0.0 , 1.0, 0.0, 0.0 , 1.0, 0.0, 0.0 ] That's all for today. Please feel free to play with the code. Hint: you may have noticed that grad calls sigmoid twice on the same data: once in forward and once in sigmoid'. Try optimizing the code to avoid this redundancy. As soon as you understand the basics of neural networks, make sure you continue to Day 2. In the next post you will learn how to make your neural network operational. First of all, we will highlight the importance of multilayer structure. We will also show that nonlinear activations are crucial. Finally, we will improve neural network training and discuss weights initialization. 1. There even exists a term describing exactly what I dreamed to achieve. ^ 2. For instance, check Why people think computers can't. ^ 3. With Google Trends in hand, we can witness the raise of global deep learning interest. ^ 4. Despite people have fantasized about it long before Alan Turing. ^ 5. Essentially, a synaptic weight$w_i$determines the strength of connection to the$i\$-th input. ^
6. With recurrent neural networks it is not true. Those have an internal state, making such networks equivalent to computer programs, i.e. potentially more complex than maps. ^
7. Here we refer to the classical Iris dataset. If you prefer another light dataset please let me know. ^
8. Kudos to Peter Harpending who spotted a typo in Euclidean distance. ^
9. In this example nonlinear activation is not essential. However, as we will see in future posts, in multilayer neural networks nonlinear activations are strongly required. ^
10. We look closer at the backpropagation mechanics here. ^
11. And here are their mathematical derivations. ^


text:
# Search for R-parity violating decays of a top squark in proton-proton collisions at root s=8TeV

## This item appears in the following Collection(s)

Except where otherwise noted, the use of this item is bound by the following: Attribution 4.0 International (CC BY 4.0)

Center for the


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

 It is currently 20 Oct 2019, 17:20

### 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

# A certain science class has a total of 35 students. If the ratio of

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 58434
A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

19 Mar 2018, 23:27
00:00

Difficulty:

5% (low)

Question Stats:

96% (00:36) correct 4% (00:20) wrong based on 60 sessions

### HideShow timer Statistics

A certain science class has a total of 35 students. If the ratio of girls to boys in the class is 4:3, how many more girls than boys are in the class?

A. 1
B. 5
C. 7
D. 15
E. 20

_________________
Current Student
Joined: 07 Jan 2016
Posts: 1086
Location: India
GMAT 1: 710 Q49 V36
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

19 Mar 2018, 23:40
Bunuel wrote:
A certain science class has a total of 35 students. If the ratio of girls to boys in the class is 4:3, how many more girls than boys are in the class?

A. 1
B. 5
C. 7
D. 15
E. 20

ratio 4x:3x
total= 7x parts = 35(given)

x= 35/7 =5

girls = 4x = 20
boys = 3x = 15

B 5
Senior PS Moderator
Joined: 26 Feb 2016
Posts: 3335
Location: India
GPA: 3.12
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

19 Mar 2018, 23:42
Bunuel wrote:
A certain science class has a total of 35 students. If the ratio of girls to boys in the class is 4:3, how many more girls than boys are in the class?

A. 1
B. 5
C. 7
D. 15
E. 20

Since there are 35 students in the class, and the ratio G:B - 4:3
there will be $$\frac{4}{7} * 35 = 20$$ girls and $$\frac{3}{7} * 35 = 15$$ boys in the class.

Therefore, there are 20-15 = 5(Option B) more girls than boys in the class
_________________
You've got what it takes, but it will take everything you've got
Board of Directors
Status: QA & VA Forum Moderator
Joined: 11 Jun 2011
Posts: 4774
Location: India
GPA: 3.5
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

20 Mar 2018, 10:53
Bunuel wrote:
A certain science class has a total of 35 students. If the ratio of girls to boys in the class is 4:3, how many more girls than boys are in the class?

A. 1
B. 5
C. 7
D. 15
E. 20

$$\frac{35}{(4 + 3)}*(4 - 3) = 5$$, Answer must be (B)
_________________
Thanks and Regards

Abhishek....

PLEASE FOLLOW THE RULES FOR POSTING IN QA AND VA FORUM AND USE SEARCH FUNCTION BEFORE POSTING NEW QUESTIONS

How to use Search Function in GMAT Club | Rules for Posting in QA forum | Writing Mathematical Formulas |Rules for Posting in VA forum | Request Expert's Reply ( VA Forum Only )
Manager
Joined: 03 Oct 2016
Posts: 122
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

20 Mar 2018, 14:10
Total no. of girls=$$\frac{4}{7}$$*35=20 so, boys 15. Difference 20-15=5. (D)
_________________
Non-Allergic To Kudos
SVP
Joined: 26 Mar 2013
Posts: 2345
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

20 Mar 2018, 15:44
Bunuel wrote:
A certain science class has a total of 35 students. If the ratio of girls to boys in the class is 4:3, how many more girls than boys are in the class?

A. 1
B. 5
C. 7
D. 15
E. 20

Difference between girls and boys is 1/7 of total class

1/7 * 35 = 5

Intern
Joined: 28 Apr 2014
Posts: 49
GMAT 1: 640 Q50 V25
Re: A certain science class has a total of 35 students. If the ratio of  [#permalink]

### Show Tags

21 Mar 2018, 08:19
7x=35
x=5

diff is x. hence 5
Re: A certain science class has a total of 35 students. If the ratio of   [#permalink] 21 Mar 2018, 08:19
Display posts from previous: Sort by


text:
## Animated Logical Graphs • 59

Re: Richard J. LiptonThe Art Of Math
Re: Animated Logical Graphs • (57)(58)

Returning to the theme of duality and more general group-theoretic symmetries in logical graphs, here’s an improved version of the introduction I gave two years ago.

The duality between Entitative and Existential interpretations of logical graphs is a good example of a mathematical symmetry, in this case a symmetry of order two.  Symmetries of this and higher orders give us conceptual handles on excess complexity in the manifold of sensuous impressions, making it well worth the effort to seek them out and grasp them where we find them.

In that vein, here’s a Rosetta Stone to give us a grounding in the relationship between boolean functions and our two readings of logical graphs.

$\text{Boolean Functions on Two Variables}$

### Resources

cc: Cybernetics (1) (2)Laws of FormFB | Logical Graphs • Ontolog Forum (1) (2)
• Peirce List (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) • Structural Modeling (1) (2)
• Systems Science (1) (2)

### 1 Response to Animated Logical Graphs • 59

This site uses Akismet to reduce spam. Learn how your comment data is processed.


text:
# Prove by induction that $a_k = \frac{(-1)^k + 3}{2}$ where $a_1 = 1$, $a_k = 2 / {a_{k-1}}$

This is a "study guide" question for a test I am trying to figure out. The sequence given is

$a_k=\dfrac{2}{a_{k-1}}$ for all integers $k\ge2$, and $a_1=1$.

It then asks me to find an explicit formula and prove it with "strong" induction. I came up with the following explicit formula:

$a_k=\dfrac{(-1)^k+3}{2}$

But I have no idea how to implement the proof of this. I understand that strong induction is like a normal mathematical induction proof but instead of proving for $k+1$ I need to prove for a range? I'm just not sure what my inductive hypothesis and base cases are for this problem. Thanks for any help!

-
Just use "normal" induction. Strong induction for one proposition is just normal induction for a modified proposition anyway. –  Hagen von Eitzen Oct 27 '12 at 6:44
Well the reason I'm trying to use strong induction is because it says to in the problem - but I have no idea how to apply it to this. –  Jon Oct 27 '12 at 7:01
Then the problem is stupid. There is no reason to use strong induction here. –  Chris Eagle Oct 27 '12 at 7:42
You came up with this formula? The formulas one can come up with when fiddling with the definition, trying some cases and the like, are more likely to resemble $a_{2k}=2$, $a_{2k+1}=1$. –  Did Oct 27 '12 at 8:50
@did: What you describe would be considered by many not to constitute a formula. Quite possibly OP did find this description and then came up with the mentioned formula. –  Marc van Leeuwen Oct 27 '12 at 8:56

You need only ordinary induction, and you don’t need to split it into two cases: if $a_k=\dfrac{(-1)^k+3}2$, then

$$\frac2{a_k}=\frac4{(-1)^k+3}\cdot\frac{(-1)^k-3}{(-1)^k-3}=\frac{4\left((-1)^k-3\right)}{-8}=\frac{-\left((-1)^k-3\right)}2=\frac{(-1)^{k+1}+3}2\;.$$

Added: I forgot to mention that with initial datum $a_1=1$ the problem is trivial. Let $f(x)=\frac2x$, so that $a_{k+1}=f(a_k)$ for all $k\ge 1$, and note that $f(1)=2$ and $f(2)=1$, which immediately proves the closed form

$$a_k=\begin{cases}1,&\text{if }k\text{ is odd}\\2,&\text{if }k\text{ is even}\;.\end{cases}$$

-
It's trivial whatever the (non-zero) value of $a_1$, because $2/(2/a_1) = a_1$. –  TonyK Oct 27 '12 at 9:00
@TonyK: True. I expressed myself poorly: I meant that the triviality is especially obvious, because the numbers are so nice. –  Brian M. Scott Oct 27 '12 at 9:08
That's how I was thinking about it, couldn't figure out how to apply "strong" induction. Since this seems to be the consensus I just won't spend too much more time thinking about this one :) –  Jon Oct 28 '12 at 6:21

I think just distinguish the case for odd and even $k$, then you can prove that using normal induction.

-
That makes sense I guess. Seems kinda pointless to me. –  Jon Oct 27 '12 at 7:37
Actually this series is periodic as 1, 2, 1, 2.... So all you have to prove is when we have 1 at current position, the next element should be 2, and if we have 2 at current position, the next element should be 1, which is trivial from the recurrence formula. –  user46090 Oct 27 '12 at 8:36


text:
# tf.contrib.image.transform(images, transforms)

### tf.contrib.image.transform(images, transforms)

Applies the given transform(s) to the image(s).

#### Args:

• images: A tensor of shape (num_images, num_rows, num_columns, num_channels) (NHWC), (num_rows, num_columns, num_channels) (HWC), or (num_rows, num_columns) (HW).
• transforms: Projective transform matrix/matrices. A vector of length 8 or tensor of size N x 8. If one row of transforms is [a0, a1, a2, b0, b1, b2, c0, c1], then it maps the output point (x, y) to a transformed input point (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k), where k = c0 x + c1 y + 1.

#### Returns:

Image(s) with the same type and shape as images, with the given transform(s) applied. Transformed coordinates outside of the input image will be filled with zeros.

#### Raises:

• TypeError: If image is an invalid type.


text:
# A coil I built has divergent measurements respective to wire resistance and AWG size

I'm not exactly into building precision coils, but I decided to make one for a subwoofer voice coil.

I used what was supposed to be AWG 28 wire, it completely fit the diameter. I wound it tightly over a cylindrical metal piece and it took 15 turns until the length of the coil was 5 mm.

So I went on and built a 25 mm tall, 40 mm diameter voice coil with two layers (orthocyclic winding) and it has 78 turns on each layer (completely compatible with AWG 28). The legs are 10 cm each.

But when I measured the resistance with my multimeter it read 5.8 Ω. I was expecting 4.2 Ω.

Noting that I'm already accounting for the resistance of the multimeter leads and the electrical connection with the legs, I measured the resistance between two points in each leg and they both read 0.1 Ω (the whole coil measured 6 Ω, hence 5.8 Ω actual resistance).

I also tested my multimeter with resistors I have. A 100 Ω resistor measured 101.1 Ω, a 22 resistor measured 22.1 Ω and a 4.7 Ω resistor measured 5.1 Ω (all of that without subtracting the resistance of the leads this time, and all of them being 5% tolerance resistors).

It seems the multimeter is reasonably calibrated, values from 100 to 4.7 Ω show very little discrepancy.

What could be happening here?

I don't see any damage that could suggest fractures along the wire.

Could this actually be AWG 29 wire with a thick insulation?

Or a cheap wire with poor copper content?

Ps.: I wound it in an aluminium former which I then removed from it. Now there's only the copper wire with a tiny bit of resin that probably doesn't amount to 0.2 grams. I weighed it on a scale and it read 11 grams. With the error it could be 10 or 12, but an AWG 28 wire with 19.8 meters of length and a cross-section area of 0.08 mm² should weigh a bit over 14 grams. I tested my scale with water and a syringe and it seems the errors are always inside +- 1 gram (as expected.) This somewhy fits better with the weight AWG 29 wire would have with the same total length of wire.

• How long was your wire - you haven't demonstrated that you know how much wire you used. Apr 24 '20 at 8:32
• 78 turns per layer. How many layers? Apr 24 '20 at 8:38
• @Transistor Two layers (like most voice coils). Seems like I accidentally deleted the word "two" from the text. This gives 19.8 meters of wire. Apr 24 '20 at 8:39
• Noting that even if I added 1 meter more and rounded it to 21 meters this still doesn't give anything near 5.8 ohms. Apr 24 '20 at 8:41
• I've confirmed your calculations, allowed for increased diameter on first and second layer and tails and get 4.268 $\Omega$. Apr 24 '20 at 8:44