search for: rk4

Displaying 18 results from an estimated 18 matches for "rk4".

Did you mean: r4
2010 Apr 06
1
estimating the starting value within a ODE using nls and lsoda
All- I am interested in estimating a parameter that is the starting value for an ODE model. That is, in the typical combined fitting procedure using nls and lsoda (alternatively rk4), I first defined the ODE model: minmod <- function(t, y, parms) { G <- y[1] X <- y[2] with(as.list(parms),{ I_t <- approx(time, I.input, t)$y dG <- -1*(p1 + X)*G +p1*G_b dX <- -1*p2*X + p3*(I_t-I_b) list(c(dG, dX)) }) } Then I estimated the parameters of t...
2004 Oct 04
3
Beginners problem
Hi, I'm new to R and have a problem with a little test program (see below). Why doesn't <<- in function rk4 assign the new value to y so that it is seen in rktest. I thought that <<- does exactly this. But it seems that I didn't get it right. I would be very appreciative for an explanation of that behaviour of <<-. I know how to write the whole thing so that it works (return the updated...
2008 Apr 09
3
LSODA not accurate when RK4 is; what's going on?
...on dy/dx = xy-1 with y(0) = sqrt(pi/2). This can be used in computing the tail of the normal distribution. (The actual solution is y(x) = exp(x^2/2) * Integral_x_inf {exp(-t^2/2) dt} = Integral_0_inf {exp (-xt - t^2/2) dt}. For large x, y ~ 1/x, starting around x~2.) I'm testing both lsoda and rk4 from the package odesolve. rk4 is accurate using step length 10^-2 and probably would be with even larger steps. lsoda is pretty accurate out to about x=4, then starts acting strangely. For step length 10^-3, y suddenly starts to increase after 4, when it should be strictly decreasing. For step le...
2004 Jun 10
2
odesolve: lsoda vs rk4
I'm trying to use odesolve for integrating various series of coupled 1st order differential equations (derived from a system of enzymatic catalysis and copied below, apologies for the excessively long set of parameters). The thing that confuses me is that, whilst I can run the function rk4: out <- rk4(y=y,times=times,func=func, parms=parms) and the results look not unreasonable: out<-as.data.frame(out) par(mfrow=c(4,1)) for (i in 2:(dim(out)[2]))plot(out[,1],out[,i], pch=".", xlab="time", ylab=names(out)[i]) If I try doing the same thing with lsoda: out...
2004 Jan 22
4
Fitting compartmental model with nls and lsoda?
Dear Colleagues, Our group is also working on implementing the use of R for pharmacokinetic compartmental analysis. Perhaps I have missed something, but > fit <- nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=0.5, k2=0.5)), + data=C1.lsoda, + start=list(K1=0.3, k2=0.7), + trace=T + ) Error in eval(as.name(varName), data) : Object
2010 Sep 20
1
ERROR: Object not found
Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found. The sample codes are enclosed as follows, please help me. Thank you very much! rm(list=ls()) library(odesolve) # The ODE system ode <- function(t,x,p){...
2010 Sep 20
1
Ask for help with Error: Object not found
Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found. The sample codes are enclosed as follows, please help me. Thank you very much! rm(list=ls()) library(odesolve) # The ODE system ode <- function(t,x,p){...
2010 Sep 16
1
More accurate ODE solver?
Dear All, I was using rk4 and lsoda to solve a ODE system. However, both of them gave bad accurate solutions, especially compared with Matlab solver ODE45. For example, ODE45 gave solutions that can go to a stable level (about 1.6) when time goes to infinity, however, the solutions from lsoda are decreasing to very very sma...
2007 Apr 09
1
How to solve differential and integral equation using R?
Hello, I want to know if there are some functions or packages to solve differential and integral equation using R. Thanks. Shao chunxuan. [[alternative HTML version deleted]]
2009 Jun 12
2
External signal in ODE written in C (using deSolve and approx1?)
Dear list The deSolve package allows you to specify the model code in C or Fortran. Thanks to the excellent vignette this works fine. However I have not yet managed to use forcing functions in C code. In pure R code this works very well with approxfun() specified outside the model: ############################################### #Model lvml <- function(t, x, parms) {
2004 Jun 08
1
Differential Equations
Hello! I would like to know if R can solve Differential Equations... I don't think so because, in my point, I see R like a Statistical System, not a Math System. Am I wrong? Thank you very much. M??rcio de Medeiros Ribeiro Graduando em Ci??ncia da Computa????o Departamento de Tecnologia da Informa????o - TCI Universidade Federal de Alagoas - UFAL Macei?? - Alagoas - Brasil Projeto CoCADa
2018 May 31
0
Help in dynamic simulation using deSolve
...? ? ??? ? ? # Rate of change? ? ? dA <- inA+BtoA-AtoB-Aout? ? ? dB <- inB+AtoB-BtoA-Bout? ? ??? ? ??? ? ? return (list (c(dA, dB)))? ? })? }??? #Step 4: Define some starting values for the pools??? state <- c(A=5, B=3)??? ?return (ode(y=state, times=t,func=derivs, parms=parms, method="rk4"))} # Starting values of fluxes/parameterspars <- c(kinA=5, kAtoB=0.3, kAout=0.1, kinB=2, kBtoA=0.3, kBout=0.3) #Model results Mod(time, pars)data <- data.frame(Mod(time, pars))plot(Mod(time, pars)) The result does not look right. I could not figure out where I made a mistake in compilin...
2003 Mar 06
2
question about model formula
Dear R Gang, I'm interested in using R and the nls package for fitting kinetic models. I'm having some difficulty getting a model specified for nls though. The math for the model that I want to fit is dg(t)/dt = K1 f(t) - k2 g(t) where g(t) and f(t) are measured data at a sequence of times t. K1 and k2 are the parameters of the model. If I solve this, the solution is g(t) = K1
2004 Feb 05
1
Installing odesolve under MacOSX
Installing odesolve in Raqua 1.8.0 or 1.8.1 under MacOSX gives the following message: Warning message: Installation of package odesolve had non-zero exit status in: install.packages(ui.pkgs, CRAN = getOption(where), lib = .libPaths()[1]) Moreover, in the source of odesolve is no makefile. Does anyone know how to get a proper installation? Maartje
2020 Feb 27
2
[PATCH] Update the 5 year logo to 10 year logo
...a*ks4n&0+OhMk?Z+Kc2APgIa*tMKL;K>>`-T&K=KMI-%xPI;Wcho zB)h-X3%py+X`Q~_up_Uc4Ce(2d*3_Qb{PWV?mLehY^UvfSm!mV|LzdEz_AFesM`@? zJ);s=H@O+EjU^}xQuYqSi*%g#WwkD<G@o_GxzNJk8*jqWv#}<1s3%<6Y~CA3mei%5 zz5rMbgwH>b3_0p<Uua*%W%fR|c-={F(Xyjo!g--g>W$^UpKo`LpJk?6G+?RRlE$og z)OgWLWyK?)JhFrK4kWP)y~!bWhizn?yPK|+HB>GaSej*<Tv}HXw>naGcU2v8sSvEn zB{{)-N9wC;|GLljLrZ2t!}L3MK}TZz^#4HgB@69Z$!{yy1B_;DcIVn3|4gTe)XLo7 zxr!uih1RulYd-sow<)Lbs^A3znip1JGxjG=QN85s(v}JfdZq|kkQ(*HuKbPXQ6o>) zGDF;+R6Nk<Ce843N-J|?N8~|Ef4@T#&K<v&R6eGiRjht2o_FHjAZHwNRK(ytO68LA zFIwsg#RmLXENm)Ah&lt...
2008 May 21
0
Errors in using gdb (PR#11496)
...g/mmnnaZD5uoSKaAd X8pg71pmNvs29/oG3nRqaI+4F1FZyrnQjumw4uBbKvwjOe9sw+aVwjjsjLgvYDn/pm0utAu1 iiDNe87zhcLbn/d4b3Oz2bB3XTU7PZ152mkWfRKJRNBO6jdo56d85IGEwQBvWGNjK/9LOg6X amhHD/ZcLGHHMmddhhD8AwVprKjcFVHT0D4wcoZ2NLZfe+21c+fOveqqq2688cYFCxbcc889 gOsPPvjg0qVLH3744Yceegh2Fi9efNtttz322GPh6lO8aJ3Zs2efeeaZOtnuT5brk4fZbmdD lr7peXU8agjaSSTSOIN2co8Z9yLLNql/oF1wj4FHwsHBKuD6YLWK4RABPs2bNw+I/YYbbrj1 1lt/+9vfLly4EIj9j3/847Jly5544okVK1bAX8D1pYkmT93wp/v+fM6cObNmzWIpo9k5Lfbs SaKmSyKRSGMd2mlEI5FI1uSjfnFVgHbohZpNp1IZwB+DBgYGa7VaZWDgyiuvRMeYBQsW3H// /Q888MDDDz/8+OOPP/XUU88+++xziZ5++mmg90cfffTr3/y3M2fNAmg/66yz6HqRCNpJJNJ4 h...
2023 Apr 03
4
Simple Stacking of Two Columns
Hi R-Helpers, Sorry to bother you, but I have a simple task that I can't figure out how to do. For example, I have some names in two columns NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) and I simply want to get a single column
2024 Oct 17
2
DPLYR Multiple Mutate Statements On Same DataFrame
Hi R Helpers, I have been looking for an example of how to execute different dplyr mutate statements on the same dataframe in a single step. I show how to do what I want to do by going from df0 to df1 to df2 to df3 by applying a mutate statement to each dataframe in sequence, but I would like to know if there is a way to execute this in a single step; so simply go from df0 to df1 while executing