设为首页 加入收藏

TOP

Solving.Differential.Equations.in.R笔记1
2017-10-09 13:25:50 】 浏览:7508
Tags:Solving.Differential.Equations.in.R 笔记

例1:y'=ry(1-y/K)

          y(0)=2

对应的R代码为:

library(deSolve)
#parameters and initial values
r<-1
K<-10
yini<-2
#the function
derivs<-function(t,y,parms){
                 return(list(r*y*(1-y/K)))
        }
#the independent variables
times<-seq(from=0,to=20,by=0.2)
#to calculate y values
out<-ode(y=yini,times=times,func=derivs,parms=NULL)
#the results
out

参考文献:

Karline S, Thomas P, Setzer R W. Solving Differential Equations in R[M]. Springer Publishing Company, Incorporated, 2012.

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇R语言学习笔记(十五):获取文件.. 下一篇R语言学习笔记(十三):零碎知识..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目