import math


def visen(p2, d1, p1, g):

	"""
	Calculates the velocity along the isentrope
	Input:
	p2 - New pressure
	d1 - Old density
	p1 - Old pressure
	g - Adiabatic index
	"""
	
	
	return (2*math.sqrt(g)*p1**(1/(2.*g))*(-p1**((-1 + g)/(2.*g)) + \
	p2**((-1 + g)/(2.*g))))/(math.sqrt(d1)*(-1 + g))