How do I complete this program in Python 3.0? See decription below. Note: The eq
ID: 3579140 • Letter: H
Question
How do I complete this program in Python 3.0? See decription below.
Note: The equations I need to complete are in the paper titled "A quantitative Description of Membrane Current and It's Application to Condution And Excitation in Nerve" by Hodgkin and Huxley. For the vmp_eq_26 function, that uses equation #26 in the paper. The np_eq_7 function uses Equation #7 from the paper. The mp_eq_15 function uses Equation # 15 from the paper, and the hp_eq_16 function uses Equation #16 from the paper.
I need to complete the program below I have written a program to solve an nth order Runge Kutta (as in it can solve any ordinary differential equation). I need to solve the Hodgkin Huxley model using the template l provided below and by only modifying the 4 spots that say "ADD CODE HERE Each function has 2 parameters, step, and Vnmh. Step is the current value of n. And Vnma S a list of four elements and they go in order, so Vamb.10] is the membrane potential (or Vm), Vnmhl1] n, Vnmb12] Vnmh[3] /usr/local bin/python3.4 first Last midterm.py Approximate the solution of the Hodgkin-Huxley equation Use a 4th order Runge-Kutta numerical method to solve the ODE Use only standard Python, no NumPy import matplotlib ot as plt used for plotting results tt used only for constants, exponents, and such import numpy, as np import firstLast nth order ODE, as so import irange and rk() methods from pt. 3 Note: HH defines V Vo-Vi, whereas we typically define Vm Vi-Vo so using these constants and Eq. 26, 7, 15, and 16 will require flipping Vm at the end to get it to plot with the polarity we're accustomed to seeing: rising phase during transient inward sodium current and falling phase during delayed outward potassium current Constants Define gna bar, gk bar, glumbar, Vk, Vna, VI, and Cm All from Table 3 on page 520 of the Hodgkin, Huxley, 1952 paper mS cmn2 k bar 36 na bar 120 mS/ cm 2 mS/ cm 2 bar 0,3 Vk 12 mV Vna av 15 mV -10.613 mV chosen to make total ionic current zero at resting potential: dV/dt, 0 microFahrads cm A2 CmExplanation / Answer
#include<stdio.h>
#include <math.h>
#include<conio.h>
//dy/dx = 1 + y^2#define F(x,y) 1 + (y)*(y)
void main()
{
double y0,x0,y1,n,h,f,k1,k2,k3,k4;
clrscr();
printf(" Enter the value of x0: ");
scanf("%lf",&x0);
printf(" Enter the value of y0: ");
scanf("%lf",&y0);
printf(" Enter the value of h: ");
scanf("%lf",&h);
printf(" Enter the value of last point: ");
scanf("%lf",&n);
for(; x0<n; x0=x0+h)
{
f=F(x0,y0);
k1 = h * f;
f = F(x0+h/2,y0+k1/2);
k2 = h * f;
f = F(x0+h/2,y0+k2/2);
k3 = h * f;
f = F(x0+h/2,y0+k2/2);
k4 = h * f;
y1 = y0 + ( k1 + 2*k2 + 2*k3 + k4)/6;
printf(" k1 = %.4lf ",k1);
printf(" k2 = %.4lf ",k2);
printf(" k3 = %.4lf ",k3);
printf(" k4 = %.4lf ",k4);
printf(" y(%.4lf) = %.3lf ",x0+h,y1);
y0=y1;
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.