Skip to content

Commit

Permalink
Notes on Class Code
Browse files Browse the repository at this point in the history
  • Loading branch information
rmh13011 committed Feb 8, 2017
1 parent 6f4a1d5 commit 34c9847
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
27 changes: 14 additions & 13 deletions lecture_07/lecture_07.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1435,22 +1435,23 @@
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
"display_name": "Python [conda root]",
"language": "python",
"name": "conda-root-py"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "0.19.14"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions lecture_07/mod_secant.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
% ea = approximate relative error (%)
% iter = number of iterations
if nargin<3,error('at least 3 input arguments required'),end
if nargin<4 || isempty(es),es=0.0001;end
if nargin<4 || isempty(es),es=0.0001;end
if nargin<5 || isempty(maxit),maxit=50;end
iter = 0;
iter = 0
while (1)
xrold = xr;
dfunc=(func(xr+dx)-func(xr))./dx;
xr = xr - func(xr)/dfunc;
xr = xr - func(xr)/dfunc; %calculate as an approximation
iter = iter + 1;
if xr ~= 0
ea = abs((xr - xrold)/xr) * 100;
Expand Down

0 comments on commit 34c9847

Please sign in to comment.