doc:user:general:fonctions
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
doc:user:general:fonctions [2013/07/12 18:56] – created joris | doc:user:general:fonctions [2016/06/10 12:30] – [Examples] papeleux | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | |
+ | ====== | ||
- | Des fonctions sont utiles pour décrire la manière dont varient certains paramètres. Elles interviennent par exemple dans la définition des [[doc: | + | Functions are quite useful to describe how some parameters evolve, over time for example. They can be used to [[doc: |
===== PieceWiseLinearFunction ===== | ===== PieceWiseLinearFunction ===== | ||
+ | A piecewise linear function is defined one point at a time: | ||
- | On définit une fonction linéaire par morceaux - PieceWiseLinearFunction - point par point de la manière suivante: | ||
fct = PieceWiseLinearFunction() | fct = PieceWiseLinearFunction() | ||
Line 13: | Line 14: | ||
... | ... | ||
- | où | + | where |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | __Remarque #1:__ Les fonctions d' | + | {{ doc:user: |
- | {{ doc: | + | __Remark:__ As can be seen above, the first and last segments |
- | + | ||
- | __Remarque #2:__ Comme le montre le schéma ci-dessus, les segments | + | |
===== PythonOneParameterFunction ===== | ===== PythonOneParameterFunction ===== | ||
- | Lorsqu' | + | If a function is mathematically too complex to be defined with a '' |
+ | |||
+ | def f(x): | ||
+ | [function calculating y=f(x)] | ||
+ | return y | ||
+ | fct1 = PythonOneParameterFunction(f) | ||
- | Le but est de pouvoir faire passer une fonction python | + | For example, this is used to: |
+ | * Set the node density for a 1D mesher | ||
+ | * define elaborated prescribed displacements ([[doc: | ||
+ | * Define a hardening function with Python ([[doc: | ||
- | Ceci permet de, par exemple, de: | + | ===== Examples ===== |
- | * Configurer le mailleur ([[doc: | + | |
- | * Piloter la plupart des objets metafor de manière plus évoluée ([[doc: | + | |
- | * Définir une fonction d' | + | |
- | __Exemple: | + | The ramp function: |
fct1 = PieceWiseLinearFunction() | fct1 = PieceWiseLinearFunction() | ||
- | fct1.setdata(0,0) | + | fct1.setData(0,0) |
- | fct1.setdata(1,1) | + | fct1.setData(1,1) |
- | devient, en version interprétée | + | can be also defined with a classical |
- | def f(a): | + | def f(x): |
- | return | + | return |
fct1 = PythonOneParameterFunction(f) | fct1 = PythonOneParameterFunction(f) | ||
- | ou, en utilisant les fonctions | + | or, using python |
f = lambda x: x | f = lambda x: x | ||
fct1 = PythonOneParameterFunction(f) | fct1 = PythonOneParameterFunction(f) | ||
- | On peut aussi afficher une valeur à chaque évaluation ou modifier créer une fonction spéciale (en utilisant tout l' | + | ===== Advanced use ===== |
+ | {{: | ||
+ | The value can also be displayed for each estimation, and a more complex function can also be defined using all Python tools. For example, a load function can be first defined with a parabola, then with a straight line, the change between these two being controlled by an conditional structure. | ||
def f(a): | def f(a): |
doc/user/general/fonctions.txt · Last modified: 2021/01/28 18:28 by papeleux