Inverse Quadratic Interpolation and the secant method












0














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!!










share|cite|improve this question






















  • 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
















0














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!!










share|cite|improve this question






















  • 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














0












0








0







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!!










share|cite|improve this question













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






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










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


















  • 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










1 Answer
1






active

oldest

votes


















0














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) ?






share|cite|improve this answer





















  • 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











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
});


}
});














draft saved

draft discarded


















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









0














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) ?






share|cite|improve this answer





















  • 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
















0














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) ?






share|cite|improve this answer





















  • 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














0












0








0






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) ?






share|cite|improve this answer












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) ?







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










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


















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

'app-layout' is not a known element: how to share Component with different Modules