dglevitt

115 Reputation

4 Badges

19 years, 253 days
I have developed a Physiologically Based Pharmacokinetic program (PKQuest) in Maple. Application of this program to more than 30 different drugs has been described in a series of publications. The program and the publications are freely available at www.pkquest.com.

MaplePrimes Activity


These are questions asked by dglevitt

For the following program using dsolve to solved a differential equation with a sum of exponential inputs, the time required has a huge dependence on subtle difference in paramters.

For example, if Cl := 0.32, calculation time is 1.4 sec.    If Cl := 0.33,  calculation time is 39 sec.

Also, calculation time seems to have huge dependence  on whether or not I truncate M

Can someone please explain what is going on?

restart;
st := time();
N := 4;

T := 5.0/60;
M := 6905;
dose := t -> M*sum(Heaviside(t - 24*k/N)*exp((-t + 24*k/N)/T), k = 0 .. 2*N - 1);
Cl := 0.32;
deq := diff(C(t), t) = dose(t) - Cl*C(t);
sol := t -> rhs(dsolve({deq, C(0) = 0}));
p := plot(sol(t), t = 0 .. 48);
time() - st;
                             1.360
 

The following is a simple example of what I would like to do: 

M := Array(1 .. 10, 1 .. 2);

for i to 10 do
    M[i, 1] := i;
    M[i, 2] := 3*i;
end do;

Mt := Interpolation:-LinearInterpolation(M);
E := t -> Mt(t);
diffeq := D(C)(t) = E(t);
dsolve({diffeq, C(0) = 0}, {C(t)}, numeric);
Error, (in dsolve/numeric/process_input) unknown Interpolation:-LinearInterpolation([Vector(10, [1.,2.,3.,4.,5.,6.,7.,8.,9.,10.], datatype = float[8], attributes = [source_rtable = (Vector(10, [1.,2.,3.,4.,5.,6.,7.,8.,9.,10.], datatype = float[8], attributes = [source_rtable = (Array(1..10, 1..2, [[1.,3.],[2.,6.],[3.,9.],[4.,12.],[5.,15.],[6.,18.],[7.,21.],[8.,24.],[9.,27.],[10.,30.]], datatype = float[8]))]))])],Vector(10, [3.,6.,9.,12.,15.,18.,21.,24.,27.,30.], datatype = float[8], attributes = [source_rtable = (Array(1..10, 1..2, [[1.,3.],[2.,6.],[3.,9.],[4.,12.],[5.,15.],[6.,18.],[7.,21.],[8.,24.],[9.,27.],[10.,30.]], datatype = float[8]))]),uniform = true,verify = false) present in ODE system is not a specified dependent variable or evaluatable procedure

I want to solve a system of 3 simple real linear odinary differential equations.

The solution using dsolve has some extra imaginary terms with very small (10^-10) coefficients.   How to I get just the real part of the solution.

Here is an example code:

v1 := 1;
v2 := 0.5;
k := 0.12;
p1 := 0.328;
p2 := 0.74;
l1 := 0.31;
l2 := 1.16;
sysode := diff(Cp(t), t) = -(p1 + p2 + k)*Cp(t) + l1*C1(t) + l2*C2(t), diff(C1(t), t) = (p1*Cp(t) - l1*C1(t))/v1, diff(C2(t), t) = (p2*Cp(t) - l2*C2(t))/v2;
ics := Cp(0) = 0.347, C1(0) = 0., C2(0) = 0.;
sol := convert(dsolve([sysode, ics]), float);

When I click on the "install" option for the update to the Physics Package, get the following error message:

Fetching package "Physics Updates" from MapleCloud...
ID: 5137472255164416
Version: 988
URL: https://maple.cloud

An error occurred, the package was not installed: 
Unable to log into Maplesoft account: Forbidden (403)

I would like to use the command "TensorArray"  to create the contravariant tensor.  As seen in the following simple routine, the command output seems to assign values to the contravariant tensor, but, on the last line, the contravariant value is still unassigned. 




 

 

 

1 2 3 Page 1 of 3