janhardo

690 Reputation

12 Badges

11 years, 36 days

MaplePrimes Activity


These are replies submitted by janhardo

SEIRTP_R0_sensitivity_report := proc(params::list, normalize::boolean := true)
description "R Sensitivity Analysis – Table + Barplot + Dynamic Policy Advice for SEIRTP model with compartment effects";

global comp_matrix_export, comp_matrix_labels;

local Lambda, alpha, beta, r, xi, K, eta, phi, mu, sigma, tau, theta, delta, gamma_;
local Ro, Ro_num, dp, Sp, p, i, paramlist, param_names, values, label_list, maxval;
local param_values, n_params, barplot, interpretation, recommendations, threshold;
local dir, advice, v, comp_labels, comp_effects, all_effects, j;

# Full symbolic parameter list
paramlist := [Lambda, alpha, beta, r, xi, K, eta, phi, mu, sigma, tau, theta, delta, gamma_];
param_names := ["Λ", "α", "β", "r", "ξ", "K", "η", "φ", "μ", "σ", "τ", "θ", "δ", "γ"];
n_params := nops(paramlist);
param_values := [seq(rhs(params[i]), i=1..n_params)];

# R formula
Ro := (Lambda*alpha*beta*r*xi*(-K*eta*phi + K*eta*r - r)) /
      (mu*(K*phi*sigma - K*r*sigma - r*tau)*
      (K*beta*eta*phi - K*beta*eta*r + beta*r + mu*r + r*theta)*(delta + gamma_ + mu));

printf("\n�� SEIRTP-Parameterverklaring / Parameter Descriptions:\n");
printf("╔════════════╦════════════════════════════════════════════════════════════╗\n");
printf("║ Parameter  ║ Beschrijving (NL) / Description (EN)                      ║\n");
printf("╠════════════╬════════════════════════════════════════════════════════════╣\n");
printf("║ Λ (Lambda) ║ Instroom / geboorteratio – inflow rate / birth rate       ║\n");
printf("║ α (alpha)  ║ Infectieratio bij contact – infection probability         ║\n");
printf("║ β (beta)   ║ Contactfrequentie – contact rate                          ║\n");
printf("║ r          ║ Detectieratio / testintensiteit – detection rate          ║\n");
printf("║ ξ (xi)     ║ Tracing efficiëntie – tracing effectiveness               ║\n");
printf("║ K          ║ Zorgcapaciteit – healthcare system capacity               ║\n");
printf("║ η (eta)    ║ Snelheid van ziek worden – progression to infectious      ║\n");
printf("║ φ (phi)    ║ Behandelingsimpact – treatment effect on transmission     ║\n");
printf("║ μ (mu)     ║ Natuurlijke sterfte – natural death rate                  ║\n");
printf("║ σ (sigma)  ║ Sterfte bij behandeling – death during treatment          ║\n");
printf("║ τ (tau)    ║ Behandelduur – duration of treatment                      ║\n");
printf("║ θ (theta)  ║ Terugval / herinfectie – relapse or reinfection rate      ║\n");
printf("║ δ (delta)  ║ Infectie-specifieke sterfte – infection-induced mortality ║\n");
printf("║ γ (gamma)  ║ Herstelkans – recovery rate                               ║\n");
printf("╚════════════╩════════════════════════════════════════════════════════════╝\n\n");

Ro_num := evalf(subs(paramlist =~ param_values, Ro));
if Ro_num = 0 then error "R = 0, normalization not possible"; end if;

printf("�� R computed = %.5f\n", Ro_num);
if abs(Ro_num - 1.0) < 0.01 then
    printf("⚖️  R ≈ 1 → Epidemic threshold.\n");
elif Ro_num < 1.0 then
    printf(" R < 1 → Outbreak likely to die out.\n");
else
    printf("�� R > 1 → Epidemic spread possible.\n");
end if;

# Sensitivity values
values := [];
for i from 1 to n_params do
    p := paramlist[i];
    dp := evalf(subs(paramlist =~ param_values, diff(Ro, p)));
    Sp := dp * param_values[i] / Ro_num;
    values := [op(values), Sp];
end do;

if normalize then
    maxval := max(seq(abs(v), v in values));
    values := map(v -> v / maxval, values);
end if;

# Interpretation
interpretation := proc(val)
    if abs(val) >= 0.9 then return "�� Strong effect";
    elif abs(val) >= 0.4 then return "�� Moderate influence";
    elif abs(val) >= 0.01 then return "�� Small effect";
    else return "�� Negligible"; end if;
end proc:

# Sensitivity Table
printf("\n�� %s Sensitivity Index of R:\n", `if`(normalize, "Normalized", "Original"));
printf("--------------------------------------------------------------------------\n");
printf("%-13s | %-10s | %-30s\n", "Parameter", "S", "Interpretation");
printf("--------------------------------------------------------------------------\n");
for i from 1 to n_params do
    printf("%-13s | %+10.5f | %-30s\n", param_names[i], values[i], interpretation(values[i]));
end do;
printf("--------------------------------------------------------------------------\n");

# Policy Advice
threshold := 0.4;
printf("\n�� Dynamic Policy Implications:\n");
printf("--------------------------------------------------------------------------\n");
printf("%-13s | %-10s | %-30s\n", "Parameter", "Direction", "Policy Advice");
printf("--------------------------------------------------------------------------\n");
for i from 1 to n_params do
    if abs(values[i]) >= threshold then
        if values[i] > 0 then
            dir := "↑ Increase"; advice := "⚠️ Reduce to lower R";
        else
            dir := "↓ Decrease"; advice := " Increase to lower R";
        end if;
        printf("%-13s | %-10s | %-30s\n", param_names[i], dir, advice);
    end if;
end do;
printf("--------------------------------------------------------------------------\n");

# Compartment Effects Setup
comp_labels := ["S", "E", "I", "R", "P", "T"];
all_effects := table([
    Lambda = [1, 0, 0, 0, 0, 0],
    alpha  = [-1, 1, 1, 0, 0, 0],
    beta   = [0, -1, 1, 0, 0, 0],
    r      = [0, 0, 0, 0, 0, 1],
    xi     = [0, 0, 0, 0, 1, 0],
    K      = [0, 0, 0, 0, 0, 1],
    eta    = [0, -1, -1, 0, 0, 0],
    phi    = [0, 0, 0, 0, -1, 0],
    mu     = [-1, -1, -1, -1, -1, -1],
    sigma  = [0, 0, 0, 0, -1, 0],
    tau    = [0, 0, 0, 0, -1, 0],
    theta  = [0, -1, 0, 1, 0, 0],
    delta  = [0, 0, -1, 0, 0, 0],
    gamma_ = [0, 0, -1, 1, 0, 0]
]);

# Corrected matrix build using paramlist symbols
comp_effects := [seq(all_effects[paramlist[i]], i = 1..n_params)];
comp_matrix_labels := param_names;

# Export matrix
comp_matrix_export := comp_effects;

# Display Matrix
printf("\n�� Compartmental Effect Matrix (Qualitative):\n");
printf("--------------------------------------------------------------------------\n");
printf("%-10s | %3s %3s %3s %3s %3s %3s\n", "Parameter", op(comp_labels));
printf("--------------------------------------------------------------------------\n");
for i from 1 to nops(comp_effects) do
    printf("%-10s |", comp_matrix_labels[i]);
    for j to 6 do
        if comp_effects[i][j] = 0 then printf(" %3s", ".");
        elif comp_effects[i][j] > 0 then printf(" %3s", "+");
        else printf(" %3s", "-"); end if;
    end do;
    printf("\n");
end do;
printf("--------------------------------------------------------------------------\n");

# Optional Plot: UITGEZET werkt nog niet
##label_list := [seq(sprintf("%s (%s)", param_names[i], paramlist[i]), i=1..n_params)];
#barplot := plots:-barplot(label_list, values, orientation=horizontal,
             #title=sprintf("Sensitivity of R (%s)", `if`(normalize, "Normalized", "Original")),
             #width=0.6, color="CornflowerBlue", axes=boxed,
            # labels=["Parameter", "Sensitivity S"]);

#return barplot;

end proc:

params := [
  Lambda = 0.0133, alpha = 0.07954551, beta = 0.567, r = 0.076, xi = 0.0487,
  K = 300, eta = 0.009, phi = 0.09, mu = 0.00056, sigma = 0.000456,
  tau = 0.0900982, theta = 0.009, delta = 0.9, gamma_ = 0.00917
];
 

[Lambda = 0.133e-1, alpha = 0.7954551e-1, beta = .567, r = 0.76e-1, xi = 0.487e-1, K = 300, eta = 0.9e-2, phi = 0.9e-1, mu = 0.56e-3, sigma = 0.456e-3, tau = 0.900982e-1, theta = 0.9e-2, delta = .9, gamma_ = 0.917e-2]

(1)

SEIRTP_R0_sensitivity_report(params, true);   # Genormaliseerde sensitiviteit


�� SEIRTP-Parameterverklaring / Parameter Descriptions:
╔════════════╦════════════════════════════════════════════════════════════╗
║ Parameter  ║ Beschrijving (NL) / Description (EN)                      ║
╠════════════╬════════════════════════════════════════════════════════════╣
║ Λ (Lambda) ║ Instroom / geboorteratio – inflow rate / birth rate       ║
║ α (alpha)  ║ Infectieratio bij contact – infection probability         ║
║ β (beta)   ║ Contactfrequentie – contact rate                          ║
║ r          ║ Detectieratio / testintensiteit – detection rate          ║
║ ξ (xi)     ║ Tracing efficiëntie – tracing effectiveness               ║
║ K          ║ Zorgcapaciteit – healthcare system capacity               ║
║ η (eta)    ║ Snelheid van ziek worden – progression to infectious      ║
║ φ (phi)    ║ Behandelingsimpact – treatment effect on transmission     ║
║ μ (mu)     ║ Natuurlijke sterfte – natural death rate                  ║
║ σ (sigma)  ║ Sterfte bij behandeling – death during treatment          ║
║ τ (tau)    ║ Behandelduur – duration of treatment                      ║
║ θ (theta)  ║ Terugval / herinfectie – relapse or reinfection rate      ║
║ δ (delta)  ║ Infectie-specifieke sterfte – infection-induced mortality ║
║ γ (gamma)  ║ Herstelkans – recovery rate                               ║
╚════════════╩════════════════════════════════════════════════════════════╝

�� R computed = 1.54099
�� R > 1 → Epidemic spread possible.

�� Normalized Sensitivity Index of R:
--------------------------------------------------------------------------
Parameter     | S       | Interpretation                
--------------------------------------------------------------------------
Λ            |   +0.39683 | �� Small effect             
α            |   +0.39683 | �� Small effect             
β            |   +0.00442 | �� Negligible               
r             |   -1.00000 | �� Strong effect            
ξ            |   +0.39683 | �� Small effect             
K             |   +0.15556 | �� Small effect             
η            |   +0.00147 | �� Negligible               
φ            |   +1.00000 | �� Strong effect            
μ            |   -0.39733 | �� Small effect             
σ            |   +0.15409 | �� Small effect             
τ            |   -0.55091 | �� Moderate influence       
θ            |   -0.00416 | �� Negligible               
δ            |   -0.39258 | �� Small effect             
γ            |   -0.00400 | �� Negligible               
--------------------------------------------------------------------------

�� Dynamic Policy Implications:
--------------------------------------------------------------------------
Parameter     | Direction  | Policy Advice                 
--------------------------------------------------------------------------
r             | ↓ Decrease | Increase to lower R    
φ            | ↑ Increase | ⚠️ Reduce to lower R   
τ            | ↓ Decrease | Increase to lower R    
--------------------------------------------------------------------------

�� Compartmental Effect Matrix (Qualitative):
--------------------------------------------------------------------------
Parameter  |   S   E   I   R   P   T
--------------------------------------------------------------------------
Λ         |   +   .   .   .   .   .
α         |   -   +   +   .   .   .
β         |   .   -   +   .   .   .
r          |   .   .   .   .   .   +
ξ         |   .   .   .   .   +   .
K          |   .   .   .   .   .   +
η         |   .   -   -   .   .   .
φ         |   .   .   .   .   -   .
μ         |   -   -   -   -   -   -
σ         |   .   .   .   .   -   .
τ         |   .   .   .   .   -   .
θ         |   .   -   .   +   .   .
δ         |   .   .   -   .   .   .
γ         |   .   .   -   +   .   .
--------------------------------------------------------------------------

 

SEIRTP_R0_sensitivity_report(params, false);  # Originele sensitiviteit


�� SEIRTP-Parameterverklaring / Parameter Descriptions:
╔════════════╦════════════════════════════════════════════════════════════╗
║ Parameter  ║ Beschrijving (NL) / Description (EN)                      ║
╠════════════╬════════════════════════════════════════════════════════════╣
║ Λ (Lambda) ║ Instroom / geboorteratio – inflow rate / birth rate       ║
║ α (alpha)  ║ Infectieratio bij contact – infection probability         ║
║ β (beta)   ║ Contactfrequentie – contact rate                          ║
║ r          ║ Detectieratio / testintensiteit – detection rate          ║
║ ξ (xi)     ║ Tracing efficiëntie – tracing effectiveness               ║
║ K          ║ Zorgcapaciteit – healthcare system capacity               ║
║ η (eta)    ║ Snelheid van ziek worden – progression to infectious      ║
║ φ (phi)    ║ Behandelingsimpact – treatment effect on transmission     ║
║ μ (mu)     ║ Natuurlijke sterfte – natural death rate                  ║
║ σ (sigma)  ║ Sterfte bij behandeling – death during treatment          ║
║ τ (tau)    ║ Behandelduur – duration of treatment                      ║
║ θ (theta)  ║ Terugval / herinfectie – relapse or reinfection rate      ║
║ δ (delta)  ║ Infectie-specifieke sterfte – infection-induced mortality ║
║ γ (gamma)  ║ Herstelkans – recovery rate                               ║
╚════════════╩════════════════════════════════════════════════════════════╝

�� R computed = 1.54099
�� R > 1 → Epidemic spread possible.

�� Original Sensitivity Index of R:
--------------------------------------------------------------------------
Parameter     | S       | Interpretation                
--------------------------------------------------------------------------
Λ            |   +1.00000 | �� Strong effect            
α            |   +1.00000 | �� Strong effect            
β            |   +0.01113 | �� Small effect             
r             |   -2.51999 | �� Strong effect            
ξ            |   +1.00000 | �� Strong effect            
K             |   +0.39200 | �� Small effect             
η            |   +0.00370 | �� Negligible               
φ            |   +2.51999 | �� Strong effect            
μ            |   -1.00127 | �� Strong effect            
σ            |   +0.38830 | �� Small effect             
τ            |   -1.38830 | �� Strong effect            
θ            |   -0.01048 | �� Small effect             
δ            |   -0.98930 | �� Strong effect            
γ            |   -0.01008 | �� Small effect             
--------------------------------------------------------------------------

�� Dynamic Policy Implications:
--------------------------------------------------------------------------
Parameter     | Direction  | Policy Advice                 
--------------------------------------------------------------------------
Λ            | ↑ Increase | ⚠️ Reduce to lower R   
α            | ↑ Increase | ⚠️ Reduce to lower R   
r             | ↓ Decrease | Increase to lower R    
ξ            | ↑ Increase | ⚠️ Reduce to lower R   
φ            | ↑ Increase | ⚠️ Reduce to lower R   
μ            | ↓ Decrease | Increase to lower R    
τ            | ↓ Decrease | Increase to lower R    
δ            | ↓ Decrease | Increase to lower R    
--------------------------------------------------------------------------

�� Compartmental Effect Matrix (Qualitative):
--------------------------------------------------------------------------
Parameter  |   S   E   I   R   P   T
--------------------------------------------------------------------------
Λ         |   +   .   .   .   .   .
α         |   -   +   +   .   .   .
β         |   .   -   +   .   .   .
r          |   .   .   .   .   .   +
ξ         |   .   .   .   .   +   .
K          |   .   .   .   .   .   +
η         |   .   -   -   .   .   .
φ         |   .   .   .   .   -   .
μ         |   -   -   -   -   -   -
σ         |   .   .   .   .   -   .
τ         |   .   .   .   .   -   .
θ         |   .   -   .   +   .   .
δ         |   .   .   -   .   .   .
γ         |   .   .   -   +   .   .
--------------------------------------------------------------------------

 

Download mprimes_vraag_1-4-2025_SEIRTP_R0_sensitivity_report_.mw

restart;

SensitivityAnalysis := proc(
    Ro_expression::algebraic,
    parameters::list(name=algebraic),
    {normalization::identical("standard","bounded","sigmoid"):="bounded",
     display::boolean:=true}
)
    local param_names, param_values, sensitivity_indices, i, p_name, p_value,
          partial, raw_index, normalized_index, Ro_value, keys, p;
    
    # Evalueer Ro met de gegeven parameters
    Ro_value := eval(Ro_expression, parameters);
    
    # Extraheer parameter namen en waarden
    param_names := map(lhs, parameters);
    param_values := map(rhs, parameters);
    
    # Initialiseer resultatentabel
    sensitivity_indices := table();
    
    # Bereken gevoeligheid voor elke parameter
    for i to nops(param_names) do
        p_name := param_names[i];
        p_value := param_values[i];
        
        try
            # Bereken partiële afgeleide
            partial := diff(Ro_expression, p_name);
            
            # Bereken ruwe gevoeligheidsindex
            raw_index := eval(partial * p_value / Ro_value, parameters);
            
            # Pas geselecteerde normalisatiemethode toe
            if normalization = "standard" then
                normalized_index := raw_index;
            elif normalization = "bounded" then
                normalized_index := max(-1, min(1, raw_index));
            elif normalization = "sigmoid" then
                normalized_index := 2/(1+exp(-2*raw_index)) - 1;
            end if;
            
            # Sla resultaat op
            sensitivity_indices[p_name] := evalf(normalized_index);
        catch:
            # Als differentiatie faalt, wijs 0 toe (geen gevoeligheid)
            sensitivity_indices[p_name] := 0;
        end try;
    end do;
    
    # Toon resultaten als display=true
    if display then
        printf("\nGevoeligheidsanalyse Resultaten (%s normalisatie):\n", normalization);
        printf("============================================\n");
        printf("%12s %15s\n", "Parameter", "Gevoeligheid");
        printf("--------------------------------------------\n");
        
        keys := sort([indices(sensitivity_indices, 'nolist')]);
        for p in keys do
            if sensitivity_indices[p] <> NULL then
                printf("%12s %15.6f\n", p, sensitivity_indices[p]);
            else
                printf("%12s %15s\n", p, "N/B");
            end if;
        end do;
        printf("============================================\n");
    end if;
    
    # Geef resultaten terug
    return eval(sensitivity_indices);
end proc:

# Definieer het reproductiegetal Ro
Ro := (Lambda*alpha*beta*r*xi*(-K*eta*phi + K*eta*r - r))/
      (mu*(K*phi*sigma - K*r*sigma - r*tau)*
       (K*beta*eta*phi - K*beta*eta*r + beta*r + mu*r + r*theta)*
       (delta + gamma + mu));

# Definieer modelparameters
parameters := [
    Lambda = 0.0133,
    alpha = 0.07954551,
    delta = 0.9,
    K = 300,
    r = 0.076,
    tau = 0.0900982,
    gamma = 0.00917,
    mu = 0.00056,
    phi = 0.09,
    eta = 0.009,
    sigma = 0.000456,
    beta = 0.567,
    theta = 0.009,
    xi = 0.0487
];

# Voer analyse uit met verschillende normalisatiemethoden
standard_results := SensitivityAnalysis(Ro, parameters, normalization="standard", display=true);
bounded_results := SensitivityAnalysis(Ro, parameters, normalization="bounded", display=true);
sigmoid_results := SensitivityAnalysis(Ro, parameters, normalization="sigmoid", display=true);

Lambda*alpha*beta*r*xi*(-K*eta*phi+K*eta*r-r)/(mu*(K*phi*sigma-K*r*sigma-r*tau)*(K*beta*eta*phi-K*beta*eta*r+beta*r+mu*r+r*theta)*(delta+gamma+mu))

 

[Lambda = 0.133e-1, alpha = 0.7954551e-1, delta = .9, K = 300, r = 0.76e-1, tau = 0.900982e-1, gamma = 0.917e-2, mu = 0.56e-3, phi = 0.9e-1, eta = 0.9e-2, sigma = 0.456e-3, beta = .567, theta = 0.9e-2, xi = 0.487e-1]

 


Gevoeligheidsanalyse Resultaten (standard normalisatie):
============================================
   Parameter    Gevoeligheid
--------------------------------------------
           K        0.391999
      Lambda        1.000000
       alpha        1.000000
        beta        0.011135
       delta       -0.989305
         eta        0.003699
       gamma        0.000000
          mu       -1.001268
         phi        2.519994
           r       -2.519994
       sigma        0.388300
         tau       -1.388300
       theta       -0.010483
          xi        1.000000
============================================

 

table( [( tau ) = -1.388300446, ( sigma ) = .3883004457, ( Lambda ) = 1.000000001, ( alpha ) = 1.000000000, ( mu ) = -1.001267816, ( beta ) = 0.111348213e-1, ( phi ) = 2.519993613, ( r ) = -2.519993615, ( xi ) = 1.000000000, ( K ) = .3919990064, ( delta ) = -.9893045184, ( gamma ) = 0, ( eta ) = 0.36985611e-2, ( theta ) = -0.1048257226e-1 ] )

 


Gevoeligheidsanalyse Resultaten (bounded normalisatie):
============================================
   Parameter    Gevoeligheid
--------------------------------------------
           K        0.391999
      Lambda        1.000000
       alpha        1.000000
        beta        0.011135
       delta       -0.989305
         eta        0.003699
       gamma        0.000000
          mu       -1.000000
         phi        1.000000
           r       -1.000000
       sigma        0.388300
         tau       -1.000000
       theta       -0.010483
          xi        1.000000
============================================

 

table( [( tau ) = -1., ( sigma ) = .3883004457, ( Lambda ) = 1., ( alpha ) = 1., ( mu ) = -1., ( beta ) = 0.111348213e-1, ( phi ) = 1., ( r ) = -1., ( xi ) = 1., ( K ) = .3919990064, ( delta ) = -.9893045184, ( gamma ) = 0, ( eta ) = 0.36985611e-2, ( theta ) = -0.1048257226e-1 ] )

 


Gevoeligheidsanalyse Resultaten (sigmoid normalisatie):
============================================
   Parameter    Gevoeligheid
--------------------------------------------
           K        0.373082
      Lambda        0.761594
       alpha        0.761594
        beta        0.011134
       delta       -0.757066
         eta        0.003699
       gamma        0.000000
          mu       -0.762126
         phi        0.987136
           r       -0.987136
       sigma        0.369894
         tau       -0.882796
       theta       -0.010482
          xi        0.761594
============================================

 

table( [( tau ) = -.8827964097, ( sigma ) = .369894133, ( Lambda ) = .761594156, ( alpha ) = .761594156, ( mu ) = -.7621260922, ( beta ) = 0.11134361e-1, ( phi ) = .987135620, ( r ) = -.9871356198, ( xi ) = .761594156, ( K ) = .373082274, ( delta ) = -.7570656130, ( gamma ) = 0, ( eta ) = 0.3698544e-2, ( theta ) = -0.104821882e-1 ] )

(1)
 

 

Download mprimes-30-3-2025-_normalizing_sensitify_analysis_-vraag_.mw

If one parameter is increasing, the other parameters are constant

 

Must be possible to input a parameter(s) and see the influence 
on the graphs( did not test this yet) 

restart;
with(plots):
with(DEtools):

SEIRTPpanelplot := proc(param::list, tmin::numeric, tmax::numeric)
    description "SEIRTP Model Panel Plot – Shows each compartment in a separate subplot";

    local Lambda, alpha, delta, K, r, tau, gamma_, mu, phi, eta, sigma, beta, theta, xi;
    local S, E, Infectious, R, P, T, t, de, init, sol, p;
    local p1, p2, p3, p4, p5, p6, panel;

    # Default parameter values
    Lambda := 0.0133: alpha := 0.07954551: delta := 0.9: K := 300:
    r := 0.076: tau := 0.0900982: gamma_ := 0.00917: mu := 0.00056:
    phi := 0.09: eta := 0.009: sigma := 0.000456: beta := 0.567:
    theta := 0.009: xi := 0.0487:

    for p in param do eval(p); end do;

    # Differential equations
    de := [
      diff(S(t),t) = -P(t)*S(t)*alpha - S(t)*mu + Lambda,
      diff(E(t),t) = alpha*S(t)*P(t) - (-T(t)*eta + 1)*beta*E(t) - theta*E(t) - mu*E(t),
      diff(Infectious(t),t) = (-T(t)*eta + 1)*beta*E(t) - delta*Infectious(t) - gamma_*Infectious(t) - mu*Infectious(t),
      diff(R(t),t) = theta*E(t) + gamma_*Infectious(t) - mu*R(t),
      diff(P(t),t) = xi*Infectious(t) - sigma*T(t)*P(t) - tau*P(t),
      diff(T(t),t) = r*T(t)*(1 - T(t)/K) - phi*T(t)
    ]:

    init := [S(0)=1000, E(0)=10, Infectious(0)=5, R(0)=0, P(0)=1, T(0)=1]:

    sol := dsolve({op(de), op(init)}, numeric, output = listprocedure, range=tmin..tmax):

    p1 := odeplot(sol, [t, S(t)], tmin..tmax, title = "Susceptible S(t)", thickness = 2, color = red):
    p2 := odeplot(sol, [t, E(t)], tmin..tmax, title = "Exposed E(t)", thickness = 2, color = orange):
    p3 := odeplot(sol, [t, Infectious(t)], tmin..tmax, title = "Infectious I(t)", thickness = 2, color = blue):
    p4 := odeplot(sol, [t, R(t)], tmin..tmax, title = "Recovered R(t)", thickness = 2, color = green):
    p5 := odeplot(sol, [t, P(t)], tmin..tmax, title = "Pathogen P(t)", thickness = 2, color = purple):
    p6 := odeplot(sol, [t, T(t)], tmin..tmax, title = "Treatment T(t)", thickness = 2, color = brown):

    panel := display(Array([p1, p2, p3, p4, p5, p6]),
                     title = "SEIRTP Compartment Dynamics (Panel View)",
                     axes = boxed);

    # Automatically show the plot
    #plots[display](panel);
   
end proc:
 

SEIRTPpanelplot([], 0, 100); # Standard values

 

 

 

 

 

 

SEIRTPpanelplot([r = 0.12], 0, 50):  # With modified parameter

 

 

Download _mprimes_-31-3-2025_how_to_give_a_limit_value_from_-1_to_1_for_sensitivity_analysis_proc_2.mw

@ashy 30

I am now curious which epidemic model exactly are you studying ?
The SIR model is important 
Just wonder if you make parameter values smaller how the model reacts to that ?

Compartmental models in epidemiology - Wikipedia

@nm 
Strange this...

@nm 
Its a lot of work to chance the operating system, yes and keep things
Maybe the videocard ?
I am using a 142 hz and a 60 hz  screen at the same time 

Go to Windows 11 ..i use it for some years very good..idea?
60 Hz ..old , probably  i do have the same lg screen, but using also a 142 Hz gaming monitor 

From the looks of it, this is amateurish though, because you could create a test server that you could use to create websites.

@Carl Love 
The questioner was talking about ...
I am solving many systems of polynomial equations. 
I had the idea that this Solve Steps could also do that in some output format , but maybe SolveSteps can't do anything with polynomial systems ?
SolveSteps is for systems of inequalities


 

restart;
 

Euler product formula can be written in Maple this way:

eq := Zeta(2) = Product(1/(1 - 1/ithprime(i)^2), i = 1 .. infinity);

evalf(eval(eq, infinity = 10000));

(1/6)*Pi^2 = Product(1/(1-1/ithprime(i)^2), i = 1 .. infinity)

 

1.644934068 = 1.644932811

(1)

but note that Maple cannot use ithprime symbolically.

f:=Product(1-x^2/(k^2*Pi^2), k=1..infinity); # sin(x)/x

Product(1-x^2/(k^2*Pi^2), k = 1 .. infinity)

(2)

eval(diff(f,x,x)/2, x=0);

(1/2)*(Sum(-2*(Product(1, i1 = 1 .. k-1))*(Product(1, i1 = k+1 .. infinity))/(k^2*Pi^2), k = 1 .. infinity))

(3)

C2:=simplify(%); # coeff of x^2 in f

-(Sum(1/k^2, k = 1 .. infinity))/Pi^2

(4)

S2:=coeff(series(sin(x)/x, x), x^2);

-1/6

(5)

isolate(C2=S2, indets(C2, function)[]);

Sum(1/k^2, k = 1 .. infinity) = (1/6)*Pi^2

(6)

 


 

Download 10-3-2025mprimes-linkerlimiet_-aanvulling_-baselprobleem.mw

Give ai the right results ?

@Aixleft math 
 

The proof idea is that set A remains undisturbed and set B is brought into the form of set A

 

A := {(1/6)*Pi+2*k*Pi, Pi-(1/6)*Pi+2*k*Pi}; B := {k*Pi+(1/6)*(-1)^k*Pi}

{(1/6)*Pi+2*k*Pi, (5/6)*Pi+2*k*Pi}

 

{k*Pi+(1/6)*(-1)^k*Pi}

(1)

B_even := eval(B, k = 2*n); B_even_simplified := `assuming`([simplify(B_even)], [n::integer]); B_even_simplified := subs(n = k, B_even_simplified)

{2*n*Pi+(1/6)*(-1)^(2*n)*Pi}

 

{2*n*Pi+(1/6)*Pi}

 

{(1/6)*Pi+2*k*Pi}

(2)

B_odd := eval(B, k = 2*n+1); B_odd_simplified := `assuming`([simplify(B_odd)], [n::integer]); B_odd_simplified := subs(n = k, B_odd_simplified)

{(2*n+1)*Pi+(1/6)*(-1)^(2*n+1)*Pi}

 

{2*n*Pi+(5/6)*Pi}

 

{(5/6)*Pi+2*k*Pi}

(3)

B_combined := `union`(B_even_simplified, B_odd_simplified)

{(1/6)*Pi+2*k*Pi, (5/6)*Pi+2*k*Pi}

(4)

is(A = B_combined)

true

(5)

 


 

Download 9-3-2025-How_to_verify_set_A_and_set_B_is_equivalent_mprimes_def.mw


 

deepseek

 

restart;
with(plots):
with(PDEtools):

# Parameters
assume(a::real, b::real, alpha::real, beta::real, delta::real, mu::real);
assume(k[1]::real, k[2]::real, r[1]::real, r[2]::real, l[1]::real, l[2]::real);
assume(x::real, y::real, z::real, t::real);

a := 1:   b := 0.5:
alpha := 1:  beta := 0.8: delta := 0.6: mu := 1:
k[1] := 1:  k[2] := 2:
r[1] := 0.3:  r[2] := 0.7:

# Correct l[1] and l[2] to ensure real solutions
l[1] := -3:
l[2] := -7:

# Soliton solution components
thetai := k[i]*(t*w[i] + y*l[i] + z*r[i] + x);

# Compute w[i]
eqw := w[i] = (-1 + sqrt(-4*beta*mu*l[i] -4*delta*mu*r[i] -4*mu*k[i]^2 -4*alpha*mu +1))/(2*mu);
w[1] := eval(rhs(eqw), i=1);
w[2] := eval(rhs(eqw), i=2);

# Interaction term Bij
Bij := (i, j) -> simplify(-24*mu/(sqrt(1+(-4*beta*l[j]-4*delta*r[j]-4*alpha)*mu)*sqrt(1+(-4*beta*l[i]-4*delta*r[i]-4*alpha)*mu) -1 + ((2*r[i]+2*r[j])*delta + (2*l[i]+2*l[j])*beta +4*alpha)*mu), size);

# Theta functions
theta1 := eval(thetai, i=1);
theta2 := eval(thetai, i=2);

# Define f
eqf := theta1*theta2 + Bij(1, 2);

# Compute u
f := eqf;
f_x := diff(f, x);
f_xx := diff(f_x, x);
u_expr := (2*f_xx/f - 2*(f_x)^2/f^2);

# Simplify
equ := simplify(convert(u_expr, rational), size);

# Plot 3D solution
p1 := plot3d(eval(equ, [z=0, y=0]), x=-10..10, t=-10..10,
       axes=boxed, grid=[60,60], shading=zhue,
       
       labels=["x", "t", "u(x,t)"], title="Soliton Solution in 3D");

# 2D plot at t=0
p2 := plot(eval(equ, [z=0, y=0, t=0]), x=-10..10,
       color=blue, labels=["x", "u(x,0)"],
       title="Soliton Profile at t=0");

# Contour plot
p3 := contourplot(eval(equ, [z=0, y=0]), x=-10..10, t=-10..10,
       grid=[60,60], coloring=[blue, red],
       labels=["x", "t"],
       title="Contour Plot of Soliton");
 

k[i]*(t*w[i]+y*l[i]+z*r[i]+x)

 

w[i] = -1/2+(1/2)*(-4*k[i]^2-3.2*l[i]-2.4*r[i]-3)^(1/2)

 

.1855654600

 

.1557438525

 

proc (i, j) options operator, arrow; simplify(-24*mu/(sqrt(1+(-4*beta*l[j]-4*delta*r[j]-4*alpha)*mu)*sqrt(1+(-4*beta*l[i]-4*delta*r[i]-4*alpha)*mu)-1+((2*r[i]+2*r[j])*delta+(2*l[i]+2*l[j])*beta+4*alpha)*mu), size) end proc

 

.1855654600*t+x-3*y+.3*z

 

.3114877050*t+2*x-14*y+1.4*z

 

(.1855654600*t+x-3*y+.3*z)*(.3114877050*t+2*x-14*y+1.4*z)+15.07089576

 

(.1855654600*t+x-3*y+.3*z)*(.3114877050*t+2*x-14*y+1.4*z)+15.07089576

 

.6826186250*t+4*x-20*y+2.0*z

 

4

 

8/((.1855654600*t+x-3*y+.3*z)*(.3114877050*t+2*x-14*y+1.4*z)+15.07089576)-2*(.6826186250*t+4*x-20*y+2.0*z)^2/((.1855654600*t+x-3*y+.3*z)*(.3114877050*t+2*x-14*y+1.4*z)+15.07089576)^2

 

2569824663054400/(134915794810356*z^2+(-2698315896207120*y+642456165763600*x+113469951221245*t)*z+642456165763600*x^2+(-6424561657636000*y+219276272237550*t)*x+18567419823575*t^2-1134699512212450*t*y+13491579481035600*y^2+4841194952386360)-2*((13451/19705)*t+4*x-20*y+2*z)^2/(((13573/73144)*t+x-3*y+(3/10)*z)*((17443/55999)*t+2*x-14*y+(7/5)*z)+236387/15685)^2

 

 

 

 

 


 

Download 9-3_-2025_complex_functie_3d_plot_mprimes_.mw

@SSMB 

It also has nothing to do with your assignments in my opinion
By the looks of it, Maple does not succeed in calculating symbolic equilibrium points of the complex function, that leaves numerical ?.

First 8 9 10 11 12 13 14 Last Page 10 of 73