examples/4_cells_model/g1.c
double g(
		// Function parameters:

		// General cell parameters.
		double A_m, 				// Cell surface area to cell volume. Units of per millimeter.
		double C_m,					// Specific membrane capacitance. Units of microfarad per millimeter squared.

		// Parameters related to the central cell.
		double v_k_pre,				// Voltage of the central cell "k" at the previous time of "t - delta(t)". Units of millivolt.

		// Parameters related to the neighbouring cells.
		double d_ik[],				// Distance between the neighbouring cells "i" and the central cell "k". Units of millimeter.
		double gamma_ik[],			// Surface/cross-sectional area between neighbouring cells "i" and the central cell "k". Units of millimeter squared
		double sigma_ik[],			// Electrical conductivity (not isotropic or homogeneous) between neighbouring cells "i" and the central cell "k". Units of per millisiemens per millimeter squared.
		double v_i_pre[],			// Voltage of neighbouring cells "i" at the previous time of "t - delta(t)". Units of millivolt.
		int neighbourCount			// Number of neighbouring cells.
) {
	// Sum up the potential differences between the neighbouring cells "i" and the central cell "k".
	// The sum is proportional to the surface/cross-sectional area between the central cell and each of its neighbours.
	v_aggregate = 0;
	int i;
	for (i = 0; i < neighbourCount; ++i) {
		v_aggregate += (gamma_ik[i]*sigma_ik[i] * (v_i_pre[i] - v_k_pre)) / (A_m*C_m * d_ik[i]);
	}

	// Return the aggregate voltage.
	return v_aggregate;
}
// The magical g-function based on Mark Trew's derivation.
// For a given cell (called the "central" cell), this function 
// returns the aggregate voltage of its neighbouring cells.
The magical g-function based on Mark Trew's derivation.
For a given cell (called the "central" cell), this function
returns the aggregate voltage of its neighbouring cells.
The magical g - function based on Mark Trew ' s derivation . For a given cell ( called the " central " cell ) this function returns the aggregate voltage of its neighbouring cells .
double g(
		double A_m, 				
		double C_m,					
		double v_k_pre,				
		double d_ik[],				
		double gamma_ik[],			
		double sigma_ik[],			
		double v_i_pre[],			
		int neighbourCount			
) {
	v_aggregate = 0;
	int i;
	for (i = 0; i < neighbourCount; ++i) {
		v_aggregate += (gamma_ik[i]*sigma_ik[i] * (v_i_pre[i] - v_k_pre)) / (A_m*C_m * d_ik[i]);
	}
	return v_aggregate;
}
double g ( double A_m , double C_m , double v_k_pre , double d_ik [ ] , double gamma_ik [ ] , double sigma_ik [ ] , double v_i_pre [ ] , int neighbourCount ) { v_aggregate = 0 ; int i ; for ( i = 0 ; i < neighbourCount ; ++ i ) { v_aggregate += ( gamma_ik [ i ] * sigma_ik [ i ] * ( v_i_pre [ i ] - v_k_pre ) ) / ( A_m * C_m * d_ik [ i ] ) ; } return v_aggregate ; }
The magical g-function based on Mark Trew's derivation.
The magical g - function based on Mark Trew ' s derivation .
// Function parameters: // General cell parameters. // Cell surface area to cell volume. Units of per millimeter. // Specific membrane capacitance. Units of microfarad per millimeter squared. // Parameters related to the central cell. // Voltage of the central cell "k" at the previous time of "t - delta(t)". Units of millivolt. // Parameters related to the neighbouring cells. // Distance between the neighbouring cells "i" and the central cell "k". Units of millimeter. // Surface/cross-sectional area between neighbouring cells "i" and the central cell "k". Units of millimeter squared // Electrical conductivity (not isotropic or homogeneous) between neighbouring cells "i" and the central cell "k". Units of per millisiemens per millimeter squared. // Voltage of neighbouring cells "i" at the previous time of "t - delta(t)". Units of millivolt. // Number of neighbouring cells. // Sum up the potential differences between the neighbouring cells "i" and the central cell "k". // The sum is proportional to the surface/cross-sectional area between the central cell and each of its neighbours. // Return the aggregate voltage.