ogunmiloro

120 Reputation

6 Badges

6 years, 180 days

MaplePrimes Activity


These are replies submitted by ogunmiloro

@tomleslie @Carl Love @Kitonum please these are problems I want to adress as earlier posed by @mmcdara 10007. The problems deal with parameter estimation. I intend to fit the data to the model and obtain the unknown values and also the plot of the error. Help, kindly see to this

@tomleslie Thank you for the job done. However, i experienced an error when trying to open it.~

Error, (in ExcelTools:-Import) Could not open the file.
                      someData[4 .. (), 8]
                     someData[4 .. (), 22]


Also, Please i want you to take just an example of a year and perform a time series and fitting to a SIR model. That will be of great guide to me in subsequent data analysis. Thanks in Advance

  restart;

#
# Read the data - NB will have ti change the path
# name and file name to something appropriate for
# his/her installation
#
  someData:=ExcelTools:-Import("C:/Users/TomLeslie/Desktop/testDAta.xls"):
#
# There are many ways to "organise" this data into
# ways which are convenient to access - the following
# is just one possibility
#
  data:= table
         ( [ seq
             ( 2013+j=table
                      ( [ cases=someData[4..,6+4*j],
                          labCfd=someData[4..,7+4*j],
                          deaths=someData[4..,8+4*j],
                          CFR=someData[4..,9+4*j]
                        ]
                      ),
               j=0..4
             )
           ]
         ):
#
# Access data by year and category, where the former is
# one of 2013, 2014,....2017 and the latter is one of
# cases, labCfd, deaths, CFR
#
  data[2013][deaths];
  data[2017][cases];

_rtable[18446744074355802590]

 

_rtable[18446744074355804270]

(1)

 

 


 

Download dataOrg.mw

@Carl Love thanks very much for your effort. I have imported a proper data from excel.
This data involves  diseases cases from 2012 - 2017. In the data the following terms are properly defined
(1) Susp---Suspected cases
(2)Labcfd---Laboratory confirmed of confirmation
(3) Deaths
(4)CFR-----Cases fatality rate.
Thanks i look forward to the properly time series analysisdisease_data-_2012-2017_in_regions..xlsdisease_data-_2012-2017_in_regions..xlsdisease_data-_2012-2017_in_regions..xls

@mmcdara

please i stll expect your help towards the actualizations of the computations

#
 

restart

N__1 := 9;

9

 

3

 

1

 

4

 

0.4e-1

 

.4

 

.3

 

0.1e-1

 

.1

 

.2

 

.6

 

0.3e-1

 

.8

 

proc (t) options operator, arrow; N__1 end proc

 

proc (t) options operator, arrow; N__2 end proc

 

proc (t) options operator, arrow; N__3 end proc

 

proc (t) options operator, arrow; N__4 end proc

 

3

(1)

for n from 0 to m do `x__n+1` := N__1+lambda*t-d*(int(add(x__n__, n = 0 .. m), t = 0 .. t))-beta*(int(add(x__n, n = 0 .. m)*x__n*v__n, t = 0 .. t)); `w__n+1` := N__2+(1-q)*beta*(int(add(x__n*v__n, n = 0 .. m), t = 0 .. t))-e*(int(add(w__n, n = 0 .. m), t = 0 .. t))-delta*(int(add(w__n, n = 0 .. m), t = 0 .. t)); `y__n+1` := N__3+q*beta*(int(add(x__n*v__n, n = 0 .. m), t = 0 .. t))-a*(int(add(y[n], n = 0 .. m), t = 0 .. t))+delta*(int(add(w__n, n = 0 .. m), t = 0 .. t)); `v__n+1` := N__4+k*(int(add(y[n], n = 0 .. m), t = 0 .. t))-mu*(int(add(v[n], n = 0 .. m), t = 0 .. t)) end do;

9+.4*t-0.4e-1*x__n__*t-.16*x__n^2*v__n*t

 

3+0.32e-1*x__n*v__n*t-1.6*w__n*t

 

1+.128*x__n*v__n*t-.2*y[0]*t-.2*y[1]*t-.2*y[2]*t-.2*y[3]*t+1.2*w__n*t

 

4+.6*y[0]*t+.6*y[1]*t+.6*y[2]*t+.6*y[3]*t-mu*(t*v[0]+t*v[1]+t*v[2]+t*v[3])

 

9+.4*t-0.4e-1*x__n__*t-.16*x__n^2*v__n*t

 

3+0.32e-1*x__n*v__n*t-1.6*w__n*t

 

1+.128*x__n*v__n*t-.2*y[0]*t-.2*y[1]*t-.2*y[2]*t-.2*y[3]*t+1.2*w__n*t

 

4+.6*y[0]*t+.6*y[1]*t+.6*y[2]*t+.6*y[3]*t-mu*(t*v[0]+t*v[1]+t*v[2]+t*v[3])

 

9+.4*t-0.4e-1*x__n__*t-.16*x__n^2*v__n*t

 

3+0.32e-1*x__n*v__n*t-1.6*w__n*t

 

1+.128*x__n*v__n*t-.2*y[0]*t-.2*y[1]*t-.2*y[2]*t-.2*y[3]*t+1.2*w__n*t

 

4+.6*y[0]*t+.6*y[1]*t+.6*y[2]*t+.6*y[3]*t-mu*(t*v[0]+t*v[1]+t*v[2]+t*v[3])

 

9+.4*t-0.4e-1*x__n__*t-.16*x__n^2*v__n*t

 

3+0.32e-1*x__n*v__n*t-1.6*w__n*t

 

1+.128*x__n*v__n*t-.2*y[0]*t-.2*y[1]*t-.2*y[2]*t-.2*y[3]*t+1.2*w__n*t

 

4+.6*y[0]*t+.6*y[1]*t+.6*y[2]*t+.6*y[3]*t-mu*(t*v[0]+t*v[1]+t*v[2]+t*v[3])

(2)

NULL

NULL


 

Download MPGH_sim.mw

@Carl Love thanks very much. I corrected that, but i still have the system solutions repeating itself. This #is what i got.

@tomleslie thank you very much for the job well done. This is the problem i encounter
(1) My maple version is not running the graphs as it ought to be, but it ran through in yours

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/someODEs2.mw .
 

Download someODEs2.mw

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/someODEs2.mw .
 

Download someODEs2.mw

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/someODEs2.mw .
 

Download someODEs2.mw

Maple Worksheet - Error


Maple Worksheet - Error

.
 

Download someODEs2.mw

 

 

Download someODEs2.mw

 

 

 

 

. you will see it in the code i uploaded. i mean it was giving me something like
PLOT( )
PLOT( ) and so on.

(2) i want to obtain the numerical values  from the series code you wrote as

(3)Also, if the answers are thesame i think the combined graphs should fit together
i mean the code you wrote as
display([v1, a1]); display([v2, a2]); display([v4, a4])

@Christian Wolinski 
I initialized at B(0) := .50; C(0) := .30; DD(0) := .21; E(0) := .14; F(0) := .70; G(0) := .45; H(0) := .14 but it wasnt running smoothly
 

@mmcdara thanks for your help. The first two points raised by you are very correct. B(T) is the priori model of the empirical observations iV. So I want iV to be considered as a observation for C(T) or DD(T). The model is resumed by 16 empirical observations by 7 matrix dimensions. Also, I want to know if transmissibility parameters like beta1 and betao values can be fitted to the experimental observations iV. You can please go forward with the coding/computations. Thanks.

@mmcdara
There is no relationshipt between i(t) and B(T), C(T),....H(T)....it is wrong. i intend to write either B(T) or....H(T) where i wrongly wrote i(T).
 pt := odeplot(N, [t, i(t)], 1 .. len, color = blue)
My intention is to fit the data values with each state variables and see the behavior on the two on the same graph

@mmcdara 777 thanks a lot for your expalantions and the code correction.
These are my intentions;
(1) The system of equations describes an epidemic transmission which i got an assumed data values for infected individuals per year in different localities earlier listed in the begining of the code. i intend to fit this data to the model equations which still retains its parameters and variable values.
I want to fit this data values with each variables to see the relationship/behavior between real life data and parameters/variable values involved in the model system equations.
Or if you have another fitting method you can help with that and i will gladly apprreciate.
Please i need help on that.
Thanks
 

@tomleslie Thanks once again for your good work and special attention to this program.
My question is
(1) You have varied the parameter "xi" at three different values. I checked the code for alteration so that i can also vary other parameters like "Mh, psi, mu" etc. but i couldnt get it.
How do i vary other parameters.

@tomleslie thank you very much for taking your time to attend to my problems, i'm very grateful. Here are some points i need to raise;
(1)A particular code you wrote as
interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])
is not running on my maple sheet. I dont know if my version cant support that or better still, another code that can give the matrix is appreciated.
(2) The code i wrote for the series is the differential transformation method(DTM) series applied to model equations. My intentions were to see wether the series solution for DTM will agree with the numerical values/solutions using RK4
(3) Also, i need codes for parametric plots, e.g., for Mh, beta1 etc.
Once again, I appreciate @tomleslie
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw
 

restart; with(plots); _local(gamma)

M__h := .50:

ODEs := diff(B(T), T) = M__h-beta__1*psi*B(T)*G(T)-mu__r*B(T), diff(C(T), T) = beta__1*psi*B(T)*G(T)-sigma*psi*beta__1*E(T)*DD(T)-(alpha+xi+mu__r)*C(T), diff(DD(T), T) = alpha*C(T)-(gamma+mu__r)*DD(T), diff(E(T), T) = gamma*DD(T)+sigma*psi*beta__1*E(T)*G(T)-mu__r*E(T), diff(F(T), T) = M__c-psi*beta__o*F(T)*C(T)-mu__b*F(T), diff(G(T), T) = psi*beta__o*F(T)*C(T)-mu__b*G(T):

ans := dsolve([ODEs, bcs], numeric):

 

 

 

 

 

 

interface(rtablesize = [22, 10]); M := Matrix([`~`[lhs](ans(0)), seq(`~`[rhs](ans(j)), j = 0 .. 20)])

Error, (in interface) rtablesize must be a positive integer, or infinity

 

M := Vector(4, {(1) = ` 22 x 7 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(1)

#
# Generate power series solutions of order 12
# (Maple default is 6) for all ODEs
#
  Order:=12:
  ans2:= convert~
         ( evalf~
           ( dsolve
             ( {ODEs, bcs},
               indets([ODEs], function(name)),
               'series'
             )
           ),
           polynom
         );
#
# Plot the "numeric" solution obtained earlier
# and the equivalent power series solution
# obtaine above on th same graph.
#
# Note that the range of the plots is reduced,
# because even with 12-th order polynomials,
# the power series soluton and the numerical
# solution start to deviate for T>~6
#
  for j in indets([ODEs], function(name)) do
      display
      ( [ odeplot
          ( ans,
            [T, j],
            T = 0 .. 10,
            thickness = 4, style = point,
            color = red
          ),
          plot
          ( eval(j, ans2),
            T = 0 .. 10,
            thickness = 2, style = point,
            color=blue
          )
        ],
        title = cat(convert(j,string), " (Numerical and PowerSeries compared)"),
        titlefont = [tims, bold, 20]
      )
   end do

{B(T) = .5000000000+.4997992350*T-0.1003402817e-3*T^2+0.1470042520e-7*T^3-0.4186689729e-11*T^4+0.1797722185e-13*T^5-0.7652371692e-15*T^6+0.2923183302e-16*T^7-0.8844182475e-18*T^8+0.2215403975e-19*T^9-0.4589870880e-21*T^10+0.5389509965e-23*T^11, C(T) = .3000000000-0.4811931399e-1*T+0.3859529419e-2*T^2-0.2063396439e-3*T^3+0.8267055682e-5*T^4-0.2631388485e-6*T^5+0.6554216926e-8*T^6-0.5551714044e-10*T^7-0.1520371564e-10*T^8+0.2777703195e-11*T^9-0.3923000816e-12*T^10+0.4970214040e-13*T^11, DD(T) = .2100000000-.1140840000*T+0.3730565453e-1*T^2-0.8568110732e-2*T^3+0.1494601849e-2*T^4-0.2091819518e-3*T^5+0.2441368229e-4*T^6-0.2442660302e-5*T^7+0.2138541461e-6*T^8-0.1664279070e-7*T^9+0.1165691616e-8*T^10-0.7422668732e-10*T^11, E(T) = .1400000000+.1469441693*T-0.3995870043e-1*T^2+0.8709964152e-2*T^3-0.1500287681e-2*T^4+0.2093639084e-3*T^5-0.2441847491e-4*T^6+0.2442759169e-5*T^7-0.2138545263e-6*T^8+0.1664257448e-7*T^9-0.1165658906e-8*T^10+0.7422262550e-10*T^11, F(T) = .7000000000+.6324990290*T-0.1581608397e-2*T^2+0.2679492283e-5*T^3-0.6093270788e-8*T^4+0.1272029637e-9*T^5-0.4253521584e-11*T^6+0.1189725836e-12*T^7-0.2702521878e-14*T^8+0.3074973933e-16*T^9+0.3481499101e-17*T^10-0.6346661500e-18*T^11, G(T) = .4500000000-0.2249028960e-2*T+0.5983397429e-5*T^2-0.5345061622e-7*T^3+0.2810718704e-8*T^4-0.1239204116e-9*T^5+0.4250786124e-11*T^6-0.1189706297e-12*T^7+0.2702520657e-14*T^8-0.3074973865e-16*T^9-0.3481499102e-17*T^10+0.6346661500e-18*T^11}

 

Warning, inserted missing semicolon at end of statement

 

 

 

 

 

 

 

``


 

Download MAPQ12.mw

 

 

 

 

 

1 2 3 4 5 6 Page 5 of 6