Inverse Quadratic Interpolation and the secant method
I am currently completing a maths project that aims to approximate the roots of functions using MATLAB.
The two root finding methods that I have used are inverse quadratic interpolation and the secant method.
I have written scripts for both methods and have obtained approximations to the roots of different functions.
I was wondering if it was possible to graphically illustrate the various iterations for a specific function, on the same graph, to show the method converging to the actual root value?
If this is possible I would like to be able to complete it on MATLAB if not then excel?
Does anyone know if this is possible or even how to go about completing it?
Thank you!!
roots matlab
add a comment |
I am currently completing a maths project that aims to approximate the roots of functions using MATLAB.
The two root finding methods that I have used are inverse quadratic interpolation and the secant method.
I have written scripts for both methods and have obtained approximations to the roots of different functions.
I was wondering if it was possible to graphically illustrate the various iterations for a specific function, on the same graph, to show the method converging to the actual root value?
If this is possible I would like to be able to complete it on MATLAB if not then excel?
Does anyone know if this is possible or even how to go about completing it?
Thank you!!
roots matlab
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10
add a comment |
I am currently completing a maths project that aims to approximate the roots of functions using MATLAB.
The two root finding methods that I have used are inverse quadratic interpolation and the secant method.
I have written scripts for both methods and have obtained approximations to the roots of different functions.
I was wondering if it was possible to graphically illustrate the various iterations for a specific function, on the same graph, to show the method converging to the actual root value?
If this is possible I would like to be able to complete it on MATLAB if not then excel?
Does anyone know if this is possible or even how to go about completing it?
Thank you!!
roots matlab
I am currently completing a maths project that aims to approximate the roots of functions using MATLAB.
The two root finding methods that I have used are inverse quadratic interpolation and the secant method.
I have written scripts for both methods and have obtained approximations to the roots of different functions.
I was wondering if it was possible to graphically illustrate the various iterations for a specific function, on the same graph, to show the method converging to the actual root value?
If this is possible I would like to be able to complete it on MATLAB if not then excel?
Does anyone know if this is possible or even how to go about completing it?
Thank you!!
roots matlab
roots matlab
asked Apr 5 '14 at 13:54
projectone
34
34
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10
add a comment |
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10
add a comment |
1 Answer
1
active
oldest
votes
This is just a suggestion. Create a table $[n_1,x_{n_1}]$ where $n_1$ is the iteration number and $x_n$ the predicted value for the solution using method $1$. Do the same for method $2$ creating a table $[n_2,x_{n_2}]$. Now, plot the values of $x_{n_1}$ and $x_{n_2}$ as a function of $n$. Eventually, add to the plot the horizontal line corresponding to the exact solution.
Is this totally stupid or undoable (I don't know Matlab) ?
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f740829%2finverse-quadratic-interpolation-and-the-secant-method%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is just a suggestion. Create a table $[n_1,x_{n_1}]$ where $n_1$ is the iteration number and $x_n$ the predicted value for the solution using method $1$. Do the same for method $2$ creating a table $[n_2,x_{n_2}]$. Now, plot the values of $x_{n_1}$ and $x_{n_2}$ as a function of $n$. Eventually, add to the plot the horizontal line corresponding to the exact solution.
Is this totally stupid or undoable (I don't know Matlab) ?
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
add a comment |
This is just a suggestion. Create a table $[n_1,x_{n_1}]$ where $n_1$ is the iteration number and $x_n$ the predicted value for the solution using method $1$. Do the same for method $2$ creating a table $[n_2,x_{n_2}]$. Now, plot the values of $x_{n_1}$ and $x_{n_2}$ as a function of $n$. Eventually, add to the plot the horizontal line corresponding to the exact solution.
Is this totally stupid or undoable (I don't know Matlab) ?
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
add a comment |
This is just a suggestion. Create a table $[n_1,x_{n_1}]$ where $n_1$ is the iteration number and $x_n$ the predicted value for the solution using method $1$. Do the same for method $2$ creating a table $[n_2,x_{n_2}]$. Now, plot the values of $x_{n_1}$ and $x_{n_2}$ as a function of $n$. Eventually, add to the plot the horizontal line corresponding to the exact solution.
Is this totally stupid or undoable (I don't know Matlab) ?
This is just a suggestion. Create a table $[n_1,x_{n_1}]$ where $n_1$ is the iteration number and $x_n$ the predicted value for the solution using method $1$. Do the same for method $2$ creating a table $[n_2,x_{n_2}]$. Now, plot the values of $x_{n_1}$ and $x_{n_2}$ as a function of $n$. Eventually, add to the plot the horizontal line corresponding to the exact solution.
Is this totally stupid or undoable (I don't know Matlab) ?
answered Apr 5 '14 at 14:14
Claude Leibovici
119k1157132
119k1157132
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
add a comment |
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
Hey! Thanks for your suggestion! I don't think I explained myself particularly well so apologies!! Basically, I have created scripts using MATLAB that will compute + then output an approximation for the root of a function using the secant method and inverse quadratic interpolation (IQI) method. These methods use initial root approximations and then keep repeating the process, using the new approximation and the latter one (secant) or two (IQI) until convergence occurrs. I was wondering if there was anyway to display all the iterations on the one graph just to illustrate convergence.
– projectone
Apr 5 '14 at 15:03
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
For the secant method for example; I would like to have a graph of the function I am investigating and then on this graph I was wondering if it was possible to show all the different lines that MATLAB used to compute the root?
– projectone
Apr 5 '14 at 15:09
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
! commons.wikimedia.org/wiki/File:Secant_method_2.svg I was hoping that I could achieve something like this image where the blue lines represent the different iterations? Thank you very much for replying though! :)
– projectone
Apr 5 '14 at 15:11
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f740829%2finverse-quadratic-interpolation-and-the-secant-method%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I can't tell you how, but it is doable, no doubt. I would just like to stress that you won't be able to show many iterations as such, because the drawing accuracy will quickly be reached. It is advisable to plot the logarithm of the (absolute) difference to the exact root (which you will precompute), to magnify the scale.
– Yves Daoust
Jun 6 '16 at 19:10