My dad figured this out years ago.

The string method work for all matrices, and it is at least ten times quicker to “do” than to “write about”.

My dad figured this out years ago.

The string method work for all matrices, and it is at least ten times quicker to “do” than to “write about”.

Filed under algebra, education, math, teaching, transformations, Uncategorized

I was pondering the reality of negative numbers and after figuring out that a sequence of dots on a line can be extended in each of the two directions, and then arbitrarily selecting one dot as “the zero”. The line can be further labelled as 1, 2, 3, … to one side and -1, -2, -3, … on the other side.

(better to label the 1, 2, 3, … as +1, +2, +3, … and consider the lot as “signed numbers”)

Soon proceeding towards arithmetic I concluded that 7-3 is 4, and also 8-4 is 4, and therefore 13-9 is 4, and then 3-7 is -4, and -2-2 is -4. It was then observed that if a-b=c then a-y-(b-y) is also equal to c, regardless of the signs of the specific numbers involved.

This of course is stunningly obvious when looking at the signed difference of the first and the second number as an extended number line diagram.

The outcome of all this was an arithmetic for 0, 1, 2 modulo 3, and the signed difference x-y is a binary operation diff(x,y) with table:

…x … 0 1 2

y

0 0 1 2

1 2 0 1

2 1 2 0

Example: 1-2 is -1, which is 2 modulo 3

So a non abelian, non associative algebra with a not quite identity satisfies the conditions, where A=1, B=2 and C=0

—————————————————–

There are three objects and an operation called “doesn’t have a name”.

Two are similar, and the third is a bit different

They are paired to yield a single object as follows:

AA = BB = CC = C

AB = BC = CA = B

AC = CB = BA = A

Notice that BC and CB are different, so non-abelian.

Worse is that (AC)A = C and A(CA) = B are different, so non-associative.

And consequently A and B and C are different.

—————————————————-

Interestingly, and maybe separately, the minus sign behaves very differently from the plus sign:

a-(-b) is a+b, but there is no way of writing a-b using only addition.

This means that all expressions can be written with “minus” alone.

Filed under abstract, algebra, arithmetic, Uncategorized

This is a challenge !!!!!

There are three objects, A, B, and C, and an operation called “doesn’t have a name”.

Two are similar, and the third is a bit different

They are paired to yield a single object as follows:

AA = BB = CC = C

AB = BC = CA = B

AC = CB = BA = A

Notice that BC and CB are different, so non-abelian.

Worse is that (AC)A = C and A(CA) = B are different, so non-associative.

And consequently A and B and C are different.

Your job is to identify (model, in current jargon) the objects and the operation.”

The next post will be “the solution”.

Filed under abstract, algebra, Uncategorized

Who needs LCM ?

First, three views of LCM with no comments :

denominators. As the common denominator, choose the LCM of

the original denominators. Then the larger the numerator, the

larger the fraction.

since if denominators are same, we just need to find LCM of

numerators, hence LCM of (a/b) and (c/b) would be LCM(a,c)/b.

So we have to first make denominators of both the fractions same.

Multiply numerator and denominator of first fraction by LCM

(b,d)/b.

equivalent fractions and adding and subtracting fractions, which

students will do later.

Now we can do fraction addition without LCM. It just needs the use of the distributive law, and the result shows the way in which the divisors combine.

And now using 3/4

But the best one is via multiplication ……

Now for multiplication and division.

Filed under algebra, arithmetic, fractions, Uncategorized

x^{2 }– 3x – 4 = 0

x^{2} – 3x + 2 = 6

(x – 3/2)^{2} = 6

(x – 3/2) = √6 or – (x – 3/2) = √6

x = 3/2 + √6 or x = 3/2 – √6

Filed under algebra, Uncategorized

What exactly are negative numbers?

A reference , from Wikipedia:

In A.D. 1759, Francis Maseres, an English mathematician, wrote that negative numbers “darken the very whole doctrines of the equations and make dark of the things which are in their nature excessively obvious and simple”.

He came to the conclusion that negative numbers were nonsensical.[25]

A minus times a minus is a plus

Two minuses make a plus

Dividing by a negative, especially a negative fraction !!!!

(10 – 2) x (7 – 3) = 10 x 7 – 2 x 7 + 10 x -3 + 2 x 3, really? How do we know?

Or we use “the area model”, or some hand waving with the number line.

**It’s time for some clear thinking about this stuff.**

Mathematically speaking, the only place that requires troublesome calculations with negative numbers is in algebra, either in evaluation or in rearrangement, but what about the real world ?

Where in the real world does one encounter negative x negative ?

I found two situations, in electricity and in mechanics:

1: “volts x amps = watts”, as it it popularly remembered really means “voltage drop x current flowing = power”

It is sensible to choose a measurement system (scale) for each of these so that a current flowing from a higher to a lower potential point is treated as positive, as is the voltage drop.

Part of simple circuit A———–[resistors etc in here]————–B

Choosing point A, at potential a, as the reference, and point B, at potential b, as the “other” point, then the potential drop from A to B is a – b

If b<a then a current flows from A to B, and its value is positive, just as a – b is positive

If b>a then a current flows from B to A, and its value is negative, just as a – b is negative

In each case the formula for power, voltage drop x current flowing = power, must yield an unsigned number, as negative power is a nonsense. Power is an “amount”.

So when dealing with reality minus times minus is plus (in this case nosign at all).

The mechanics example is about the formula “force times distance = work done”

You can fill in the details.

Now let’s do multiplication on the number line, or to be more precise, two number lines:

Draw two number lines, different directions, starting together at the zero. The scales do not have to be the same.

To multiply 2 by three (3 times 2):

1: Draw a line from the 1 on line A to the 2 on line B

2: Draw a line from the 3 on line A parallel to the first line.

3: It meets line B at the point 6

4: Done: 3 times 2 is 6

Number line A holds the multipliers, number line B holds the numbers being multiplied.

To multiply a negative number by a positive number we need a pair of signed number lines, crossing at their zero points.

So to multiply -2 by 3 (3 times -2) we do the same as above, but the number being multiplied is now -2, so 1 on line A is joined to -2 on line B

The diagram below is for -2 times 3. Wow, it ends in the same place.

Finally, and you can see where this is going, we do -2 times -3.

Join the 1 on line A to the -3 on line B, and then the parallel to this line passing through the -2 on line A:

and as hoped for, this line passes through the point 6 on the number line B.

Does this “prove” the general case? Only in the proverbial sense. The reason is that we do not have a proper definition of signed numbers. (There is one).

Incidentally, the numbering on the scales above is very poor. The positive numbers are **NOT NOT NOT** the same things as the unsigned numbers 1, 1.986, 234.5 etc

Each of them should have a + in front, but mathematicians are **Lazy**. More on this another day.

Problem for you: Show that (a-b)(c-d) = ac – bc – ad + bd without using anything to do with “negative numbers”

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

**References.**

Wikipedia:

Reference direction for current

Since the current in a wire or component can flow in either direction, when a variable I is defined to represent

that current, the direction representing positive current must be specified, usually by an arrow on the circuit

schematic diagram. This is called the reference direction of current I. If the current flows in the opposite

direction, the variable I has a negative value.

Yahoo Answers: Reference direction for potential difference

Best Answer: Potential difference can be negative. It depends on which direction you measure the voltage – e.g.

which way round you connect a voltmeter. (if this is the best answer, I hate to think of what the worst answer is)

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

Filed under algebra, arithmetic, definitions, education, geometrical, math, meaning, negative numbers, Number systems, operations, subtraction, teaching, Uncategorized

Our first order process is described by the equation **y _{n+1} = ay_{n} + kx_{n }**, where

If we set the input to be a constant x and the output settled value to be a constant y, then

y = ay + kx, and solving for y/x we get y/x = k/(1-a), the actual steady state gain.

In what follows the k will represent the actual steady state gain, the old k divided by (1-a)

The fist two plots show the process alone, with input set to 6 at time zero. In the first the steady state gain is set to 1, and in the second it is set to 2

Now we look a t the process under “direct” control, where the input is determined only by the chosen setpoint value. The two equations are

**y _{n+1} = ay_{n} + kx_{n }** and

To obtain a controlled system with overall steady state gain equal to 1 (settled output equal to desired output) it is easy to see that **A **has to be equal to **(1-a)/k**

It is not so obvious how the choice of **h** affects the performance of the controlled system. To do this we observe that the complete system is described entirely by the process equation and the controller equation together, and we can eliminate the x_{n} from the two equations to get **y _{n+1} = ay_{n} + k(Ad_{n} + h(y_{n} – d_{n}))**

which rearranged is **y _{n+1} = (a + kh)y_{n} + k(A – h)d_{n} **

Substituting **(1-a)/k for A, as found above, gives y_{n+1} = (a + kh)y_{n} + (1 – a – kh)d_{n} **

which has the required steady state gain of 1.

This final equation has the SAME structure as the process equation,

with **a + kh** in place of **a**

So now we will see how the value of the “**a**” coefficient affects the dynamic response of the system.

If h > 0 the controlled system will respond slower than with h = 0, and if h < 0 it will respond faster:

Setpoint changes were made at time 20 and at time 40

Congratulations if you got this far. This introduction to computer controlled processes has been kept as simple as possible, while using just the minimum amount of really basic math. The difficulties are in the interpretation and meaning of the various equations, and this something which is studiously avoided in school math. Such a shame.

Now you can run the program yourself, and play with the coefficients. It is a webpage with javascript: http://mathcomesalive.com/mathsite/firstordersiml.html

Aspects and theoretical stuff which follow this (not here !) include the backward shift operator z and its use in forming the transfer function of the system, behaviour of systems with wave form inputs to assess frequency response, representation of systems in matrix form (state space), non-linear systems and limit cycles, optimal control, adaptive control, and more…..

Filed under algebra, computer, control systems, discrete model, engineering, math, tuning, Uncategorized

Let us return to the industrial steam engine driving a range of equipment, each piece in the charge of an operator. In order to keep the factory working properly it is necessary to keep the speed of the steam engine reasonably constant, at what is called the desired output, or the set point. A human controller can achieve this fairly well, by direct observation of the speed and experience of the effect of changing the steam flow rate, but automatically? Well, James Watt solved the problem with a mechanical device (details later). We will now see how to “do it with a computer”.

Diagram of the physical system. There will be a valve on the steam line (not shown).

The information flow diagram. The load is not measured, and may vary.

Now we have a controller in the picture, fed with two pieces of information, the current speed and the desired speed. The controller can be human, mechanical or computer based. It has a set of rules to figure out the appropriate steam flow rate.

Now we have computer control. The output of the system is measured (sampled) at regular intervals, the computer calculates the required flow rate , sends the corresponding value to the valve actuating mechanism, which holds this value until the next sampling time, when the process is repeated. Using n=1, 2, 3, ….. for the times at which the output is sampled and the controller does its bit, we have at time n the speed measure **y _{n}**, the desired speed

The equation in the steam engine box is our fairly simple first order linear system model as described in the previous post. It is a good idea to have a model of the process dynamics for many reasons (!), one of which is that we can do experiments on the whole controlled system by simulation rather than on the real thing.

Looking at the controller function (formula), **x _{n} = Ad_{n} + h(y_{n} – d_{n})** , it is “obvious” that if the coefficient

It is not so obvious how the choice of **h** affects the performance of the controlled system. To do this we observe that the complete system is described entirely by the process equation and the controller equation together, and we can eliminate the x_{n} from the two equations to get **y _{n+1} = ay_{n} + k(Ad_{n} + h(y_{n} – d_{n}))**

which rearranged is **y _{n+1} = (a + h)y_{n} + k(A – h)d_{n} **

and has the SAME structure as the process equation, with **a + h** in place of **a**

In the next post, on tuning our controller, we will see how the value of the “**a**” coefficient affects the dynamic response of the system.

Filed under algebra, computer, discrete model, dynamic systems, engineering, forecasting, math, Uncategorized

In the business and manufacturing world data keeps on coming in. What is it telling me? What is it telling me about the past? Can it tell me something believable about the future. These streams of data form the food for “time series analysis”, procedures for condensing

the data into manageable amounts.

Here is a plot of quarterly Apple I-phone sales. (ignore the obvious error, this is common)

I see several things, one is a pronounced and fairly regular variation according to the quarter, another is an apparent tendency for the sales to be increasing over time, and the third is what I will call the jiggling up and down, more formally called the unpredictable or random behaviour.

The quarterly variation can be removed from the data by “seasonal analysis”, a standard method which I am not going to deal wirh (look it up. Here’s a link:

https://onlinecourses.science.psu.edu/stat510/node/69

The gradual increase, if real, can be found by fitting a straight line to the data using linear regression, and then subtracting the line value from the observed value for each data point. This gives the “residuals”, which are the unpredictable bits.

Some time series have no pattern, and can be viewed as entirely residuals.

We cannot presume that the residuals are just “random”, so we need a process of smoothing the data to a) reveal any short term drifting, and b) some help with prediction.

The simple way is that of “moving average”, the average of the last k residuals. Let’s take k = 5, why not !

Then symbolically, with the most recent five data items now as x(n), x(n-1),..,x(n-4), the moving average is

ma = (x(n)+x(n-1)+x(n-2)+x(n-3)+x(n-4))/5

If we write it as ma = x(n)/5 + x(n-1)/5 + x(n-2)/5 + x(n-3)/5 + x(n-4)/5 we can see that this is a weighted sum of the last five items, each with a weight of 1/5 (the weights add up to 1).

This is fine for smoothing the data, but not very good for finding out anything about future short term behaviour.

It was figured out around 60 years ago that if the weights got smaller as the data points became further back in time then things might be better.

Consider taking the first weight, that applied to x(n) as 1/5, or 0.2 so the next one back is 0.2 squared and so on. These won’t add up to 1 which is needed for an average, so we fix it.

0.2 + 0.2^2 + 0.2^3 + … is equal to 0.2/(1-0.2) or 0.2/0.8 so the initial weights all need to be divided by the 0.8, and we get the “exponentially weighted moving average” ewma.

ewma(n) =

x(n)*0.8+x(n-1)*0.8*0.2+x(n-2)*0.8*0.04+x(n-3)*0.8*0.008+x(n-)*0.8*0.0016 + …… where n is the time variable, in the form 1, 2, 3, 4, …

A quick look at this shows that ewma(n-1) is buried in the right hand side, and we can see that ewma(n) = 0.2*ewma(n-1) + 0.8*x(n),

which makes the progressive calculations very simple.

In words, the next value of the ewma is a weighted average of the previous value of the ewma and the new data value. (0.2 + 0.8 = 1)

The weighting we have just worked out is not very useful, as it pays too much attention to the new data, and the ewma will therefore be almost as jumpy as the data. Better values are in the range 0.2 to 0.05 as you can see in the following pictures, in which the k value is the weighting of the data value x, and the weighting of the ewma value is then (1-k):

So the general form is ewma(n) = (1-k)*ewma(n-1) + k*x(n)

With k=0.5 we do not get a very good idea of the general level of the sequence, as the ewma value is halfway between the data and the previous ewma value, so we try k=0.1

Much better, in spite of my having increased the random range from 4 to 10.

Going back to random=4, but giving the data an upward drift the ewma picks up the direction of the drift, but fails to provide a good estimate of current data value. This can be fixed by modifying the ewma formula. A similar situation arises when the data values rise at first and then start to fall (second picture)

Common sense says that to reduce the tracking error for a drifting sequence it is enough to increase the value of k. But that does not get rid of the error. We need a measure of error which gets bigger and bigger as long as the error persists. Well, one thing certainly gets bigger is the total error, so let us use it and see what happens.

Writing the error at time n as err(n), and the sum of errors to date as totalerr(n) we have

err(n) = x(n) – ewma(n), and totalerr(n) = totalerr(n-1) + err(n)

Then we can incorporate the accumulated error into the ewma formula by adding a small multiple of totalerr(n) to get

ewma(n) = ewma(n) = (1-k)*ewma(n-1) + k*x(n) + h*totalerr(n)

In the first example below h = 0.05, and in the second h = 0.03, as things were too lively with h=0.05.

A good article on moving averages is:

http://www.mcoscillator.com/learning_center/kb/market_history_and_background/who_first_came_up_with_moving_averages/

In my next post I will show how the exponentially weighted moving average can be described in the language of discrete time feedback systems models, as used in modern control systems, and with luck I will get as far as the z-transfer function idea.

Filed under algebra, computer, discrete model, engineering, errors, forecasting, math, statistics, time series, Uncategorized

Following a recent blog post relating a transformation of points on a line to points on another line to the graph of the equation relating the input and output I thought it would be interesting to explore the linear and affine mappings of a plane to itself from a geometrical construction perspective.

It was ! (To me anyway)

These linear mappings (rigid and not so rigid motions) are usually approached in descriptive and manipulative ways, but always very specifically. I wanted to go directly from the transformation as equations directly to the transformation as geometry.

Taking an example, (x,y) maps to (X,Y) with the linear equations

X = x + y + 1 and Y = -0.5x +y

it was necessary to construct a point on the x axis with the value of X, and likewise a point on the y axis with the value of Y. The transformed (x,y) is then the point (X,Y) on the plane.

The construction below shows the points and lines needed to establish the point(X,0), which is G in the picture, starting with the point D as the (x,y)

The corresponding construction was done for Y, and the resulting point (X,Y) is point J. Point D was then forced to lie on a line, the sloping blue line, and as it is moved along the line the transformed point J moves on another line

Now the (x,y) point (B in the picture below, don’t ask why!) is forced to move on the blue circle. What does the transformed point do? It moves on an ellipse, whose size and orientation are determined by the actual transformation. At this point matrix methods become very handy.(though the 2D matrix methods cannot deal with translations)

All this was constructed with my geometrical construction program (APP if you like) called GEOSTRUCT and available as a free web based application from

http://www.mathcomesalive.com/geostruct/geostructforbrowser1.html

The program produces a listing of all the actions requested, and these are listed below for this application:

**Line bb moved to pass through Point A **

** New line cc created, through points B and C **

** New Point D **

** New line dd created, through Point D, at right angles to Line aa **

** New line ee created, through Point D, at right angles to Line bb **

** New line ff created, through Point D, parallel to Line cc **

** New point E created as the intersection of Line ff and Line aa **

** New line gg created, through Point E, at right angles to Line aa **

** New line hh created, through Point B, at right angles to Line bb **

** New point F created as the intersection of Line hh and Line gg **

** New line ii created, through Point F, parallel to Line cc **

** New point G created as the intersection of Line ii and Line aa**

*G is the X coordinate, from X = x + y + 1 (added by me)*

**New line jj created, through Point G, at right angles to Line aa **

** New line kk created, through Point D, at right angles to Line cc **

** New point H created as the intersection of Line kk and Line bb **

** New point I created, as midpoint of points H and B **

** New line ll created, through Point I, at right angles to Line bb **

** New point J created as the intersection of Line ll and Line jj**

*J is the Y coordinate, from Y = -x/2 + y (added by me)*

*and K is the transformed point (X,Y) Point J chosen as the tracking point (added by me)*

**New Line mm **

** Point D moved and placed on Line mm**

Filed under algebra, conics, construction, geometrical, geometry app, geostruct, math, ordered pairs, rigid motion, teaching, transformations, Uncategorized