Displaying 20 results from an estimated 1000 matches similar to: "External signal in ODE written in C (using deSolve and approx1?)"
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 <-
2011 Jan 25
1
deSolve: Problem solving ODE including modulo-operator
I have a problem integrating the 'standard map' (
http://en.wikipedia.org/wiki/Standard_map
http://en.wikipedia.org/wiki/Standard_map ) with deSolve:
By using the modulo-operator '%%' with 2*pi in the ODEs (standardmap1), the
resulting values of P and Theta, should not be greater than 2pi. Because
this was not the case, i was thinking that the function 'ode' has some
2011 Aug 16
1
deSolve, extracting variable values from inside ode function
I'm just getting to grips with using ode function and have used the
examples and vignettes to produce a small model of a one-pool,
michaelis-menten, enzyme kinetic reaction. The rate of flux of substrate
into pool A is constant (fluxoa) however the rate of flux out of pool A
is controlled by the HMM equation (v = Vmax/ ( 1 + (Km / Concentration A
)) ). This function works fine and
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 small (about 1e-130) numbers.
Does R have more accurate ODE solvers as
2011 Mar 15
1
precompiled ode with spline input
I tried to use lsode with precompiled C code instead of an R function
defining the derivatives. No problem so far.
However, now I need to implement an ODE that contains spline functions,
i.e. the derivatives at given time points depend on the value of a
spline function at this time point. What is an efficient way to
implement this in precompiled C code?
--
Daniel Kaschek <daniel.kaschek at
2013 Apr 21
1
lsoda question from deSolve package
Dear List,
Wonder if you have some thoughts on the following question using lsoda in desolve:
I have the following data and function:
require(deSolve)
times <- c(0:24)
tin <- 0.5
D <- 400
V <- 26.3
k <-0.056
k12 <- 0.197118
k21 <- 0.022665
yini <- c(dy1 = 0,dy2 = 0)
events <- data.frame(var = "dy1",time = c(10,15),value = c(200,100),method =
2010 Sep 16
3
package test failed on Solaris x86 -- help needed for debugging
Dear R developers,
we have currently a 'mysterious' test problem with one package that
successfully passed the tests on all platforms, with the only exception
of Solaris x86 where obviously one of our help examples breaks the CRAN
test.
As we don't own such a machine I want to ask about a possibility to run
a few tests on such a system:
r-patched-solaris-x86
An even more recent
2009 Jun 11
3
deSolve question
Dear All,
I like to simulate a physiologically based pharmacokinetics model using R
but am having a problem with the daspk routine.
The same problem has been implemented in Berkeley madonna and Winbugs so
that I know that it is working. However, with daspk it is not, and the
numbers are everywhere!
Please see the following and let me know if I am missing something...
Thanks a lot in advance,
2012 Feb 03
1
Logistic population growth and deSolve
Hello, I am new to R and I am having problems trying to model logistic
population growth with the deSolve package. I would like to run the model
for four populations with the same initial population and carrying capacity
but with different growth rates and put the results into a data frame. When
I run the following lines of code I get unexpected results from "output" but
the format is
2010 Nov 28
3
non-linear fourth-order differential equations
I need to solve a system of non-linear fourth-order differential
equations. Is there a command which solves this system?
Thanks in advance.
2016 Apr 26
0
vectors of equations in ode / desolve
Hello,
I have a syntactic problem with ode. How do I specify vectors of
equations in ordinary differential equation systems. (i.e. in my case I
want to simulate an a priory undefined number of species that have
different parameters but the same behaviour)
I demonstrate this using the Lotka Volterra example. The code below does
not work and I have not a good idea how to specify this right.
##
2012 Jan 30
2
ode() tries to allocate an absurd amount of memory
Hi there R-helpers:
I'm having problems with the function ode() found in the package deSolve.
It seems that when my state variables are too numerous (>33000 elements),
the function throws the following error:
Error in vode(y, times, func, parms, ...) :
cannot allocate memory block of size 137438953456.0 Gb
In addition: Warning message:
In vode(y, times, func, parms, ...) : NAs
2012 Jul 03
1
Wrapper function for multivariate arrays for ode
I am trying to to write a wrapper function for the ode solver (under
the package desolve) to enable it to take multivariate arrays. I know
how to do it for 1 dimension arrays but my code breaks down when I try
to do it for 2 dimensional arrays. Here is my code
diffwrap<-function(t,y,mu)vdpol(t=t,A[1:3,1:4]<-y[1:12],B[1:12]<-y[13:24],mu=mu)
vdpol<-function(t,A,B,mu)
{
list(c(mu,
2011 Aug 12
1
deSolve output
Hi,
I've solved a simple differential equation describing the degradation of
amino acid carbon (THAA-C) using deSolve.
Code is a follows:
# Input of model parameters, a and b describes form of curve, i is apparent
initial age of Org. C.
parameters <- c(a = a, b = b, i=i)
# Initial value of the model, G
state = c(G = G)
#specifies the function degradation as a function of
2010 Jun 07
1
Desolve package: How to pass thousand of parameters to C compiled code?
Hi,
I have used DeSolve package for my ODE problem regarding infectious disease transmission and currently am trying to pass lots (roughly a thousand) of model parameters to the C compiled model (I have to use C compiled code instead of R code purely because of the speed).
I can't go define it one by one as it gonna take ages to finish and also quite difficult to revise. I have read the
2013 Feb 21
1
using and event in deSolve
Hi All
Having been pointed the use of events and roots in deSolve, I was able to
implement the Izchikevich model of spiking neurons. However, I'm not too
sure of defining the event. The deSolve documentation says:
An event is triggered when the ball hits the ground (height = 0) Then
velocity (y2) is reversed
and reduced by 10 percent. The root function, y[1] = 0, triggers the event:
>
2013 Jun 18
1
deSolve question
Dear All
wonder if you could provide some insights on the following: currently I have this code which produces the expected results:
require(deSolve)
pars <- list(k = 0.08,v=15)
intimes <- c(0,0.5,12)
input <- c(800,0,0)
forc <- approxfun(intimes, input, method="constant", rule=2)
derivs <- function(t, state, pars) {
inp <- forc(t)
dy1 <- - pars$k * state[1]
2012 Jul 18
1
Defining a variable outside of optim or differential equation solver.
This is applicable to either using optim or the differential equation
solver or any similar solver
Suppose I want to use the differential equation solver and this is my code
d<-y[2]
vdpol<-function(t,y)
{
list(c(1,
d,
3,
4
)
}
stiff<-ode(y=rep(0,4),times=c(0,1),func=dvdpol,parms=1)
The thing is I want d to be composed of one of state variables in the
2009 May 13
2
ode first step
Hi all,
I try to assess the parameters (K1,K2) of a model that describes the
adsorption of a molecule onto on adsorbent.
equation: dq/dt = K1*C*(qm-q)-K2*q
I know the value of 'qm' and I experimentally measure the variables 'q',
'C', and the time 't'.
t C q
1 0 144.05047 0.0000000
2 565 99.71492 0.1105625
3 988 74.99426
2008 Sep 16
2
odesolve dynload example
Hello R Developers,
This is my first foray into using c-code with R, so please forgive my
foolishness.
I had a look at the archives and did not find anything on this, so
hopefully I am not doubling up.
I have tried to use R cmd to create an object file from the odesolve
dynload example.
I am using windows and have just installed rtools, and have the latest
version of stable R (2..7.2).
This is