Oct-01-2018, 09:58 PM

Greetings!

I was wondering why it is possible to create a new list by multiplying or adding constants to an old list, but not to create a new list through division of a float by an old list.

Isn't this a bit contradictory from a programming point of view?

Regards!

I was wondering why it is possible to create a new list by multiplying or adding constants to an old list, but not to create a new list through division of a float by an old list.

import numpy as np import matplotlib.pyplot as plt N=500; R=0.5; pressure_list=[16,25,40] expectation_val_V=[445.186, 412.284, 390.5] expectation_eta=(float(4)/3 *np.pi *R**3)/expectation_val_V eta=np.linspace(0.5,0.70,100000) p_red=6/(np.pi)*eta*( (12-3*(4*(1-(3*np.sqrt(2))/(np.pi)*eta)))/(4*(1-(3*np.sqrt(2))/(np.pi)*eta)) +2.557696+0.1253077*(4*(1-(3*np.sqrt(2))/(np.pi)*eta)) +0.1762393*(4*(1-(3*np.sqrt(2))/(np.pi)*eta))**2 -1.053308*(4*(1-(3*np.sqrt(2))/(np.pi)*eta))**3 +2.818621*(4*(1-(3*np.sqrt(2))/(np.pi)*eta))**4 -2.921934*(4*(1-(3*np.sqrt(2))/(np.pi)*eta))**5 +1.118413*(4*(1-(3*np.sqrt(2))/(np.pi)*eta))**6) plt.plot(eta,p_red) plt.show()In this example, p_red is well defined. However, expectation_eta cannot be created. It gives the error 'TypeError: unsupported operand type(s) for /: 'float' and 'list''

Isn't this a bit contradictory from a programming point of view?

Regards!