0% found this document useful (0 votes)
51 views12 pages

Dca2101 Computer

The document contains solutions to various numerical methods problems related to computer applications. It includes derivations for Laplacian and gradient equations, Lagrange interpolation for given points, linear regression for best fitting lines, and the application of Euler's method for solving a differential equation. Additionally, it discusses conditions for unique, infinite, and no solutions for a system of equations.

Uploaded by

tempmymailhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views12 pages

Dca2101 Computer

The document contains solutions to various numerical methods problems related to computer applications. It includes derivations for Laplacian and gradient equations, Lagrange interpolation for given points, linear regression for best fitting lines, and the application of Euler's method for solving a differential equation. Additionally, it discusses conditions for unique, infinite, and no solutions for a system of equations.

Uploaded by

tempmymailhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

SESSION APRIL 2024

PROGRAM BACHELOROF COMPUTER APPLICATIONS (BCA)


SEMESTER III
COURSE CODE & NAME DCA2101 - COMPUTER ORIENTED NUMERICAL
METHODS
STUDENT NAME SANDEEP MALIK
ROLL NO 2314108603

SET-I

1. Show that
(a) δμ= 1/2(∆+∇)
(b) ∆-∇=∆∇

Ans 1.
a) To show that δμ=1/2(∆+∇), we can start with the definition of the Laplacian (δ) and the
gradient (∇):
δf = ∇²f = ∇•∇f
Now, let's consider the Laplacian of a function μ:
δμ = ∇²μ = ∇•∇μ
Next, we can use the identity that relates the Laplacian and the gradient:
∇•(∇μ) = ∇²μ
Now, we can rewrite the Laplacian of μ using the gradient:
δμ = 1/2(∇•∇μ + ∇•∇μ)
From the definition of the vector dot product, we know that ∇•∇μ = ∇μ•∇μ, so:
δμ = 1/2(∇μ•∇μ + ∇μ•∇μ)
Simplifying this, we get:
δμ = 1/2(2∇μ•∇μ)
And finally:
δμ = ∇μ•∇μ

b) To show that ∆-∇=∆∇, we can start with the definition of the Laplacian (∆) and the
gradient (∇):
∆f = ∇•∇f
∇f = ∇f
Now, let's consider the expression ∆-∇:
∆-∇ = ∇•∇ - ∇
We can factor out ∇ from the first term:
∇•∇ - ∇ = ∇(∇•∇ - 1)
Now, using the definition of the Laplacian, we can replace ∇•∇ with ∆:
∇(∇•∇ - 1) = ∇∆
So, we have shown that ∆-∇=∆∇.

2. Find Lagrange’s interpolation polynomial fitting the pointsy(1) = -3,y(3)= 0,y(4)= 30,
y(6) = 132 Hence find y(5).

Ans 2.
Step 1: Find the Lagrange basis polynomials
For each point, we need to create a Lagrange basis polynomial that has a value of 1 at that point
and a value of 0 at all other points. We'll use these polynomials to build the final interpolation
polynomial.

For example, for the point (1, -3), the Lagrange basis polynomial is:

L1(x) = (x - 3)(x - 4)(x - 6) / ((1 - 3)(1 - 4)(1 - 6))

Simplifying this expression, we get:


L1(x) = (x - 3)(x - 4)(x - 6) / (-2 × (-2) × (-4))
= (x - 3)(x - 4)(x - 6) / 16

Step 2: Construct the interpolation polynomial

The interpolation polynomial is a sum of the Lagrange basis polynomials multiplied by the
corresponding y-values. In our case, we have:

P(x) = L1(x)y(1) + L2(x)y(3) + L3(x)y(4) + L4(x)y(6)

where L2(x), L3(x), and L4(x) are the Lagrange basis polynomials for points (3, y(3)), (4, y(4)),
and (6, y(6)), respectively.

Plugging in the values, we get:

P(x) = L1(x)(-3) + L2(x)0 + L3(x)30 + L4(x)132

Step 3: Find y(5)

Now that we have the interpolation polynomial P(x), we can evaluate it at x = 5 to find y(5):

y(5) = P(5)
= L1(5)(-3) + L2(5)0 + L3(5)30 + L4(5)132
= (-8/16)(-3) + (0) + (10/16)(30) + (15/16)(132)
= (-24)/16 + (300)/16 + (1980)/16
= (-24 + 300 + 1980)/16
= 2156/16
= 135

So, the value of y at x = 5 is y(5) = 135


3. Evaluate , given the following table of values:

10 20 30 40 50
46 66 81 93 101

Ans 3.

To evaluate f(15) given the table of values, we need to interpolate the value of y corresponding
to x = 15.

Looking at the table, we can observe that the values of x are evenly spaced by 10 units. To
interpolate, we can use linear interpolation.

First, let's find the interval in which 15 lies:

- x = 10 corresponds to y = 46

- x = 20 corresponds to y = 66

Now, using linear interpolation formula:

where:

- x₁ = 10

- x₂ = 20

- y₁ = 46

- y₂ = 66

- x = 15

Substituting the values:


f(15) = 56

So, f(15) = 56.

SET-II

4. Find the equation of the best fitting straight line for the data:

X 1 3 4 6 8 9 11 14
Y 1 2 4 4 5 7 8 9

Ans 4.
Linear Regression is a method to model the relationship between two continuous variables, X
and Y. In this case, we have a set of data points (X, Y) and we want to find the best straight line
that fits these data points.

To find the equation of the best fitting straight line, follow these steps:

1. Plot the data: Start by plotting the data points (X, Y) on a graph. You should see a scatter plot
with a collection of points.
2. Calculate the means: Calculate the mean (average) of X and Y. You can do this by adding up
all the values and dividing by the number of data points.

Mean of X (μX) = (1 + 3 + 4 + 6 + 8 + 9 + 11 + 14) / 8 = 56 / 8 = 7


Mean of Y (μY) = (1 + 2 + 4 + 4 + 5 + 7 + 8 + 9) / 8 = 40 / 8 = 5

3. Calculate the deviations: Calculate the deviation of each X value from the mean μX. These
deviations are called "x-values".

x1 = 1 - 7 = -6
x2 = 3 - 7 = -4
x3 = 4 - 7 = -3
x4 = 6 - 7 = -1
x5 = 8 - 7 = 1
x6 = 9 - 7 = 2
x7 = 11 - 7 = 4
x8 = 14 - 7 = 7

4. Calculate the slope (m): Calculate the slope (m) of the line using the following formula:

m = Σ(x * y) - (Σx * Σy) / Σ(x^2) - (Σx)^2

Where:

Σ(x * y) is the sum of the product of x and y values.


Σx is the sum of x values.
Σy is the sum of y values.
* Σ(x^2) is the sum of squared x values.

Let's calculate these values:

Σ(x * y) = (1*-6) + (-4*2) + (-3*4) + (-1*4) + (1*5) + (2*7) + (4*8) + (7*9)


= -6 + (-8) + (-12) + (-4) + (5) + (14) + (32) + (63)
= 128
Σx = -6 + (-4) + (-3) + (-1) + (1) + (2) + (4) + (7)
= -12

Σy = 1+2+4+4+5+7+8+9
=40

Σ(x^2) = (-6)^2+(-4)^2+(-3)^2+(-1)^2+(1)^2+(2)^2+(4)^2+(7)^2
=36+16+9+1+1+4+16+49=133

Now, calculate the slope:

m = Σ(x * y) - (Σx * Σy) / Σ(x^2) - (Σx)^2


= 128 - (-12*40) / (133 - (-12)^2)
= 128 - (-480) / (133-144)
= -(480-128)/(-11)
= -(352)/(-11)
= approximately m ≈ 32.00

5. Calculate the intercept (b): Finally, calculate the intercept (b) using the formula:

b = μY - m * μX

Substituting the values, we get:

b=5-m*7
= 5 - approximately m * 7
= approximately b ≈ 5 - approximately m * 7
= approximately b ≈ 5 - approximately (32.00 * 7)
= approximately b ≈ -15
The Equation of the Best Fitting Straight Line:

Now that we have calculated the slope and intercept, we can write the equation of the best fitting
straight line as:

Y≈m*X+b
Y ≈ approximately m * X ≈ approximately b
Y ≈ approximately m * X ≈ approximately b ≈ approximately -15

In this case, the equation is approximately:

Y ≈ approximately -15.0x^64.0

This equation represents the best fitting straight line that passes through your data points.

5. For what value of λ & μ the following system of equations:


x+y+z=6
x +2y+3z =10
x+2y +λz =μ may have
(i) Unique solution
(ii) Infinite number of solutions
(iii) No solution

Ans 5.
To determine the values of λ and μ that result in each type of solution, we can use the properties
of systems of equations.
(i) For a unique solution:
 The rank of the coefficient matrix should be equal to the rank of the augmented matrix.
 The determinant of the coefficient matrix must be non-zero.
(ii) For an infinite number of solutions:
 The rank of the coefficient matrix should be less than the rank of the augmented matrix.
 The determinant of the coefficient matrix should be zero.
(iii) For no solution:
 The rank of the coefficient matrix should be less than the rank of the augmented matrix.
 The determinant of the coefficient matrix should not be zero.
Now let's apply these properties to our system of equations:
x + y + z = 6 (Equation 1)
x + 2y + 3z = 10 (Equation 2)
x + 2y + λz = μ (Equation 3)
To find the ranks, we need to form the coefficient and augmented matrices:
Coefficient matrix:

111

123

12λ
Augmented matrix:

111|6

1 2 3 | 10

12λ|μ
Now, let's find the determinant of the coefficient matrix using the formula for a 3x3 matrix:

Determinant = (1 * 2 * λ) + (1 * 3) + (1 * 2) - (λ * 2 * 1) - (1 * 3) - (1 * 2)

Determinant = 2λ + 3 + 2 - 2λ - 3 – 2
Determinant = λ - 3
To determine the type of solution, we need to consider the determinant and rank:
(i) Unique solution:
The determinant is non-zero, and the ranks of the coefficient and augmented matrices are equal.
(ii) Infinite number of solutions:
The determinant is zero, and the rank of the coefficient matrix is less than the rank of the
augmented matrix.
(iii) No solution:
The determinant is not zero, and the rank of the coefficient matrix is less than the rank of the
augmented matrix.
So, with the given information, we can't determine specific values for λ and μ that result in each
type of solution without additional information. However, we know the conditions required for
each type of solution.

6. Find the solution for x=0.2 taking interval length 0.1 using Euler’s method to solve:
dy/dx=1-y given y(0)=0.

Ans 6.

Step 1: Understand the problem

We have the differential equation:

dy/dx = 1 - y

with the initial condition:

y(0) = 0
We want to find the solution y(x) at x = 0.2 using Euler's method with an interval length of 0.1.

Step 2: Initialize

We'll start by setting up the initial conditions:

x = 0, y = 0 (given)

Step 3: Calculate the slope

To calculate the slope, we'll use the differential equation:

dy/dx = 1 - y

Substituting x = 0 and y = 0, we get:

dy/dx = 1 - 0 = 1

So, the slope at x = 0 is 1.

**Step 4: Calculate the first estimate**

We'll use Euler's method to calculate the first estimate of y at x = 0.1. We'll take a small step of
size 0.1:

x_new = x + h = 0 + 0.1 = 0.1


y_new = y + h \* (dy/dx) = 0 + 0.1 \* (1) = 0.1

So, our first estimate of y at x = 0.1 is y ≈ 0.1.


Step 5: Repeat the process

We'll repeat the process until we reach x = 0.2. We'll take smaller steps of size 0.1 and update
our estimate of y accordingly.

Here's the calculation:

Step x y dy/dx h y_new


1 0 0 1 0.1 0.1
2 0.1 0.1 0.9 0.1 0.19
3 0.2 ? ? ? ?

Let's calculate the next step:

dy/dx ≈ 1 - y ≈ 1 - 0.19 ≈ 0.81


y_new ≈ y + h \* (dy/dx) ≈ 0.19 + 0.1 * (0.81) ≈ 0.289

So, our estimate of y at x = 0.2 is approximately y ≈ 0.289.

Conclusion

Using Euler's method with an interval length of 0.1, we found that the solution to the differential
equation dy/dx = 1 - y with initial condition y(0) = 0 at x = 0.2 is approximately y ≈ 0.289.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy