Popular Posts

Assignment 3

Saturday, March 3, 2012

 The following program solves problem 1,2,3 and 4 together ......




!     Last change:  R    18 May 2011    2:33 am
program matrix_calculation
DIMENSION a(100,100),T(100,100)
Integer::a,n,T                                ! T is identity matrix
OPEN(1,FILE='inp.dat')
OPEN(2,FILE='otp.dat')
READ(1,*)n,((a(i,j),j=1,n),i=1,n), ((T(i,j),j=1,n),i=1,n)
WRITE(2,*)'Matrix A:='
WRITE(2,*)'   '
call mat(a,n)                                 ! Calling subroutine 'mat'
WRITE(2,*)'    '
call add(a,n)                                 ! Calling subroutine 'add'
WRITE(2,*)'    '
call mult(a,n)                                ! Calling subroutine 'mult'
WRITE(2,*)'   '
call trace(a,n)                               ! Calling subroutine 'trace'
WRITE(2,*)'   '
call sumadl(a,n)                              ! Calling subroutine 'sumadl'
WRITE(2,*)'   '
call sumbdl(a,n)                              ! Calling subroutine 'sumadl'
WRITE(2,*)'   '
call sym(a,n)                                 ! Calling subroutine 'sym'
WRITE(2,*)'  '
call asym(a,n)                                ! Calling subroutine 'asym'
WRITE(2,*)'  '
call idm(a,n)                                 ! Calling subroutine 'idm'
WRITE(2,*)'   '
call orth(a,n,T)                              ! Calling subroutine 'orth'
WRITE(2,*)'   '
call inv(a,n,T)                               ! Calling subroutine 'inv'
WRITE(2,*)'  '
call np(a,n)                                  ! Calling subroutine 'np'
CLOSE(1)
CLOSE(2)
stop
end program

! question no.1(i)
subroutine mat(a,n)
DIMENSION a(100,100),b(100,100)
integer::a,b,n
WRITE(2,10)((a(i,j),j=1,n),i=1,n)
10 format (3(2x,I3))
WRITE(2,*)'  '
WRITE(2,*)' Answer to the question no 1(i):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)' Transpose of Matrix A is given below'
WRITE(2,*)'   '
b=TRANSPOSE(a)
WRITE(2,11)((b(i,j),j=1,n),i=1,n)
11 FORMAT(3(2x,I3))
end subroutine

! question no.1(ii)
subroutine add(a,n)
DIMENSION a(100,100),c(100,100)
integer::a,c,n
do i=1,n
do j=1,n
c(i,j)=a(i,j)+a(j,i)
end do
end do
WRITE(2,*)' Answer to the question no 1(ii):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)'  '
WRITE(2,*)' Addition of A and transpose of A is given below  '
WRITE(2,*)'   '
WRITE(2,12)((c(i,j),j=1,n),i=1,n)
12 format (3(2x,I3))
end subroutine

! question no.1(iii)
subroutine mult(a,n)
DIMENSION a(100,100),d(100,100)
integer:: a,d,n
d(i,j)=0
do k=1,n
do i=1,n
do j=1,n
d(i,j)=d(i,j)+a(i,k)*a(k,j)
end do
end do
end do
WRITE(2,*)' Answer to the question no 1(iii):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)' Multiplication of Matrix A and A i.e A^2  '
WRITE(2,*)'    '
WRITE(2,13)((d(i,j),j=1,n),i=1,n)
13 FORMAT(3(2x,I5))
end subroutine

! question no.2(a)
subroutine trace(a,n)
DIMENSION a(100,100)
integer::a,n,tr
tr=0
do i=1,n
tr=tr+a(i,i)
end do
WRITE(2,*)' Answer to the question no 2(a):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)' '
WRITE(2,*)' Trace of Matrix A is ', tr
end subroutine

! question no.2(b)
subroutine sumadl(a,n)
DIMENSION a(100,100)
integer:: a,n,abdl
abdl=0
do i=1,(n-1)
do j=2,n
IF(i.ne.j)abdl=abdl+a(i,j)
end do
end do
WRITE(2,*)' Answer to the question no 2(b):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)' Sums the elements above the main diagonal is',abdl
end subroutine

! question no.2(c)
subroutine sumbdl(a,n)
DIMENSION a(100,100)
integer::a,n, bdl
bdl=0
do i=2,n
do j=1,(n-1)
IF(i.ne.j)bdl=bdl+a(i,j)
end do
end do
WRITE(2,*)' Answer to the question no 2(c):'
WRITE(2,*)'----------------------------------  '
WRITE(2,*)'  '
WRITE(2,*)' Sums the elements below the main diagonal line is ',bdl
end subroutine

! question no.3(a)
subroutine sym(a,n)
DIMENSION a(100,100)
integer:: a,n
WRITE(2,*)' Answer to the question no 3(a):'
WRITE(2,*)'----------------------------------  '
do i=1,n
do j=1,n
IF ((a(i,j)).NE.(a(j,i))) then
WRITE(2,*)' A is not symmetric'
return
END if
end do
end do
WRITE(2,*)' A is symmetric '
return
end subroutine

! question no 3(b)
subroutine asym(a,n)
DIMENSION a(100,100)
integer:: a,n
WRITE(2,*)' Answer to the question no 3(b):'
WRITE(2,*)'----------------------------------  '
do i=1,n
do j=1,n
IF ((a(i,j)).ne.(-(a(j,i)))) then
WRITE(2,*)' A is not antisymmetric'
return
END if
end do
end do
WRITE(2,*)' A is antisymmetric '
return
end subroutine

! question no. 4(a)
subroutine idm(a,n)
DIMENSION a(100,100),f(100,100)
INTEGER::a,n,f
WRITE(2,*)' Answer to the question no 4(a):'
WRITE(2,*)'----------------------------------  '
f=MATMUL(a,a)
do i=1,n
do j=1,n
IF ((f(i,j)).ne.(a(i,j))) Then
WRITE(2,*)' A is not Idempotent matrix'
return
END if
end do
end do
WRITE(2,*)' A is Idempotent matrix'
return
end subroutine

! question no. 4(b)

subroutine orth(a,n,T)
DIMENSION a(100,100),T(100,100),g(100,100)
INTEGER::a,T,g,n
WRITE(2,*)' Answer to the question no 4(b):'
WRITE(2,*)'----------------------------------  '
g(i,j)=0
do k=1,n
do i=1,n
do j=1,n
g(i,j)=g(i,j)+a(i,k)*a(j,k)
end do
end do
end do
WRITE(2,*)'  '
WRITE(2,*)' Multiplication of matrix A and Transpose of A is-'
WRITE(2,14) ((g(i,j),j=1,n),i=1,n)
14 FORMAT(3(2x,I5))
do i=1,n
do j=1,n
if ((g(i,j)).NE.(T(i,j))) then
WRITE(2,*)'A is not Orthogonal matrix '
return
end if
end do
end do
WRITE(2,*)' A is Orthogonal Matrix'
end subroutine

! question no. 4(c)
SUBROUTINE inv(a,n,T)
DIMENSION a(100,100),T(100,100),h(100,100)
INTEGER::a,T,h,n
WRITE(2,*)' Answer to the question no 4(c):'
WRITE(2,*)'----------------------------------  '
h=MATMUL(a,a)
do i=1,n
do j=1,n
if ((h(i,j)).NE.(T(i,j))) then
WRITE(2,*)' A is not Involuntary matrix'
return
end if
end do
end do
WRITE(2,*)' A is Involuntary matrix  '
END SUBROUTINE

! question no. 4(d)
subroutine np(a,n)
DIMENSION a(100,100),l(100,100),m(100,100)
INTEGER::a,l,m,n
WRITE(2,*)' Answer to the question no 4(d):'
WRITE(2,*)'----------------------------------  '
l=a
k=2
100 call nilpt(a,n,l,m)
WRITE(2,*) ' Product is :'
WRITE(2,50)((m(i,j),j=1,n),i=1,n)
50 FORMAT(3(2x,I8))
do i=1,n
do j=1,n
IF (m(i,j).ne.0) THEN
WRITE(2,*)' A is not nillpotent matrix'
GOTO 2
END IF
end do
end do
GOTO 3
2 WRITE(2,*)'  '
l=m
IF (k.gt.10) THEN
WRITE(2,*)' Iteration failed'
stop
END IF
k=k+1
GOTO 100
3 WRITE(2,*) ' A is nillpotent',k
return
end subroutine


subroutine nilpt(a,n,l,m)
DIMENSION a(100,100),l(100,100),m(100,100)
INTEGER::a,l,m,n
m(i,j)=0
do k=1,n
do i=1,n
do j=1,n
m(i,j)=m(i,j)+a(i,k)*l(k,j)
end do
end do
end do
end subroutine

Assignment 1


ASSIGNEMENT ONE

QUESTION 1(i):Print the positive integers from 1 to N greater or equal to 50 with three numbers to a line


!     Last change:  R     2 Mar 2012    8:03 pm
! Question number 1(I) of assignment one
PROGRAM printing_numbers
! it's a program to printing numbers from 1 to N>=50 three numbers to a line
! Input any number greater or equal to 50
PRINT*, ' Input the last Number:'
READ(*,*) N
! Here is printed the output of your desired program
WRITE(*,*)'Here is printed the output of your desired program'
WRITE(*,10)(i,i=1,n)
10 format (3(2x,I3))
END PROGRAM


QUESTION 1(II):

!     Last change:  R     2 Mar 2012    9:27 pm
! Assignment one question no 1(ii)
! the following program solve sum and product of series
program sum_and_product
1 READ(*,*) n
if (n.lt.2) then
PRINT*, 'wrong input, so recheck the condition and input the value of n again'
GOTO 1
end if
summ=0.0
productt=1.0
! now we are going to produce a formula to calculate the sum
! Let initial sum is zero wich is denoted by summ=0.0
! Now follow the loop.
do i=1,n                          ! here i starts from 1
do j=1,i                          ! if i=1 then j=1 then summ=summ+1/float(j)=0+1=1
                                  ! now the current value of summ=1
summ=summ+1.0/float(j)            ! then if i=2 then j=1,2 then summ=summ+1/float(j)
end do                            !                                 =1+(1/1)+(1/2)
end do                            ! in this way we can calculate the rest part of the program
! now we gonna calculate the product of the given series
! Let the initial product is 1.0, note theat if initial product is zero then final result
! will be also zero. to avoid complexities we define initial productt=1.0
! Now follow the loop
do i=1,n                          ! let i=1
summm=0.0                         ! summm=0 and j=1 and loop for i and j both single time
do j=1,i                          ! and then the value of sum and product both will be 1
summm=summm+1.0/float(j)          ! let i=2 then i loop will move single time and loop of j will
end do                            ! move two times
productt=productt*summm
end do
WRITE(*,10) summ,productt
10 format (2x,' the sum is: ',F10.5,//2x,' the product is: ',F10.5)
end program

Sunday, December 11, 2011

Dear friends, Its a long time i'm absent from my favorite blog... however, how are you ?

IFTER PARTY

Monday, August 8, 2011

Dear friends of Mathematics of University of Dhaka, All of you will be very glad to know that we are going to arrange an IFTER PARTY on upcoming Thursday. This party is going to be arranged by second year students. Anti-fee is only tk 100/= per persion. So dear friends, Don't miss it.... Hurry up. To contribute contact with us... 

Real analysis introduction, lecture 1, Real Analysis

Sunday, March 13, 2011

Course title: Real Analysis I
course code: MTH 201, 4 credits
Course conducted by Sapla shirin(SS)

Date :03.03.2011

Mathematical analysis studies concepts related in some way to real numbers. So we begin our study of real analysis with a discussion of the real number.

AXIOMS OF REAL NUMBERS
We assume there exists a non empty set R of objects called real numbers which satisfy the ten axioms listed bellow-

The axioms fall in a natural way into three groups which we refer to as

1. The field axioms
2. The Order axioms
3. The completeness axioms

THE FIELD AXIOMS
Along with the set of real number we assume the existence of two operations called addition and multiplication such that for every pair of real numbers x and y the sum x+y uniquely determined by x and y satisfying the following axioms
A1: Closure law of addition, for all a,b ϵ R , a + b ϵ
A2: Commutative law of addition,  for all a,b ϵ R , a + b = b+a
A3: Associative law of addition, for all a,b,c  ϵ R , a +( b+c)=(a+b)+c
A4: Existence of additive Identity,  for all a ϵ R , there exists 0 ϵ R such that a+0=0+a=a
A5: Existence of additive inverse, for all a ϵ R , there exists -a ϵ R such that a+(-a)=(-a)+a=0

********(To be continued) ********
 

Vector-valued function, Lecture no 2, Calculus II

Saturday, March 12, 2011

Date: 14.02.2011

Describing the graph of vector-valued function

Let r(t) be a vector valued fuction which  can be represented as the resultant vector of two vector called ro and v
so,
r(t) = ro + tv...........................................(1)

equation (1) represents, r(t) passes through the point of position vector ro and as the direction or parallel to v.

Example 1: a problem has taken from the book of  Haward Anton  page no: 868
problem no: 13
Describe the graph of the vector valued function given as, r(t)= (3-2t) i + 5j

Solution: Given r(t)=(3-2t) i + 5j
                                       = 3 i + 0. j + ( -2 i + 5 j ) t

According to the above theory we can say that the graph of r is a straight line in two dimensional space passing through the point (3,0)  and parallel to the line -2 i + 5 j. we can show this in figure bellow-

Example 2: Describe the graph of 
r(t)= 3cos t i +2 sin t j - k

Solution: we get x=3cos t,   y= 2sin t  and z= -1
 the relation between x and y 
 the graph of r(t) is an ellipse in the plane z=-1 at the center(0,0,-1)
major axis length is 6, parallel to X axis and minor axis length is 4, parallel to Y axis.


Example 3: Describe the graph of 
                r(t)= 2ti-3j+(1+3t)k
Solution:  Given,
                r(t)= 2ti-3j+(1+3t)k
                    = 2ti-3j+k+3tk
                    = 0.i-3j+k+(2i+0.j+3k)t

So the graph of r(t) is a straight line in three dimensional space passing through the point (0,-3,1) and as the direction or parallel to the line 2i+0.j+3k.

Example 4: Describe the graph of 
              r(t)= 2cos t i -3 sin t j + k

Solution: Given,
                        r(t)= 2cos t i -3 sin t j + k
we get, x=2cos t,  y= -3sin t  and z=1

the relation between x and y 

the graph of r(t) is an ellipse in the plane z=1, the center is (0,0,1) .

Graph Sketching 

Norm of a vector valued function : Norm of a  vector valued function r(t) is denoted by ІІr(t)ІІ and is defined by 

ІІr(t)ІІ= Sqrt ((x(t))2+ (y(t))2+ (z(t))2)

 Example 1: Show that the graph of  r(t) is a circle where 
            r(t)= sin t i + 2 cos t j +sin t k
Solution: we get  x= sin t,   y=2 cos t        z= sin t

So the  relation,
x2+ y2+ z2=sin2t+4cos2t+3sin2t
                =4(sin2t+cos2t)=4

So we get Z= x   as      z= sin t
Thus the graph of r(t) lies on the sphere  x2+ y2+ z2= 4 and on the plane  Z= x of which center is (0,0,0) and radius is  2. the figure as bellow

 






(rest of the part of lecture 2 will be published soon)