Document information
- University
- Politecnico di Milano
- Degree programme
- Biomedical Engineering
- Subject
- Molecular Modeling of Materials
- Classification
- Other study material
- Original format
- Text
- Searchable text
University study material for Molecular Modeling of Materials in the Biomedical Engineering degree programme at Politecnico di Milano. The document covers: PYTHON INTRODUCTION (SEE ALSO JUPITER) In Python 3, the division of 2 integer with an integer result in obtained with the // symbol. After you explicitly import the math module. In addition, the cmath module should be imported to operate on complex numbers. The cm notation is a
University study material for Molecular Modeling of Materials in the Biomedical Engineering degree programme at Politecnico di Milano. The document covers: PYTHON INTRODUCTION (SEE ALSO JUPITER) In Python 3, the division of 2 integer with an integer result in obtained with the // symbol. After you explicitly import the math module. In addition, the cmath module should be imported to operate on complex numbers. The cm notation is a
Import quality: text was extracted directly from the original document.
Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.
PYTHON INTRODUCTION (SEE ALSO JUPITER) In Python 3, the division of 2 integer with an integer result in obtained with the // symbol. After you explicitly import the math module. In addition, the cmath module should be imported to operate on complex numbers. The cm notation is a namespace, and it says to uses the square root function specifically imported from cmath . It is important because the generic sqrt function comes from the math library and it does not support complex numbers. Therefore, you need to use the cm.sqrt : specific for complex numbers. In general, in Python i twill be necessary to import several modules. In order to avoid problems, this AS notation must be used, necessary to understand where the function comes from. NumPy package is bigger the math. VARIABLES In Python you don’t need to specify the type of variable you are declaring. The function TYPE return the type of the variable. Python provides some functions to convert values. For example, you can declare b = ‘5’ as a string, but if you type int(b), it is converted in the numerical number five. The same using float and str for string. (it doesn’t work however). LISTS Is one type of data structures, often used, and can contain different type of items. It is an array of heterogeneous things, basically. (you can also have a list within a list) Very long lists could be CPU consuming. The indexing is done using square brackets. List[0] refers to the first element and -1 refers to the last one. Lists can also be sliced, for example if we define a listC = [‘A’, ‘B’, ‘C’, [1,2,3] ]. I can print only B, by specifying [1:2]. Note that those indexes are lying between the components of the list. So it is if like A has a pedix 1 on its right and same for B. Print(listC[1:2]) Print(listC[-1][1]) will print…
First page of the document.