R: deSolve - partial differential equation











up vote
2
down vote

favorite












Could somebody help me with the R package deSolve/ReacTran, which can be used for solving any parabolic partial differential equation:



PDE for bond pricing, from Cox-Ingresoll-Ross model



I have found a similar example in the book
Karline Soetaert, Jeff_Cash, Francesca Mazzia: Solving Partial Differential Equations in R, chapter 9, page 179-181,
where is a solution for the equation:



The Nonlinear Schrodinger Equation



Online version of book: Solving Partial Differential Equations in R



The PDE and the solution is defined like:



Schrodinger <- function(t, u, parms) {
du <- 1i * tran.1D (C = u, D = 1, dx = xgrid)$dC +
1i * gam * abs(u)ˆ2 * u
list(du) }

N <- 300
xgrid <- setup.grid.1D(-20, 80, N = N)
x <- xgrid$x.mid

out <- ode.1D(y = yini, parms = NULL, func = Schrodinger,
times = times, dimens = 300, method = "adams")


There's an example of the second partial derivative:



tran.1D (C = u, D = 1, dx = xgrid)$dC


but I'm not sure how to define the first partial derivatives in the PDE
and for derivatives by r_e and r_d (more 'xgrid', or ?)



Thank you in advance for any help.










share|improve this question
























  • Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
    – PilouPili
    Nov 10 at 22:42

















up vote
2
down vote

favorite












Could somebody help me with the R package deSolve/ReacTran, which can be used for solving any parabolic partial differential equation:



PDE for bond pricing, from Cox-Ingresoll-Ross model



I have found a similar example in the book
Karline Soetaert, Jeff_Cash, Francesca Mazzia: Solving Partial Differential Equations in R, chapter 9, page 179-181,
where is a solution for the equation:



The Nonlinear Schrodinger Equation



Online version of book: Solving Partial Differential Equations in R



The PDE and the solution is defined like:



Schrodinger <- function(t, u, parms) {
du <- 1i * tran.1D (C = u, D = 1, dx = xgrid)$dC +
1i * gam * abs(u)ˆ2 * u
list(du) }

N <- 300
xgrid <- setup.grid.1D(-20, 80, N = N)
x <- xgrid$x.mid

out <- ode.1D(y = yini, parms = NULL, func = Schrodinger,
times = times, dimens = 300, method = "adams")


There's an example of the second partial derivative:



tran.1D (C = u, D = 1, dx = xgrid)$dC


but I'm not sure how to define the first partial derivatives in the PDE
and for derivatives by r_e and r_d (more 'xgrid', or ?)



Thank you in advance for any help.










share|improve this question
























  • Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
    – PilouPili
    Nov 10 at 22:42















up vote
2
down vote

favorite









up vote
2
down vote

favorite











Could somebody help me with the R package deSolve/ReacTran, which can be used for solving any parabolic partial differential equation:



PDE for bond pricing, from Cox-Ingresoll-Ross model



I have found a similar example in the book
Karline Soetaert, Jeff_Cash, Francesca Mazzia: Solving Partial Differential Equations in R, chapter 9, page 179-181,
where is a solution for the equation:



The Nonlinear Schrodinger Equation



Online version of book: Solving Partial Differential Equations in R



The PDE and the solution is defined like:



Schrodinger <- function(t, u, parms) {
du <- 1i * tran.1D (C = u, D = 1, dx = xgrid)$dC +
1i * gam * abs(u)ˆ2 * u
list(du) }

N <- 300
xgrid <- setup.grid.1D(-20, 80, N = N)
x <- xgrid$x.mid

out <- ode.1D(y = yini, parms = NULL, func = Schrodinger,
times = times, dimens = 300, method = "adams")


There's an example of the second partial derivative:



tran.1D (C = u, D = 1, dx = xgrid)$dC


but I'm not sure how to define the first partial derivatives in the PDE
and for derivatives by r_e and r_d (more 'xgrid', or ?)



Thank you in advance for any help.










share|improve this question















Could somebody help me with the R package deSolve/ReacTran, which can be used for solving any parabolic partial differential equation:



PDE for bond pricing, from Cox-Ingresoll-Ross model



I have found a similar example in the book
Karline Soetaert, Jeff_Cash, Francesca Mazzia: Solving Partial Differential Equations in R, chapter 9, page 179-181,
where is a solution for the equation:



The Nonlinear Schrodinger Equation



Online version of book: Solving Partial Differential Equations in R



The PDE and the solution is defined like:



Schrodinger <- function(t, u, parms) {
du <- 1i * tran.1D (C = u, D = 1, dx = xgrid)$dC +
1i * gam * abs(u)ˆ2 * u
list(du) }

N <- 300
xgrid <- setup.grid.1D(-20, 80, N = N)
x <- xgrid$x.mid

out <- ode.1D(y = yini, parms = NULL, func = Schrodinger,
times = times, dimens = 300, method = "adams")


There's an example of the second partial derivative:



tran.1D (C = u, D = 1, dx = xgrid)$dC


but I'm not sure how to define the first partial derivatives in the PDE
and for derivatives by r_e and r_d (more 'xgrid', or ?)



Thank you in advance for any help.







r differential-equations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 18:39









Ethan

8117




8117










asked Nov 10 at 11:14









Ab B Bg Kostroš

112




112












  • Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
    – PilouPili
    Nov 10 at 22:42




















  • Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
    – PilouPili
    Nov 10 at 22:42


















Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
– PilouPili
Nov 10 at 22:42






Your PDE is really 2D+time (r_e as x and r_d as y). So you should look more into tran.2D I believe (same goes for grid.2D and ode.2D). Take a look at the full manual cran.r-project.org/web/packages/ReacTran/ReacTran.pdf or cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf PS: never tried r so I won't venture at an answer
– PilouPili
Nov 10 at 22:42



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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',
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
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238389%2fr-desolve-partial-differential-equation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238389%2fr-desolve-partial-differential-equation%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

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values