22
file.org
22
file.org
@@ -22,28 +22,35 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define EPSILON 0.0000001
|
#define EPSILON 0.0000001
|
||||||
|
|
||||||
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
||||||
#define f1(x) ((1056 * x * x) - (128 * x) + 198)
|
#define f1(x) ((1056 * x * x) - (128 * x) + 198)
|
||||||
|
|
||||||
double newtonRaphson(double x) {
|
double newtonRaphson(double x) {
|
||||||
double h = f(x) / f1(x);
|
double h = f(x) / f1(x);
|
||||||
if (f(x) == 0 || fabs(h) < EPSILON)
|
if (f(x) == 0 || fabs(h) < EPSILON)
|
||||||
return x;
|
return x;
|
||||||
return newtonRaphson(x - h);
|
return newtonRaphson(x - h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf",
|
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf",
|
||||||
newtonRaphson(-4));
|
newtonRaphson(-4));
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Program for nding roots of f(x) = 0 using bisection method
|
#+LATEX: \clearpage
|
||||||
|
|
||||||
|
* Program for finding roots of f(x) = 0 using bisection method
|
||||||
#+ATTR_LATEX: :options frame=single,breaklines=true
|
#+ATTR_LATEX: :options frame=single,breaklines=true
|
||||||
#+begin_src C :tangle 2.c :results output :exports both :wrap src text
|
#+begin_src C :tangle 2.c :results output :exports both :wrap src text
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define EPSILON 0.0000001
|
#define EPSILON 0.0000001
|
||||||
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
||||||
|
|
||||||
double bisection(double a, double b) {
|
double bisection(double a, double b) {
|
||||||
double x;
|
double x;
|
||||||
if (f(a) * f(b) > 0) {
|
if (f(a) * f(b) > 0) {
|
||||||
@@ -58,6 +65,7 @@ double bisection(double a, double b) {
|
|||||||
return bisection(x, b);
|
return bisection(x, b);
|
||||||
return bisection(a, x);
|
return bisection(a, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf",
|
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf",
|
||||||
bisection(1.6, -4));
|
bisection(1.6, -4));
|
||||||
@@ -72,7 +80,9 @@ int main() {
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define EPSILON 0.0000001
|
#define EPSILON 0.0000001
|
||||||
|
|
||||||
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
#define f(x) ((352 * x * x * x) - (64 * x * x) + (198 * x) - 36)
|
||||||
|
|
||||||
double secant(double a, double b) {
|
double secant(double a, double b) {
|
||||||
double x1;
|
double x1;
|
||||||
x1 = (a * f(b) - b * f(a)) / (f(b) - f(a));
|
x1 = (a * f(b) - b * f(a)) / (f(b) - f(a));
|
||||||
@@ -80,6 +90,7 @@ double secant(double a, double b) {
|
|||||||
return x1;
|
return x1;
|
||||||
return secant(b, x1);
|
return secant(b, x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf", secant(1.6, -4));
|
printf("Root for f(x) = 352x^3 - 64x^2 + 198x - 36 is %lf", secant(1.6, -4));
|
||||||
}
|
}
|
||||||
@@ -206,6 +217,8 @@ Enter interpolation point x: 999
|
|||||||
Interpolated value for 999.000000 is 9525764925.000002.
|
Interpolated value for 999.000000 is 9525764925.000002.
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+LATEX: \clearpage
|
||||||
|
|
||||||
* Program for solving numerical integration by trapezoidal method.
|
* Program for solving numerical integration by trapezoidal method.
|
||||||
#+ATTR_LATEX: :options frame=single,breaklines=true
|
#+ATTR_LATEX: :options frame=single,breaklines=true
|
||||||
#+begin_src C :tangle 6.c :results output :exports both :wrap src text
|
#+begin_src C :tangle 6.c :results output :exports both :wrap src text
|
||||||
@@ -234,6 +247,8 @@ int main() {
|
|||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+LATEX: \clearpage
|
||||||
|
|
||||||
* Program for solving numerical integration by Simpson's 1/3 rule.
|
* Program for solving numerical integration by Simpson's 1/3 rule.
|
||||||
#+ATTR_LATEX: :options frame=single,breaklines=true
|
#+ATTR_LATEX: :options frame=single,breaklines=true
|
||||||
#+begin_src C :tangle 7.c :results output :exports both :wrap src text
|
#+begin_src C :tangle 7.c :results output :exports both :wrap src text
|
||||||
@@ -351,14 +366,18 @@ int main() {
|
|||||||
for (int j = 0; j < ORDER; j++)
|
for (int j = 0; j < ORDER; j++)
|
||||||
printf("%lf ", inv[i][j + ORDER]);
|
printf("%lf ", inv[i][j + ORDER]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
free(inv[i]);
|
free(inv[i]);
|
||||||
free(matrix[i]);
|
free(matrix[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(inv);
|
free(inv);
|
||||||
free(matrix);
|
free(matrix);
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+LATEX: \clearpage
|
||||||
|
|
||||||
* Program for finding eigen values using power method.
|
* Program for finding eigen values using power method.
|
||||||
#+ATTR_LATEX: :options frame=single,breaklines=true
|
#+ATTR_LATEX: :options frame=single,breaklines=true
|
||||||
#+begin_src C :tangle 10.c :results output :exports both :wrap src text
|
#+begin_src C :tangle 10.c :results output :exports both :wrap src text
|
||||||
@@ -421,6 +440,7 @@ int main() {
|
|||||||
printf("%lf ", egn[i]);
|
printf("%lf ", egn[i]);
|
||||||
free(matrix[i]);
|
free(matrix[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(egn);
|
free(egn);
|
||||||
free(matrix);
|
free(matrix);
|
||||||
}
|
}
|
||||||
|
38
front.tex
38
front.tex
@@ -1,28 +1,28 @@
|
|||||||
\newgeometry{left=1.5in,right=1.5in}
|
\newgeometry{left=1.5in,right=1.5in}
|
||||||
\begin{titlepage}
|
\begin{titlepage}
|
||||||
\vspace*{1.6in}
|
\vspace*{1.2in}
|
||||||
\begin{center}
|
\begin{center}
|
||||||
{\fontsize{20}{24}\selectfont \textbf{\emph{Computational Mathematics Lab}}}
|
{\fontsize{20}{24}\selectfont \textbf{\emph{Computational Methods Lab}}}
|
||||||
\end{center}
|
\end{center}
|
||||||
\vspace{0.3in}
|
\vspace{0.3in}
|
||||||
\hspace{0.3in}
|
\hspace{0.3in}
|
||||||
\begin{minipage}{2in}
|
\begin{minipage}{2in}
|
||||||
Faculty Name:\\
|
Faculty Name:\\
|
||||||
SACHIN GARG\\
|
SACHIN GARG\\
|
||||||
Assisstant Professor\\
|
Assisstant Professor\\
|
||||||
I.T. Department
|
I.T. Department
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
\hfill
|
\hfill
|
||||||
\begin{minipage}{2in}
|
\begin{minipage}{2in}
|
||||||
Student: AMNEESH SINGH\\
|
Student: AMNEESH SINGH\\
|
||||||
Enrollment: 14114803121\\
|
Enrollment: 14114803121\\
|
||||||
Semester: III\\
|
Semester: III\\
|
||||||
Group: 3I6
|
Group: I6
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=2in]{mait.png}\\
|
\includegraphics[width=2in]{mait.png}\\
|
||||||
\fontsize{18}{22}\selectfont Maharaja Agrasen Institute of Technology, PSP Area, Sector-22, Rohini, New Delhi 110086
|
\fontsize{18}{22}\selectfont Maharaja Agrasen Institute of Technology, PSP Area, Sector-22, Rohini, New Delhi 110086
|
||||||
\end{center}
|
\end{center}
|
||||||
\end{titlepage}
|
\end{titlepage}
|
||||||
\restoregeometry
|
\restoregeometry
|
||||||
|
44
toc.tex
44
toc.tex
@@ -1,44 +1,40 @@
|
|||||||
\begin{center}
|
\begin{center}
|
||||||
\fontsize{15}{18}\selectfont \textbf{
|
\fontsize{15}{18}\selectfont \textbf{
|
||||||
DATA STRUCTURES LAB\\
|
COMPUTATIONAL METHODS LAB\\
|
||||||
PRACTICAL RECORD
|
PRACTICAL RECORD
|
||||||
}
|
}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\vspace{0.5cm}
|
|
||||||
|
|
||||||
\begin{table}[h]
|
\begin{table}[h]
|
||||||
\begin{tabular}{lcl}
|
\begin{tabular}{lcl}
|
||||||
Paper Code & : & e\\
|
Paper Code & : & ES-251\\
|
||||||
Name of the student & : & Amneesh Singh\\
|
Name of the student & : & Amneesh Singh\\
|
||||||
University Enrollment number & : & 14114803121\\
|
University Enrollment number & : & 14114803121\\
|
||||||
Branch & : & Information Technology\\
|
Branch & : & Information Technology\\
|
||||||
Group & : & 3I6
|
Group & : & I6
|
||||||
\end{tabular}
|
\end{tabular}
|
||||||
\end{table}
|
\end{table}
|
||||||
|
|
||||||
\vspace{0.5cm}
|
|
||||||
|
|
||||||
\textbf{PRACTICAL DETAILS}
|
\textbf{PRACTICAL DETAILS}
|
||||||
|
|
||||||
Experiments according to the lab syllabus prescribed by GGSIPU
|
Experiments according to the lab syllabus prescribed by GGSIPU
|
||||||
|
|
||||||
\vspace{0.5cm}
|
|
||||||
|
|
||||||
\begin{table}[h]
|
\begin{table}[h]
|
||||||
\renewcommand{\arraystretch}{2.5}
|
\fontsize{11}{12}\selectfont{
|
||||||
\begin{tabular}{|p{0.6cm}|p{8cm}|p{2cm}|p{2cm}|p{2cm}|p{1cm}|} \hline
|
\renewcommand{\arraystretch}{2.5}
|
||||||
Exp. No. & Experiment Name & Performance Date & Date Checked & Remarks & Marks \\ \hline
|
\begin{tabular}{|p{0.6cm}|p{8cm}|p{2cm}|p{2cm}|p{2cm}|p{1cm}|} \hline
|
||||||
& & & & & \\ \hline
|
\textbf{Exp. No.} & \textbf{Experiment Name} & \textbf{Performance Date} & \textbf{Date Checked} & \textbf{Remarks} & \textbf{Marks} \\ \hline \hline
|
||||||
& & & & & \\ \hline
|
1 & Program for finding roots of f(x) = 0 using Newton Raphson Method & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
2 & Program for finding roots of f(x) = 0 using Bisection Method & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
3 & Program for finding roots of f(x) = 0 using Secant Method & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
4 & Program to implement Langrange Interpolation & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
5 & Program to implement Newton's Divided Difference formula & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
6 & Program for solving numerical integration by trapezoidal method & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
7 & Program for solving numerical integration by Simpson's 1/3 rule & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
8 & Program for solving numerical integration by Simpson's 3/8 rule & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
9 & Program for finding inverse of linear equations using Gauss Jordan method & & & & \\ \hline
|
||||||
& & & & & \\ \hline
|
10 & Program for finding eigen values using power method & & & & \\ \hline
|
||||||
\end{tabular}
|
11 & Program for solving ordinary differential equation using Renge Kutta method & & & & \\ \hline
|
||||||
|
\end{tabular}
|
||||||
|
}
|
||||||
\end{table}
|
\end{table}
|
||||||
|
Reference in New Issue
Block a user