Python Forum
Odeint to solve Mukhanov equation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Odeint to solve Mukhanov equation
#2
As far as I understood, the problem is in lines 38-41. You can resolve it, e.g. assuming that ep = H,

solutions = []
for ep, H in zip(range(len(t)), range(len(t))):    
    asol = odeint(sol, Y0, t, args=(k, ep, H), h0 = 0.005)  
    solutions.append(asol)
Another approach would be to use dictionary to store results:

solutions = dict()
ep_values = [1,2,3]
H_values =[4,3,1]
for ep in ep_values:
    for H in H_values:
        asol = odeint(sol, Y0, t, args=(k, ep, H), h0 = 0.005)  
        solutions.update({(ep, H): asol})
But this will require to restructure the rest part of your code.
Reply


Messages In This Thread
Odeint to solve Mukhanov equation - by Messier087 - Feb-12-2020, 02:12 PM
RE: Odeint to solve Mukhanov equation - by scidam - Feb-13-2020, 03:36 AM
RE: Odeint to solve Mukhanov equation - by scidam - Feb-16-2020, 11:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mukhanov equation + odeint Messier087 0 2,215 Mar-28-2020, 04:03 PM
Last Post: Messier087
  Can't find a way to solve this nonlinear equation Alex009988 2 3,591 Aug-16-2019, 01:50 AM
Last Post: scidam
  odeint to solve Schrodinger equation kiyoshi7 14 15,566 Nov-23-2018, 11:49 AM
Last Post: kiyoshi7
  python odeint keeps giving me size of array error kiyoshi7 1 7,648 Nov-01-2018, 02:03 AM
Last Post: j.crater

Forum Jump:

User Panel Messages

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