doc:user:tutorials:tuto0
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:user:tutorials:tuto0 [2020/09/08 12:14] – boman | doc:user:tutorials:tuto0 [2020/09/08 16:26] (current) – [Conclusions] boman | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Python in a nutshell ====== | ====== Python in a nutshell ====== | ||
| - | |||
| - | |||
| - | ===== Introduction ===== | ||
| This section shows how to use [[doc: | This section shows how to use [[doc: | ||
| Line 9: | Line 6: | ||
| - | ===== The interpreter | + | ===== Introduction |
| - | + | ||
| - | ==== Introduction | + | |
| When Metafor is started, a window appears: | When Metafor is started, a window appears: | ||
| Line 55: | Line 50: | ||
| ' | ' | ||
| - | ==== Types ==== | + | ===== Types ===== |
| The type of a variable is obtained with the command '' | The type of a variable is obtained with the command '' | ||
| Line 73: | Line 68: | ||
| - | ==== Functions ==== | + | ===== Functions |
| Simple functions can be created using the interpreter. This is quite useful to avoid any cut and paste, or simply to write algorithms as scripts. For example: | Simple functions can be created using the interpreter. This is quite useful to avoid any cut and paste, or simply to write algorithms as scripts. For example: | ||
| Line 102: | Line 97: | ||
| myfun = lambda x, a=1, b=1, c=0 : a*x*x+b*x+c | myfun = lambda x, a=1, b=1, c=0 : a*x*x+b*x+c | ||
| - | ==== Modules ==== | + | ===== Modules |
| It is quite useful to gather several functions into a file, to form a [[doc: | It is quite useful to gather several functions into a file, to form a [[doc: | ||
| Line 110: | Line 105: | ||
| >> import math | >> import math | ||
| >>> | >>> | ||
| - | [' | + | [' |
| + | | ||
| + | | ||
| + | ... | ||
| + | | ||
| >>> | >>> | ||
| 0.99500416527802582 | 0.99500416527802582 | ||
| Line 138: | Line 137: | ||
| To use mathematical functions, the module '' | To use mathematical functions, the module '' | ||
| - | ==== Objects ==== | + | ===== Objects |
| Python is [[doc: | Python is [[doc: | ||
| Line 186: | Line 185: | ||
| - | ==== Loop - tuples - lists ==== | + | ===== Loop - tuples - lists ===== |
| In a Metafor [[doc: | In a Metafor [[doc: | ||
| Line 211: | Line 210: | ||
| - | ==== Conditional | + | ===== Conditional |
| It may be useful to parametrize an input file in a complex way using conditional statements. For example, a boolean '' | It may be useful to parametrize an input file in a complex way using conditional statements. For example, a boolean '' | ||
| Line 225: | Line 224: | ||
| - | ==== Important notes ==== | + | ===== Important notes ===== |
| Line 250: | Line 249: | ||
| => [[doc: | => [[doc: | ||
| + | |||
| + | |||
doc/user/tutorials/tuto0.1599560064.txt.gz · Last modified: by boman
