Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Root-finding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"metadata": {},
"outputs": [],
"source": [
"disp(f_freudenstein(0.1, 0.25,11,13,8,10))"
"f_freudenstein(0.1, 0.25, 11, 13, 8, 10)"
]
},
{
Expand Down Expand Up @@ -70,8 +70,8 @@
"metadata": {},
"outputs": [],
"source": [
"f = @(x) f_freudenstein(x,beta,a1,a2,a3,a4); % f is a function of a *single* variable x\n",
"disp(f(0.5))"
"f = @(x) f_freudenstein(x, beta, a1, a2, a3, a4); % f is a function of a *single* variable x\n",
"f(0.5)"
]
},
{
Expand All @@ -89,7 +89,7 @@
"source": [
"alpha_init = 1.1;\n",
"alpha_sol = fzero(f,alpha_init);\n",
"disp(alpha_sol)"
"alpha_sol"
]
},
{
Expand All @@ -109,7 +109,7 @@
"source": [
"function alpha_sol = solve_freudenstein(alpha_init, beta, A1, A2, A3, A4)\n",
" f = @(x) f_freudenstein(x, beta, A1, A2, A3, A4);\n",
" alpha_sol = fzero(f,alpha_init);\n",
" alpha_sol = fzero(f, alpha_init);\n",
"end"
]
},
Expand Down Expand Up @@ -193,9 +193,9 @@
"for k = 2:N_beta \n",
" beta = beta_vals(k);\n",
" alpha_init = alpha_lo(k-1); % Use the last point as an initial iterate\n",
" alpha_lo(k) = solve_freudenstein(alpha_init,beta,a1,a2,a3,a4);\n",
" alpha_lo(k) = solve_freudenstein(alpha_init, beta, a1, a2, a3, a4);\n",
" alpha_init = alpha_hi(k-1); % Use the last point as an initial iterate\n",
" alpha_hi(k) = solve_freudenstein(alpha_init,beta,a1,a2,a3,a4);\n",
" alpha_hi(k) = solve_freudenstein(alpha_init, beta, a1, a2, a3, a4);\n",
"end"
]
},
Expand Down