Sie sind auf Seite 1von 6

FALL 2013, ASSIGNMENT

PROGRAM BCA (REVISED 2012) SEMESTER III


SUBJECT CODE & NAME BCA3010 COMPUTER
ORIENETED NUMERICAL METHODS

Q.No 1 If 2/3 is approximated by 0.667, find the absolute and relative errors.
Answer:
Absolute, relative and percentage errors:
An error is usually quantified in two different but related ways. One is known as absolute error and the
other is called relative error.
Let us suppose that true value of a data item is denoted by xt and its approximate value is denoted by xa.
Then, they are related as follows:
True value xt = Approximate value xa + Error
The error is then given by:
Error = xt - xa

The error may be negative or positive depending on the values of xt and xa. In error analysis, what is
important is the magnitude of the error and not the sign and, therefore, we normally consider what is
known as absolute error which is denoted by

ea = | xt xa |

In general absolute error is the numerical difference between the true value of a quantity and its
approximate value.

In many cases, absolute error may not reflect its influence correctly as it does not take into account the
order of magnitude of the value. In view of this, the concept of relative error is introduced which is
nothing but the normalized absolute error. The relative error is defined as
Absolute error of 2/3= 0.001666666...
Relative error of 2/3 = 0.0024999 approx

2 Find the maximum error in y where y= FL48EI where F=50, L=30, E=1.5108, I=0.06,
F=2, L=0.1, E=0.01108, I=0.0006
Answer: "The margin of error is a statistic expressing the amount of random sampling error in a survey's
results. The larger the margin of error, the less faith one should have that the poll's reported results are
close to the "true" figures; that is, the figures for the whole population. Margin of error occurs whenever a
population is incompletely sampled." The basic confidence interval for a symmetric distribution is set up
to be the point estimate minus the maximum error of the estimate is less than the true population
parameter which is less than the point estimate plus the maximum error of the estimate. This formula will
work for means and proportions because they will use the Z or T distributions which are symmetric.
Maximum error: y= FL48EI where F=50, L=30, E=1.5108, I=0.06,
F=2, L=0.1, E=0.01108, I=0.0006

3 Given u0=1, u1=11, u2=21, u3=28, u4=29 find .4u0 without forming difference table
Aanswer: u0=1, u1=11, u2=21, u3=28, u4=29=4u0

4 Using NewtonRaphson method, establish the formula xn + 1= nn1N(x)2x. to calculate


the square root of N. Hence find the square root of 5 correct to four places of decimals.
Answer: The square root of a number N is commonly represented by: N
It can also be represented by:

In exponential notation, it can be represented by: N1/2


"Square root" can be abbreviated as "sqrt" Example: sqrt(2) = 1.4142136

Thus all of the following are equivalent:


Square Root of N = N

= N1/2 = sqrt(N)

(With the exception that the radical sign refers to the principal (positive) square root only.)
The square root of 5 is the positive real number that, when multiplied by itself, gives the prime
number 5. It is more precisely called the principal square root of 5, to distinguish it from the negative
number with the same property. This number appears in the fractional expression for the golden ratio. It
can be denoted in surd form as:

It is an irrational algebraic number.[1] The first sixty significant digits of its decimal expansion are:
2.23606 79774 99789 69640 91736 68731 27623 54406 18359 61152 57242 7089...
(sequence A002163 in OEIS).
which can be rounded down to 2.236 to within 99.99% accuracy. As of April 1994, its numerical
value in decimal had been computed to at least one million digits

5 Solve by LU decomposition method, the following system of equations


2x + y + 4z = 12
4x + 11y z = 33
8x 3y + 2z = 20.

Answer: In linear algebra, LU decomposition (where 'LU' stands for 'Lower Upper', and also called LU
factorization) factors a matrix as the product of a lower triangular matrix and an upper triangular matrix.
The product sometimes includes a permutation matrix as well. The LU decomposition can be viewed as
the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations
using the LU decomposition, and it is also a key step when inverting a matrix, or computing the
determinant of a matrix.

6 Using power method find the largest Eigen value and the corresponding Eigen vector of the matrix A =,
carry out 5 iterations by taking X (0) = (1, 0, 0) t. 2512130204...........

Answer: Syntax
d

[V,D]

eigs(A)
=

[V,D,flag]

eigs(A)
=

eigs(A)

eigs(A,B)
eigs(A,k)
eigs(A,B,k)
eigs(A,k,sigma)
eigs(A,B,k,sigma)
eigs(A,K,sigma,opts)
eigs(A,B,k,sigma,opts)
eigs(Afun,n,...)
Description
d = eigs(A) returns a vector of A's six largest magnitude eigenvalues. A must be a square matrix. A should
be large and sparse, thougheigs will work on full matrices as well. See Tips below.
[V,D] = eigs(A) returns a diagonal matrix D of A's six largest magnitude eigenvalues and a matrix V whose
columns are the corresponding eigenvectors.
[V,D,flag] = eigs(A) also returns a convergence flag. If flag is 0 then all the eigenvalues converged;
otherwise not all converged.
eigs(A,B) solves the generalized eigenvalue problem A*V == B*V*D. B must be the same size as A. eigs(A,
[],...) indicates the standard eigenvalue problem A*V == V*D.
eigs(A,k) and eigs(A,B,k) return the k largest magnitude eigenvalues.
eigs(A,k,sigma) and eigs(A,B,k,sigma) return k eigenvalues based on sigma, which can take any of the
following values:
scalar (real or The eigenvalues closest to sigma. If A is a function, Afun must
complex,

return Y = (A-sigma*B)\x (i.e., Y = A\xwhen sigma = 0).

including 0)
'lm'

Largest magnitude (default).

'sm'

Smallest

magnitude.

Same

as sigma =

0.

If A is

function, Afun must return Y = A\x.


For real symmetric problems, the following are also options:
'la'

Largest algebraic ('lr' )

'sa'

Smallest algebraic ('sr' )

'be'

Both ends (one more from high end if k is odd)

For nonsymmetric and complex problems, the following are also options:

'lr'

Largest real part

'sr'

Smallest real part

'li'

Largest imaginary part

'si'

Smallest imaginary part

Note The syntax eigs(A,k,...) is not valid when A is scalar. To pass a value for k,
you must specify B as the second argument and kas the third (eigs(A,B,k,...)). If
necessary, you can set B equal to [], the default.
eigs(A,K,sigma,opts) and eigs(A,B,k,sigma,opts) specify an options structure. Default values are shown in
brackets ({}).
Paramete
r

Description

Values

opts.issym

1 if A or A-sigma*B represented

by Afun is [{0} | 1]

symmetric, 0otherwise.
opts.isreal

1 if A or A-sigma*B represented

by Afun is [0 | {1}]

real, 0otherwise.
opts.tol
A*x

Convergence:
Ritz
estimate
residual <= [scalar | {eps}]
if sigma is not specified, or is a string other than 'sm'
tol*norm(A).
A\x
if sigma is 0 or 'sm'
opts.maxit Maximum number of iterations.
[integer | {300}]
(Aif sigma is a nonzero scalar (standard eigenvalue problem). I is an
opts.p
Number
of
Lanczos
basis
vectors. [integer | {2*k}]
sigma*I)\x
identity matrix of the same size as A.
p >= 2k (p >= 2k+1 real nonsymmetric)
(Aif sigmapmust
is a nonzero
scalar
problem)
advised.
satisfy
k <(generalized
p <= n for eigenvalue
real
sigma*B)\x symmetric, k+1 < p

<=

[n-by-1 vector |
{randomly
generated
byrand}]

opts.disp

Diagnostic information display level.

opts.cholB

1 if B is

its

[{0} | 1 | 2]
Cholesky [{0} | 1]

factor chol(B), 0 otherwise.

unless

vector permB if
specified

handle, Afun, instead


of the matrix A.
y = Afun(x) should
return:

how

to

provide

additional
parameters

to

function Afun,

the
if

necessary.
The

matrix A, A-

sigma*I or Asigma*B represented

sparse B is [permB | {1:n}]

reallychol(B(permB,permB)).
nonsymmetric

function

Functions explains

Starting vector.

opts.permB Permutation

Parameterizing

algorithm uses at least 20 Lanczos vectors.

really

n otherwise.

Note: If you do not specify a p value, the default

opts.v0

eigs(Afun,n,...) accept

by Afun is assumed to
be

otherwise

byopts.isreal and opts.issym.

the eigs syntaxes, eigs(A,...) can be replaced by eigs(Afun,n,...).

real
In

and
all

Das könnte Ihnen auch gefallen