Spectral method ODE solver is stable in MATLAB but blows up in R
I am using a spectral method to solve an ordinary differential equation. The following R code and MATLAB code are completely equivalent, but the R code blows up (the values of u that it computes become very large), while the MATLAB code solves for u stably. I suspect this is because numerical computation in R is less stable than in MATLAB. I would appreciate it if someone could analyze the situation in more detail. # R (The result would explode) library(pracma) f<- function(x){ return(exp(x)*(x^2+ 4*x+1)+ exp(5*x)*(x^2-1)^5) } Cheb<- function(N){ #D_cheb of size N+1, corresponding to N sub-int
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.