Using Newton Raphson's method to solve a non-linear boundary value problem?












1














(My specific question is at the end of the problem)



Examine the boundary problem with a nonlinear right hand side $1+u^2(x)$
$$-u''(x) = 1+u^2(x) quad text{on} quad 0 < x < 1 quad text{with} quad u(0) = u(1) = 0$$
use 4 internal points $x_1$, $x_2$, $x_3$, $x_4$. With $u_i = u(x_i)$ we use the finite difference approximation
$$u''(x_i) approx frac{-u(x_{i-1}) + 2u(x_i) - u(x_{i+1})}{h^2} = frac{-u_{i-1} + 2u_i - u_{i+1}}{h^2}$$
where $h = frac{1}{5} = 0.2$ and $u(x_0) = u_0 = u(x_5) = u_5 = 0$.
Thus we obtain a non-linear system of equations.
$$
frac{1}{0.4^2}
begin{bmatrix}
+2 & -1 & 0 & 0 \
-1 & +2 & -1 & 0 \
0 & -1 & +2 & -1 \
0 & 0 & -1 & +2 \
end{bmatrix}
begin{pmatrix}
u_1 \
u_2 \
u_3 \
u_4
end{pmatrix} =
begin{pmatrix}
1 + u_1^2 \
1 + u_2^2 \
1 + u_3^2 \
1 + u_4^2
end{pmatrix}
$$

To solve this non-linear system use methods from non linear problems, e.g. Newton's method: Use the Taylor approximation $(u+phi)^2approx u^2+2uphi$. Start with an initial vector $vec{u}_0$, e.g.$vec{u}_0=0$. Then use the iterationnewline
begin{align}
textbf{A}cdot (vec{u}_k + vec{phi})&=1+vec{u}_k^2+2vec{u}_kcdotvec{phi}\
textbf{A}cdot (vec{u}_k + vec{phi}) - 2vec{u}_kcdotvec{phi}&= 1+vec{u}_k^2\
textbf{A} cdot (vec{u}_k + vec{phi}) - text{diag}(2vec{u}_k)cdot phi &= 1 + vec{u}_k^2\
textbf{A}cdotphi + textbf{A}cdotvec{u}_k- text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2\
textbf{A}cdotphi - text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_k\
(textbf{A} - text{diag}(2vec{u}_k))cdot phi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_ktag{1}\
vec{u}_{k+1} &=vec{u}_k+vec{phi}tag{2}
end{align}



My question is: how do we get from (1) to (2)?










share|cite|improve this question






















  • (1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
    – Reinhard Meier
    15 hours ago










  • thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
    – ecjb
    14 hours ago










  • Solve (1) for $phi$ and plug $phi$ into (2)
    – Reinhard Meier
    14 hours ago










  • indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
    – ecjb
    14 hours ago
















1














(My specific question is at the end of the problem)



Examine the boundary problem with a nonlinear right hand side $1+u^2(x)$
$$-u''(x) = 1+u^2(x) quad text{on} quad 0 < x < 1 quad text{with} quad u(0) = u(1) = 0$$
use 4 internal points $x_1$, $x_2$, $x_3$, $x_4$. With $u_i = u(x_i)$ we use the finite difference approximation
$$u''(x_i) approx frac{-u(x_{i-1}) + 2u(x_i) - u(x_{i+1})}{h^2} = frac{-u_{i-1} + 2u_i - u_{i+1}}{h^2}$$
where $h = frac{1}{5} = 0.2$ and $u(x_0) = u_0 = u(x_5) = u_5 = 0$.
Thus we obtain a non-linear system of equations.
$$
frac{1}{0.4^2}
begin{bmatrix}
+2 & -1 & 0 & 0 \
-1 & +2 & -1 & 0 \
0 & -1 & +2 & -1 \
0 & 0 & -1 & +2 \
end{bmatrix}
begin{pmatrix}
u_1 \
u_2 \
u_3 \
u_4
end{pmatrix} =
begin{pmatrix}
1 + u_1^2 \
1 + u_2^2 \
1 + u_3^2 \
1 + u_4^2
end{pmatrix}
$$

To solve this non-linear system use methods from non linear problems, e.g. Newton's method: Use the Taylor approximation $(u+phi)^2approx u^2+2uphi$. Start with an initial vector $vec{u}_0$, e.g.$vec{u}_0=0$. Then use the iterationnewline
begin{align}
textbf{A}cdot (vec{u}_k + vec{phi})&=1+vec{u}_k^2+2vec{u}_kcdotvec{phi}\
textbf{A}cdot (vec{u}_k + vec{phi}) - 2vec{u}_kcdotvec{phi}&= 1+vec{u}_k^2\
textbf{A} cdot (vec{u}_k + vec{phi}) - text{diag}(2vec{u}_k)cdot phi &= 1 + vec{u}_k^2\
textbf{A}cdotphi + textbf{A}cdotvec{u}_k- text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2\
textbf{A}cdotphi - text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_k\
(textbf{A} - text{diag}(2vec{u}_k))cdot phi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_ktag{1}\
vec{u}_{k+1} &=vec{u}_k+vec{phi}tag{2}
end{align}



My question is: how do we get from (1) to (2)?










share|cite|improve this question






















  • (1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
    – Reinhard Meier
    15 hours ago










  • thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
    – ecjb
    14 hours ago










  • Solve (1) for $phi$ and plug $phi$ into (2)
    – Reinhard Meier
    14 hours ago










  • indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
    – ecjb
    14 hours ago














1












1








1







(My specific question is at the end of the problem)



Examine the boundary problem with a nonlinear right hand side $1+u^2(x)$
$$-u''(x) = 1+u^2(x) quad text{on} quad 0 < x < 1 quad text{with} quad u(0) = u(1) = 0$$
use 4 internal points $x_1$, $x_2$, $x_3$, $x_4$. With $u_i = u(x_i)$ we use the finite difference approximation
$$u''(x_i) approx frac{-u(x_{i-1}) + 2u(x_i) - u(x_{i+1})}{h^2} = frac{-u_{i-1} + 2u_i - u_{i+1}}{h^2}$$
where $h = frac{1}{5} = 0.2$ and $u(x_0) = u_0 = u(x_5) = u_5 = 0$.
Thus we obtain a non-linear system of equations.
$$
frac{1}{0.4^2}
begin{bmatrix}
+2 & -1 & 0 & 0 \
-1 & +2 & -1 & 0 \
0 & -1 & +2 & -1 \
0 & 0 & -1 & +2 \
end{bmatrix}
begin{pmatrix}
u_1 \
u_2 \
u_3 \
u_4
end{pmatrix} =
begin{pmatrix}
1 + u_1^2 \
1 + u_2^2 \
1 + u_3^2 \
1 + u_4^2
end{pmatrix}
$$

To solve this non-linear system use methods from non linear problems, e.g. Newton's method: Use the Taylor approximation $(u+phi)^2approx u^2+2uphi$. Start with an initial vector $vec{u}_0$, e.g.$vec{u}_0=0$. Then use the iterationnewline
begin{align}
textbf{A}cdot (vec{u}_k + vec{phi})&=1+vec{u}_k^2+2vec{u}_kcdotvec{phi}\
textbf{A}cdot (vec{u}_k + vec{phi}) - 2vec{u}_kcdotvec{phi}&= 1+vec{u}_k^2\
textbf{A} cdot (vec{u}_k + vec{phi}) - text{diag}(2vec{u}_k)cdot phi &= 1 + vec{u}_k^2\
textbf{A}cdotphi + textbf{A}cdotvec{u}_k- text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2\
textbf{A}cdotphi - text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_k\
(textbf{A} - text{diag}(2vec{u}_k))cdot phi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_ktag{1}\
vec{u}_{k+1} &=vec{u}_k+vec{phi}tag{2}
end{align}



My question is: how do we get from (1) to (2)?










share|cite|improve this question













(My specific question is at the end of the problem)



Examine the boundary problem with a nonlinear right hand side $1+u^2(x)$
$$-u''(x) = 1+u^2(x) quad text{on} quad 0 < x < 1 quad text{with} quad u(0) = u(1) = 0$$
use 4 internal points $x_1$, $x_2$, $x_3$, $x_4$. With $u_i = u(x_i)$ we use the finite difference approximation
$$u''(x_i) approx frac{-u(x_{i-1}) + 2u(x_i) - u(x_{i+1})}{h^2} = frac{-u_{i-1} + 2u_i - u_{i+1}}{h^2}$$
where $h = frac{1}{5} = 0.2$ and $u(x_0) = u_0 = u(x_5) = u_5 = 0$.
Thus we obtain a non-linear system of equations.
$$
frac{1}{0.4^2}
begin{bmatrix}
+2 & -1 & 0 & 0 \
-1 & +2 & -1 & 0 \
0 & -1 & +2 & -1 \
0 & 0 & -1 & +2 \
end{bmatrix}
begin{pmatrix}
u_1 \
u_2 \
u_3 \
u_4
end{pmatrix} =
begin{pmatrix}
1 + u_1^2 \
1 + u_2^2 \
1 + u_3^2 \
1 + u_4^2
end{pmatrix}
$$

To solve this non-linear system use methods from non linear problems, e.g. Newton's method: Use the Taylor approximation $(u+phi)^2approx u^2+2uphi$. Start with an initial vector $vec{u}_0$, e.g.$vec{u}_0=0$. Then use the iterationnewline
begin{align}
textbf{A}cdot (vec{u}_k + vec{phi})&=1+vec{u}_k^2+2vec{u}_kcdotvec{phi}\
textbf{A}cdot (vec{u}_k + vec{phi}) - 2vec{u}_kcdotvec{phi}&= 1+vec{u}_k^2\
textbf{A} cdot (vec{u}_k + vec{phi}) - text{diag}(2vec{u}_k)cdot phi &= 1 + vec{u}_k^2\
textbf{A}cdotphi + textbf{A}cdotvec{u}_k- text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2\
textbf{A}cdotphi - text{diag}(2vec{u}_k)cdotphi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_k\
(textbf{A} - text{diag}(2vec{u}_k))cdot phi &= 1 + vec{u}_k^2-textbf{A}cdotvec{u}_ktag{1}\
vec{u}_{k+1} &=vec{u}_k+vec{phi}tag{2}
end{align}



My question is: how do we get from (1) to (2)?







linear-algebra nonlinear-system newton-raphson






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked 2 days ago









ecjb

1398




1398












  • (1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
    – Reinhard Meier
    15 hours ago










  • thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
    – ecjb
    14 hours ago










  • Solve (1) for $phi$ and plug $phi$ into (2)
    – Reinhard Meier
    14 hours ago










  • indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
    – ecjb
    14 hours ago


















  • (1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
    – Reinhard Meier
    15 hours ago










  • thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
    – ecjb
    14 hours ago










  • Solve (1) for $phi$ and plug $phi$ into (2)
    – Reinhard Meier
    14 hours ago










  • indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
    – ecjb
    14 hours ago
















(1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
– Reinhard Meier
15 hours ago




(1) is a system of linear equations. What exactly do you want to know? How to solve systems of linear equations in general? Or which method is the best one for this special type of matrix (sparse band matrix)? Or if there is an explicit solution?
– Reinhard Meier
15 hours ago












thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
– ecjb
14 hours ago




thank you for your answer @ReinhardMeier. Sorry I think I put too much for a rather focused question. I think solving a linear problem is clear for me as well as why you use Newton's method. My only question is how do you get at the end of the first of newton to the second one from (1) to (2) (the 2 last line of the question)
– ecjb
14 hours ago












Solve (1) for $phi$ and plug $phi$ into (2)
– Reinhard Meier
14 hours ago




Solve (1) for $phi$ and plug $phi$ into (2)
– Reinhard Meier
14 hours ago












indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
– ecjb
14 hours ago




indeed because $phi$ is the unknown and is isolated in the last equation. Many thanks @ReinhardMeier
– ecjb
14 hours ago










0






active

oldest

votes











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%2f3060881%2fusing-newton-raphsons-method-to-solve-a-non-linear-boundary-value-problem%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















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%2f3060881%2fusing-newton-raphsons-method-to-solve-a-non-linear-boundary-value-problem%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

An IMO inspired problem

Management

Has there ever been an instance of an active nuclear power plant within or near a war zone?