-
Notifications
You must be signed in to change notification settings - Fork 3
Calculer des images d'une fonction
Antoine Tran edited this page Mar 5, 2019
·
5 revisions
Pour calculer l'image d'une fonction (exprimée comme un MaskExpression
), il faut passer par l'opérateur.
La méthode imageFor()
prend en paramètre (en plus des paramèters habituels) :
- Un tableau de String, correspondant aux valeurs à remplacer dans l'ordre
Pour remplacer le z
par 3
dans une expression comportant x, y, z
comme variables, le tableau de String devrait être :
["x", "y", "3"]
.
Exemple d'application :
package test;
import net.akami.mask.math.*;
public class MainTester {
public static void main(String... args) {
MaskExpression exp = new MaskExpression("x^2 + 3x - 6");
MaskOperator op = MaskOperator.begin();
int result = op.imageFor(exp, MaskExpression.TEMP, true, "3").asInt();
System.out.println(result);
}
}
Output : 12