We provide Online Homework help in Mathematics, Science, Probability and Statistics, Data Science, Programming and Engineering Homework, Assignment, Projects with step by step explanation to learn definitions, formulas and concepts to solve the questions and proofs in a better ways.

Examples of Homework,, Assignment Question & Answers

Q : Simpson rule Matlab code to calculates the numerical approximation to integral x^3 from 0 to 1 with 3 subintervals?

Answer :

To calculate the numerical approximation of

\[\int_{0}^{1} x^3 dx \]

with 3 subintervals

Simpson 1/3 rule :

\[\int_{a}^{b} f(x) dx =\frac{\delta x}{3}\left(f(x_{0})+4f(x_{1})+2f(x_{2})+4f(x_{3})+…..+2f(x_{n-2})+4f(x_{n-1})+f(x_{n})\right)\]

clear all
%Simpson 1/3 rule Matlab code to calculates the numerical approximation to a definite integral
f=@(x) x.^3 % function
a=0 % left point of the interval [a, b]
b=1 % right point of the interval [a, b]
n=3 % stepsize
A=0
h=(b-a)/n
for i = 1:n
    x(i) = a +h* (i-1); 
    y(i) = f(x(i));
end
%Simpson 1/3 rule
for i = 1:n
    if ( i== 1 || i == n)
        A = A+y(i);
    elseif(rem(i,2)==1)
        A = A+4*y(i);
    else(rem(i,2)==2)
        A = A+2*y(i);
    end
end
clear all
%Simpson 1/3 rule Matlab code to calculates the numerical approximation to a definite integral
f=@(x) x.^3 % function
a=0 % left point of the interval [a, b]
b=1 % right point of the interval [a, b]
n=3 % stepsize
A=0
h=(b-a)/n
for i = 1:n
    x(i) = a +h* (i-1); 
    y(i) = f(x(i));
end
%Simpson 1/3 rule
for i = 1:n
    if ( i== 1 || i == n)
        A = A+y(i);
    elseif(rem(i,2)==1)
        A = A+4*y(i);
    else(rem(i,2)==2)
        A = A+2*y(i);
    end
end


Output:
f =

@(x) x .^ 3

a = 0
b = 1
n = 3
A = 0
h = 0.3333
ans = 0
A = 0.041152
A= 0.0411523

Q: What is a Matrix ? Explain addition, subtraction and multiplication of two matrices.

Answer :

Matrix : A matrix is an arrangement of elements into rows and columns.

Examples

  • \(\left(\begin{array}{ccc}3 & -2 & 1 \\4 & -5 & 8\\\end{array}\right)\) is a matrix with two rows and three columns.
  • \(\left(\begin{array}{ccc}2 & 3 & 4 \\3 & 2 & 1 \\4 & 6 & 8 \\\end{array}\right)\) is a matrix with three rows and three columns

Addition and Subtraction of Two Matrices : If Two matrices have equal number of rows and columns are equal then they can be added element wise.

Let \(A=\left(\begin{array}{ccc}0 & -1 & 2 \\-3 & 2 & 0 \\4 & 2 & 0 \\\end{array}\right) and B=\left(\begin{array}{ccc}9 & 6 & 3 \\-5 & 0 & 2 \\3 & 3 & 2 \\\end{array}\right)\)

Both A and B have equal number of rows and matrices. So we can find their addition and subtraction as follows

Addition of A and B

\[\left(\begin{array}{ccc}0+9 & -1+6 & 2+3 \\-3-5 & 2+0& 0+2\\ 4+3&2+3&0+2\\\end{array}\right)=\left(\begin{array}{ccc}9 & 5 & 5 \\-8 & 2& 2\\ 7&5&2\\\end{array}\right) \]

Subtraction of A and B

\[\left(\begin{array}{ccc}0-9 & -1-6 & 2-3 \\-3-(-5) & 2-0& 0-2\\ 4-3&2-3&0-2\\\end{array}\right)=\left(\begin{array}{ccc}-9 & -7 & -1 \\2 & 2& -2\\ 1&-1&-2\\\end{array}\right) \]

Scalar Multiplication : When we want to multiply by a number \(k\) to a matrix then it is multiplied with each entry \( a(i, j) \) of matrix \(A\) and it is called scalar multiplication of k with A.

Example : Suppose \(k = 5\) and \(A=\left(\begin{array}{ccc}2 & -1 & 1 \\0 & 4 & 2 \\0 & -3 & -5 \\\end{array}\right)\) then scalar multiplication of k with A is

\[kA=5A = \left(\begin{array}{ccc}2*5 & -1*5 & 1*5 \\0*5 & 4*5 & 2*5 \\0*5 & -3*5 & -5*5 \\\end{array}\right) = \left(\begin{array}{ccc}10 & -5 & 5 \\0 & 20 & 10\\0 & -15 & -25 \\\end{array}\right)\]

Multiplication of Two Matrices :

If number of rows of a matrix A are equal to number of columns of a matrix B then the product AB is find as follows

Let \(A =\left(\begin{array}{cc}2 & 8 \\3 & 4 \end{array}\right), B =\left(\begin{array}{cc}-3 & 1 \\0 & -1 \end{array}\right)\)

Clearly number of rows in A are two equal to number of columns of B equal to 2.

\[AB =\left(\begin{array}{cc}2 & 8 \\3 & 4 \end{array}\right)\left(\begin{array}{cc}-3 & 1 \\0 & -1 \end{array}\right)\]

\[=\left(\begin{array}{cc}2*(-3)+8*0 & 2*1+8*(-1) \\3*(-3)+4*0 & 3*1+4*(-1) \end{array}\right) \]

\[AB=\left(\begin{array}{cc}-6 & -6 \\-9 & -1 \end{array}\right)\]

Homework, Assignment, Project Subjects

Mathematics : Mathematics , Trigonometry , Geometry

Science: Chemistry , Physics , Biology , Mathematical Biology , Economics , General Aptitude

Advanced Mathematics : Advanced Math , Linear Algebra , Abstract Algebra , Multivariable Calculus , Real Analysis , ODEs , PDEs , Numerical Analysis , Complex Analysis , Integral Equations

Probability and Statistics: Probability & Statistics , Operation Research

Computer Science: Computer science , Discrete Mathematics , Number Theory , Graph Theory

Programming : MATLAB , Python , Excel

Engineering : Laplace Transforms , Fourier Transform , Electrical Engineering , Mechanical Engineering , Electronics Engineering

Management : Research Methodology , Operation Research , Financial Mathematics , Management ,

Recently Asked Questions and Answers