Matrices Multiplication

October 17, 2009 Leave a comment

Now after we have Introduced Matrices and Explained Basic Matrices Operations in our previous blogging Matrix Algebra – An Introduction & Basic Operations we have introduced the following operations

  • Matrices Constant Multiplication.
  • Matrices Addition.
  • Matrices Subtraction.

Today we will discuss the operation of Matrices Multiplication .
Let’s consider the following case : A company have two types of employees Permanent Employees and Contracted Employees we assume 40% of contracted Employees move to Permanent employees and 10% of Permanent employees moves to be contracted employees. Assume C be the contracted employees and P be Permanent employees. So after one yes the Permanent Employees population will be
0.9 P + 0.4 C
and the contracted employees population will be
0.6 C + 0.1 P
After 2 years the Permanent employees count will be 0.9(0.9 P + 0.4 C) + 0.4 (0.1 P + 0.6 C)
And Contracted Employees will be 0.6 (0.6 C + 0.1 P) + 0.1 (0.9 P + 0.4 C)
Is there a more concise way to represent company population after certain years ?!
ok , we speak about Matrices so you know that i’ll say the Matrices will do the job , yes it’s.
Let us represent the two populations in one table (meaning a column object with two entries):

Matrices_2-01

So after one year the table which gives the two populations is

Matrices_2-02

If we consider the following rule (Product of two Matrices)
Matrices_2-03

 

let’s apply this on the population increase as follow

Matrices_2-04

 and from the previous rule we can see the result

Matrices_2-05 

And after 2 years the population could be

Matrices_2-06

 and the result will be

 

Matrices_2-07

Which is the requested result as stated before , so we can conclude that matrix’s representation can give us more simple and neat solution to such cases.

So let’s go deeper and explain how Matrices Multiplication is done , let’s consider

Matrices_2-03

how the process is done , we multiply each row in first matrix into every column in second matrix i.e 1st row in 1st matrix into 1st column in second matrix (aP + bC) and this give us the first row in the result & 2nd row in the first Matrix into 1st Column in second Matrix (cP + dC) and this gives us the second row in the resultant Matrix

We can see that for the Matrix’s Multiplication we don’t have to have two matrices with the same size but we only need the number or columns of the first matrix = number of rows in the second matrix. like

Matrices_2-08

And we must to know that the above condition is a Must of matrices multiplication and the following operation is impossible to be done

Matrices_2-09

So we will take care when speaking about matrices multiplication , we can’t say multiplication of matrices A and B because A x B and B x A are not equal even A and B are equal in size.let’s take this example to validate this rule

Matrices_2-10

then

Matrices_2-11

and

Matrices_2-12

so the rule is Matrices Multiplication is not commutative and the order of matrices in multiplication process is a must condition.

let’s see the following example and see what we conclude.

Matrices_2-13

this means that Multiplication of Two non zero matrices may give a Zero matrix.

 

Categories: Math, Software Engineering

Matrix Algebra – An Introduction & Basic Operations

October 15, 2009 1 comment

Why Matrices Algebra

The discovery of Matrices and Determinant returns back to 18th & 19th centuries it was initially used for solving problems of

  • Transformation of geometric objects.
  • Systems of linear equations

After that with the spread of the computers and the rapid development of computer technology the matrix’s algebra became an important basic for many of computer since related issues , we can state here some of them

  • Graph Theory.
  • Theory of  Games.
  • Computer Graphics and Computed Tomography
  • Cryptography.

So we can conclude that every Software Engineer must know this very important branch of algebra.

Basic Operations :

Let’s consider the following case to know start dealing with Matrix , let’s consider 2 companies have expenses that need to be recorded monthly like salaries, Running Costs,Cost of Goods,…. let’s limit this to salaries and Running Costs and Taxes , Now how would one represent the data collected , many ways exists to do this but the Matrix has the advantage of combining the data so it’s easy to manipulate them , so we writes the data as follow
Matrix1-01

 and if we are not confusing about what this values is for we can write it as follow

Matrix1-02

this is what called Matrix , size is the matrix is defined by two factors number of Rows and number of Columns as in our example the above matrix has 2 rows and 3 columns i.e 2×3 matrix as general we represent the matrix size on the form nxm where n is the number of rows and the m is the number of columns

for our example if we need to represent the 1st 3 mouthes data this could be a follow
Matrix1-03

now if we need to calculate the first quarter companies expenses what we would do ?
for example for salaries for company 1 the result could be 1000 + 1200 + 800 ,here we can come to one of Matrices operation which is the Matrices’s addition which is done by adding the entries one by one as follow

Matrix1-04

now what can we do to double the matrix ? clearly we can add it to itself as follow
Matrix1-05

 

which implies

Matrix1-06

So we can conclude the following rule

Matrix1-07

 

 

for any constant x we can write

 Matrix1-08

 

Which is the Matrecies’s operation Called Matrix Constant Multiplication or Mmultiplication of a Matrix By a Number , keeping in mind we write the constant to the left of the matrices in the case of multiplication.

now we come to the Subtraction Operation it’s a combination of the above 2 rules i.e

M-N=M+(-1)N
so we multiply N with -1 then add it to M.

Examples :
Consider the following Matrices
Matrix1-09

 Lets calculate the following values

  • 2M1 – M2
  • M3+M1-3M2
  • M3+M2

Matrix1-10

Matrix1-11

 

 

Matrix1-12

Categories: Math, Software Engineering

Software Architect Simple Way 2 of??

October 14, 2008 Leave a comment
SDI Models Paradigm
SDI Models Paradigm

 

Background

 

In Our previous article we spoke about 4+1 paradigm that give the software architect deep and comprehensive view of the software system as all and the ability to break down the system into a series of views.

 

And we have discussed how every of it’s view is implemented and benefits of each.

 

Introduction

 

Today we will speak about another point of view for the Software System under construction by the system architect the view depends of the nature of software process it self this is called SDI paradigm of (Static – Dynamic – Implementation Paradigm).

 

As it’s clear form paradigm name it’s based on showing the dynamic and static and implementation (which is a subset of static) aspects of the software system under construction.

 

We will speak in this article following the outlines

 

1-Introduce each aspect and why it’s important in the software architecture process.

2-Specify the UML diagrams which is used to introduce this aspect.

3-Finally we give a simple comparison between these aspects.

 

Static Models

 

It shows the structural characteristics of the system, and gives the architect a deep view into the structure of being designed system. We can conclude its benefits into the following points.

 

  • Shows System’s Structure.
  • Emphasizes the parts that make up the system
  • Defines classes names, attributes, methods signatures and packages.

 

The static models consist of one or all of the following diagrams.

 

     · Class diagram

  • Object diagram.
  • Use case diagram.

 

Dynamic Models

 

It shows the behavioral characteristics of the system and give the software architect a logical overview of how the different component of the system will interact and how the things will be driven to happen. We can summarize its benefits and uses in the following points

  • Shows the system behavior in response to different events.
  • Identify the needed object and how they interact among them using the event and functions.
  • Help in designing logic and behavior of the system.

 

And the following UML diagrams are used to represent the dynamic view of the system.

 

  • Sequence diagram.
  • Communication diagram.
  • State diagram.
  • Activity diagram.

 

Implementation Models

 

They are as stated previous a sub set of static models that give us a view for which is needed to be deployed as a part of the software system. And its benefits is

 

  • Shows the different elements the system needs to be deployed.
  • Organize the software components and other physical resources such as hardware and connection paths.

 

The UML diagram that represents the implementation models are

  • Component diagrams.
  • Deployment diagrams.

 

Static – Dynamic Final Note

 

Which models is best for which situation?

 

  • Static diagrams (especially class diagrams) give developers’ detailed information about classes, data types, parameters and namespaces. And considered as the backbone of the UML system.
  • Dynamic diagrams such as sequence and communication diagrams helps in defining Objects and how they are interact so don’t skimp the dynamic models they are equally important by the static one.
  • All software process management methodologies recommend developing these models in parallel at the same time.

Software Architect Simple Way 1 of ??

October 6, 2008 1 comment

Introduction

In your way for Software Architecture you must pass throw the milestone of learning how to transform your ideas , thoughts and users requirements to a well designed easy to understood and more importantly standard output .

The tools that enable any software architect to do this are UML Diagrams.

UML or Unified modeling language is the tools that transform software architect ideas and user requirements into a standardized model that is easy to be share with your software team of developers and project manager. It was invented in analogy to civil architecture designs.

4+1 Model

In this first article we will introduce the different views that you may use to look into your software system in design , there are many methodologies to do this but one of the most proven and flexible methodologies is 4+1 Views method , which developed by Philippe Kruchten in 1995.

 

It consists of 4 different views for the software system from development view point plus one view from prospective of the outside world.
For each one of this views it have its own set of UML diagrams that constructs the view, we will discuss each of this views in the following sections.

 

Logical View

The aim of logical view of the software is to have a representation for the software logic and the links between its parts; we can summarize its benefits in the following points.

·         Show the parts that comprise the system as well as their interactions.

·         Represents a set of Abstractions.

·         Emphasizes classes and objects.

We use 5 different diagrams to show the logical view of the system and they are

·         Class Diagram.

·         Communication Diagram.

·         State Diagram.

·          Sequence Diagram.

·         Object Diagram.

I prefer to call them CCSSO diagrams; we will discuss each of them in a separate article during this series.

Process View

The process view from its name describes the system’s process and its communications.

It’s helpful when you have a system that consists from a number of simultaneous processes or threads; we can summarize its benefits in the following points.

·         Describes a system’s processes.

·         Shows communications between processes.

·         Explores what needs to happen inside the system.

And the sole UML diagram that represents the Process View is the Activity Diagram.

Physical View

It’s a look into the system that gives us the following benefits.

·         Models system execution environment.

·         Maps software artifacts onto the hardware that hosts them.

And like the Process View, Physical View also have a sole UML diagram that represents itDeployment Diagram.

 Development View

This view embraces developer’s point of view to the software system under development, and can be utilized to do the following.

·         Describes the system module including packages, sub-systems and class libraries.

·         Gives a building block view of the system.

·         Helps to manage system layers.

And there is 2 UML diagrams shows the developments view, and they are

·         Package Diagram.

·         Component Diagram.

Use Case View

Finally the +1 view, Use Case View and as stated before it’s the view that act as a bridge between the outside world and your system, we can use it as follow.

·         Capture users and stakeholders goals and scenarios.

·         Shows the system’s functionality.

·         Defining and Explaining the structure of the other four views.

·         Offers and outside world perspective to the system.

And unlike the other four views the Use Case view not consists only from UML diagram, but consists from.

·         UML Use Case Diagram.

·         Written Use Cases.

·         User requirements document and specifications.

I hope at the end of this article that I could cover the 4+1 model and all the points are clear and don’t hesitate to contact me to give your comments.

Follow

Get every new post delivered to your Inbox.