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:13] – 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 10: | Line 6: | ||
- | ===== The interpreter | + | ===== Introduction |
- | + | ||
- | ==== Introduction | + | |
When Metafor is started, a window appears: | When Metafor is started, a window appears: | ||
Line 56: | 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 74: | 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 103: | 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 111: | Line 105: | ||
>> import math | >> import math | ||
>>> | >>> | ||
- | [' | + | [' |
+ | | ||
+ | | ||
+ | ... | ||
+ | | ||
>>> | >>> | ||
0.99500416527802582 | 0.99500416527802582 | ||
Line 139: | Line 137: | ||
To use mathematical functions, the module '' | To use mathematical functions, the module '' | ||
- | ==== Objects ==== | + | ===== Objects |
Python is [[doc: | Python is [[doc: | ||
Line 187: | Line 185: | ||
- | ==== Loop - tuples - lists ==== | + | ===== Loop - tuples - lists ===== |
In a Metafor [[doc: | In a Metafor [[doc: | ||
Line 212: | 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 226: | Line 224: | ||
- | ==== Important notes ==== | + | ===== Important notes ===== |
Line 251: | Line 249: | ||
=> [[doc: | => [[doc: | ||
+ | |||
+ |
doc/user/tutorials/tuto0.1599559983.txt.gz · Last modified: 2020/09/08 12:13 by boman