function using dictionary as argument
<p>I have created a dictionary with values for Velocity, temperature and altitude:</p>

<pre><code>mach_dict = dict(velocity=[], altitude=[], temperature=[])
</code></pre>

<p>Which I use to store values for a flying plain at climb, cruise and descent segments.</p>

<pre><code>mach_dict = {'velocity': [0, 300, 495, 500, 300], 'altitude': [288.15, 288.15, 288.15, 288.15, 288.15], 'temperature': [0, 0, 50, 50, 50]}
</code></pre>

<p>I need to create a function (def) that returns a dictionary that stores the mach number for every segment. </p>

<p>To estimate <code>Mach</code> I use the formula:</p>

<pre><code>Mach = velocity / sqrt(1.4 * 286 * (Temperature - altitude * 0.05))
</code></pre>

<p>Can anybody help on that? </p>

<p>And you can use pandas and numpy to do that as well</p>

<pre><code>import pandas as pd
import numpy as np



def compute(mach_dict):
   df = pd.DataFrame.from_dict(mach_dict)
   r = df.velocity / np.sqrt(1.4 * 286 * (df.temperature - df.altitude * 0.05))
   return list(r)

mach_dict={'velocity':[0, 300, 495, 500, 300],'altitude':[288.15, 288.15, 288.15, 288.15, 288.15],'temperature':[0, 0, 50, 50, 50]}
print(compute(mach_dict))
</code></pre>

<p>This will handle the -ve case that it would give you NaN</p>

python function dictionary arguments