## Welcome to the World of Modelling and Simulation

### What is Modelling?

This blog is all about system dynamics modelling and simulation applied in the engineering field, especially mechanical, electrical, and ... ### A Mathematica Program for the Newton Raphson Method

The following Mathematica program implements the widely used Newton Raphson approach. Any functions may be considered here, and the following program is ready to evaluate it.

(*Mathematica Codes for Newton-Raphson Approach*)
Sigma = 100000*(Sqrt[epsilon] + 1/80*Sin[Pi*epsilon/0.002]) - 4000;
epsilontable = {0.0002};
Error = {1};
SetTolerance = 0.0005;
MaximumIteration = 100;
i = 1;

(*Newton-Raphson Algorithm Implementation*)
While[And[i <= MaximumIteration, Abs[Error[[i]]] > SetTolerance],
epsilonnew =
epsilontable[[i]] - (Sigma /.
epsilon -> epsilontable[[i]]);
epsilontable = Append[epsilontable, epsilonnew];
Errornew = (epsilonnew - epsilontable[[i]])/epsilonnew;
Error = Append[Error, Errornew];
i++];

L = Length[epsilontable];
SolutionTable =
Table[{i - 1, epsilontable[[i]], Error[[i]]}, {i, 1, L}];
SolutionTable1 = {"Iteration Number", "Epsilon", "Error"};
L = Prepend[SolutionTable, SolutionTable1];
Print["Showing Results for the Newton-Raphson Approach when Sigma is \
4,000 and Initial Guess is 0.0002"]
ScientificForm[L // MatrixForm, 4]

Program Output: 