Python Forum
How can I program this algorithm with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I program this algorithm with Python
#3
I don't think the problem is too hard. As far as I understand, t_f (t and lower index f, italic) in your formula stands for t_i when i = n-1; Even down-counting relations, which include lambda with indices (eq #5-#8), are consequently solvable. However, you need to have a lot of punctuality to implement this recurrent relation; intuitive variable naming is very important here.

I just wrote some sketch here, you need to continue:


defaults = {'s': 10,
            'd': 0.02,
            'beta': 2.4e-5,
           # define other values here
            
            'h': 0.01 # h is time-step? you need to define it here. are we planning to use variable-step method? 
           }

initial_conditions = {'x0': 0,
                     # other conditions
                     }

def equation(x, y, vi, vni,
             **defaults)
    i = 0
    X, Y = [], []
    xi = initial_conditions['x0']
    yi = initial_conditions['y0']
    while i < n:
        xi_1 =  (xi + h*(s+r*yi))/(1 + h* ...) # complete the formula
        # write other formulae here
        
        
        # reassign values
        xi = xi_1
        yi = yi_1
        
        # save values
        X.append(xi_1)
        Y.append(yi_1)
        i += 1
This is likely some immunology model, may be modeling HIV infection dynamics.
Reply


Messages In This Thread
RE: How can I program this algorithm with Python - by scidam - Jul-08-2019, 11:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Genetic Algorithm Tetris Python not improving Fanto88 0 1,714 Mar-06-2021, 09:16 PM
Last Post: Fanto88

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020