**From: SAM LIAO <0005856464@mcimail.com> Thu Oct 19 17:05:14 1995
**

Dear NONMEM users:

I have a technical problem using $DES in nmtran control stream file;

===============================================

$DES

CP0= EXP(-P(1)*T) - EXP(-P(2)*T)

CP= CP0*RA

X0= (T-TZ)*2*3.1416/TAU

R=RM + RB*COS(X0)

DADT(1)= -K10*A(1) + R*(1 - CP/(IC50 + CP))

===============================================

I got a FORTRAN syntax error on COS function in line 5. When I looked up the nmtran manual, p46, it said "FORTRAN library functions LOG, LOG10,EXP, and SQRT are allowed, but no others".

Is there any alternative to do this? The COS function is needed to account for periodic changes in placebo effect. Another question of mine is whether T is correct to define the time.

******
**

**From "/S=rokitta/OU=(a)H8TH0010.hoechst.com/"@central.hoechst-ag.d400.de Fri Oct 20 04:28:36 1995
**

Yes, T is correct to define continous time in $DES.

I just had an idea to aproximate the COS(x) (following the analytical representation of the COS by Newton), but it's (in your case) only accurate for values (T-TZ) .le. TAU, or in other words, it's an aproximation for the COS(x) for 0 <= X0 <= 2*PI. That's why I inserted this verbatim code. The idea is, to reduce the calculation on the interval from 0 to 2*PI because the COS(x) is periodic. The function INT(x) represents the integer part of x.

$DES

CP0= EXP(-P(1)*T) - EXP(-P(2)*T)

CP= CP0*RA

X0= (T-TZ)*2*3.1416/TAU

" X0 = (X0/(2*3.1416) - INT(X0/(2*3.1416)))* 2*3.1416

COS1 = 1 - X0**2/2 + X0**4/24 - X0**6/720 + X0**8/40320 - X0**10/3628800

COS2 = COS1 + X0**12/479001600 - X0**14/87178291200

COSX = COS2 + X0**16/2.092279E13 - X0**18/6.402374E15

R=RM + RB*COSX

DADT(1)= -K10*A(1) + R*(1 - CP/(IC50 + CP))

I didn't test this part of NMTRAN code but I think it should work. Let me know if it did.

success,

Christian

------------------------------------------------------------------------

Christian Rokitta

Clinical Research

H 840

Hoechst AG

D-65926 Frankfurt am Main, Germany

Office : ++49 69 30580208

Privat : ++49 69 331550

FAX : ++49 69 30516433

Email: rokitta@mymail.com

(or: rokitta@msmkf1.hoechst.hoechst-ag.d400.de)

------------------------------------------------------------------------

******
**

**From: Alison Boeckmann
**

Sam Liao and Christian Rokitta recently sent email discussing the use of COS/SIN functions in NMTRAN. These functions are not permitted in abbreviated code with NONMEM IV, but will be with NONMEM V.

NONMEM V is still far away, so what can you do till then?

Verbatim code can be used with NONMEM IV, but *ONLY* if the arguments to SIN and COS are not random variables, i.e., do not involve etas.

In Sam's case, if TZ and TAU are not defined using etas, then he could code:

$DES

CP0= EXP(-P(1)*T) - EXP(-P(2)*T)

CP= CP0*RA

X0= (T-TZ)*2*3.1416/TAU

" COSX0=COS(X0)

R=RM + RB*COSX0

DADT(1)= -K10*A(1) + R*(1 - CP/(IC50 + CP))

The calculation of COSX0 in verbatim code avoids the restriction on the use of COS function in abbreviated code. As Christian notes, T is continuous time in $DES, and does not involve etas.

Christian's suggestion to use the series expansion of COS also involves verbatim code for the INT function. But it modifies X0 AFTER it has been calculated, and only in a way that does not involve derivatives (I think), so it might work. If Sam sends me his complete control stream (with $PK block and a few data records), I can check Christian's suggestion numerically. (I wonder if he needs as many terms in the series, and what the run time will be!)

There is a more general way to get around the lack of SIN/COS and other functions in NONMEM IV's abbreviated code.

Use a function that is permitted, such as SQRT, in place of COS in the abbreviated code. Save the generated FSUBS file.

Modify it as follows.

1) Replace SQRT by COS in the computation of the typical value.

2) Replace the code that computes the derivative of SQRT by code that computes the derivative of COS, using the same Annnnn variable name for the final result. The generated code in FSUBS will already have code to multiply this Annnnn variable by the derivatives of its arguments according to the the chain rule for derivatives, and this should work if changed with care. (Sometimes the generated code contains simplifications, and should be examined very carefully.)

I don't know that anyone has ever actually done this, but in principal it should be doable, and would apply to other continuous-valued functions besides COS. ABS and INT are not continuous, so their derivatives involve special problems.

Alison Boeckmann

========================