Solving Differential Equations in R: Package deSolve

Solving Differential Equations in R: Package deSolve
复制标题

DOI:
10.18637/jss.v033.i09
复制
发表时间:
2010-02-01
影响因子:
5.8
通讯作者:
Setzer, R. Woodrow
Setzer, R. Woodrow
中科院分区:
计算机科学2区
文献类型:
--
作者:
Soetaert, Karline;Petzoldt, Thomas;Setzer, R. Woodrow

文献摘要

被引文献

相似文献

在本文中,我们提出了R包deSolve解决初值问题(IVP)写为常微分方程(ODE),微分代数方程(DAE)的索引0或1和偏微分方程(PDE),后者使用线的方法解决。微分方程可以用R代码或编译代码表示。在后一种情况下,R被用作触发集成和后处理结果的工具,这有助于模型开发和应用,同时编译的代码显着提高了仿真速度。实现的方法是有效的,强大的,有据可查的公共域Fortran例程。它们包括来自ODEPACK包(LSODE、LSODES、LSODA、LSODAR)、DVODE和DASPK2.0的四个集成器。此外,一套龙格库塔积分器和专用求解器,以有效地整合1,2和3维偏微分方程。该程序解决刚性和非刚性系统,并包括许多选项,如。例如,在一个实施例中,以有效的方式处理雅可比矩阵的稀疏性,或者找到方程的根。在本文中,我们的目标有三个:(1)展示使用R进行动态建模的潜力,(2)强调不同方法的典型用途,(3)比较R代码和编译代码中指定的模型的性能。这些比较表明,如果避免使用循环,R代码可以有效地集成包含数千个状态变量的问题。然而,与仅使用R代码的实现相比,使用编译代码可以更快地解决相同的问题,速度从2倍到50倍以上。尽管如此,R的贝内之一是更灵活和交互式的实现,更好的代码可读性,以及对R高级过程的访问。deSolve是packageo desolve的继承者,后者将在未来被弃用;它是自由软件,在GNU通用公共许可证下分发,作为R软件项目的一部分。
In this paper we present the R package deSolve to solve initial value problems (IVP) written as ordinary differential equations (ODE), differential algebraic equations (DAE) of index 0 or 1 and partial differential equations (PDE), the latter solved using the method of lines approach. The differential equations can be represented in R code or as compiled code. In the latter case, R is used as a tool to trigger the integration and post-process the results, which facilitates model development and application, whilst the compiled code significantly increases simulation speed. The methods implemented are efficient, robust, and well documented public-domain Fortran routines. They include four integrators from the ODEPACK package (LSODE, LSODES, LSODA, LSODAR), DVODE and DASPK2.0. In addition, a suite of Runge-Kutta integrators and special-purpose solvers to efficiently integrate 1-, 2- and 3-dimensional partial differential equations are available. The routines solve both stiff and non-stiff systems, and include many options, e. g., to deal in an efficient way with the sparsity of the Jacobian matrix, or finding the root of equations. In this article, our objectives are threefold: (1) to demonstrate the potential of using R for dynamic modeling, (2) to highlight typical uses of the different methods implemented and (3) to compare the performance of models specified in R code and in compiled code for a number of test cases. These comparisons demonstrate that, if the use of loops is avoided, R code can efficiently integrate problems comprising several thousands of state variables. Nevertheless, the same problem may be solved from 2 to more than 50 times faster by using compiled code compared to an implementation using only R code. Still, amongst the bene fits of R are a more flexible and interactive implementation, better readability of the code, and access to R's high-level procedures. deSolve is the successor of packageo desolve which will be deprecated in the future; it is free software and distributed under the GNU General Public License, as part of the R software project.