WarpPI/core/src/main/java/it/cavallium/warppi/math/MathematicalSymbols.java

64 lines
3.6 KiB
Java
Raw Normal View History

package it.cavallium.warppi.math;
2016-07-12 22:26:54 +02:00
import it.cavallium.warppi.util.Utils;
public class MathematicalSymbols {
public static final char SUM = '+';
public static final char SUM_SUBTRACTION = '±';
public static final char SUBTRACTION = '';
public static final char MINUS = '-';
public static final char MULTIPLICATION = '*';
public static final char DIVISION = '/';
public static final char NTH_ROOT = '√';
public static final char SQUARE_ROOT = 'Ⓐ';
public static final char PARENTHESIS_OPEN = '(';
public static final char PARENTHESIS_CLOSE = ')';
public static final char POWER = 'Ⓑ';
public static final char EQUATION = '=';
public static final char SYSTEM = '{';
public static final char SINE = 'Ⓒ';
public static final char COSINE = 'Ⓓ';
public static final char TANGENT = 'Ⓔ';
public static final char ARC_SINE = 'Ⓕ';
public static final char ARC_COSINE = 'Ⓖ';
public static final char ARC_TANGENT = 'Ⓗ';
2018-05-05 23:06:36 +02:00
public static final char POWER_OF_TWO = 'Ⓘ';
public static final char LOGARITHM = 'Ⓙ';
2018-02-07 22:06:40 +01:00
public static final char UNDEFINED = '∅';
public static final char PI = 'π';
2018-05-06 16:37:25 +02:00
public static final char EULER_NUMBER = '';
2018-03-21 16:45:20 +01:00
public static final char X = 'ⓧ';
public static final char Y = 'Ⓨ';
2018-09-22 11:17:30 +02:00
public static final char[] functionsNSN = new char[] { MathematicalSymbols.NTH_ROOT, MathematicalSymbols.POWER };
2018-09-22 11:17:30 +02:00
public static final char[] functionsSN = new char[] { MathematicalSymbols.SQUARE_ROOT, MathematicalSymbols.POWER_OF_TWO, MathematicalSymbols.MINUS, MathematicalSymbols.SINE, MathematicalSymbols.COSINE, MathematicalSymbols.TANGENT, MathematicalSymbols.ARC_SINE, MathematicalSymbols.ARC_COSINE, MathematicalSymbols.ARC_TANGENT, MathematicalSymbols.LOGARITHM };
2018-09-22 11:17:30 +02:00
public static final char[] functions = Utils.concat(MathematicalSymbols.functionsNSN, MathematicalSymbols.functionsSN);
2018-09-22 11:17:30 +02:00
private static final char[] signumsWithoutMultiplication = new char[] { MathematicalSymbols.SUM, MathematicalSymbols.SUM_SUBTRACTION, MathematicalSymbols.SUBTRACTION, MathematicalSymbols.DIVISION };
private static final char[] signumsWithMultiplication = Utils.add(MathematicalSymbols.signumsWithoutMultiplication, MathematicalSymbols.MULTIPLICATION);
2018-09-22 11:17:30 +02:00
public static final char[] functionsNSNAndSignums = Utils.concat(MathematicalSymbols.functionsNSN, MathematicalSymbols.signumsWithMultiplication);
public static final char[] functionsAndSignums = Utils.concat(MathematicalSymbols.functions, MathematicalSymbols.signumsWithMultiplication);
2017-07-24 23:11:29 +02:00
2018-09-22 11:17:30 +02:00
public static final char[] signums(final boolean withMultiplication) {
2018-09-28 11:39:28 +02:00
if (withMultiplication) {
2018-09-22 11:17:30 +02:00
return MathematicalSymbols.signumsWithMultiplication;
2018-09-28 11:39:28 +02:00
}
2018-09-22 11:17:30 +02:00
return MathematicalSymbols.signumsWithoutMultiplication;
2016-07-12 22:26:54 +02:00
}
2016-09-02 20:32:37 +02:00
2018-09-22 11:17:30 +02:00
public static final char[] parentheses = new char[] { MathematicalSymbols.PARENTHESIS_OPEN, MathematicalSymbols.PARENTHESIS_CLOSE };
2016-09-02 20:32:37 +02:00
2018-09-22 11:17:30 +02:00
public static final char[] variables = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', MathematicalSymbols.X, MathematicalSymbols.Y, 'Z', MathematicalSymbols.PI, MathematicalSymbols.EULER_NUMBER, MathematicalSymbols.UNDEFINED };
2016-09-02 20:32:37 +02:00
2018-09-22 11:17:30 +02:00
public static final char[] genericSyntax = new char[] { MathematicalSymbols.SYSTEM, MathematicalSymbols.EQUATION };
2016-12-03 16:37:22 +01:00
2018-09-22 11:17:30 +02:00
public static String getGraphicRepresentation(final String string) {
return string.replace("", "^").replace("", "SIN").replace("", "COS").replace("", "TAN").replace("", "ASIN").replace("", "ACOS").replace("", "ATAN");
2016-12-03 16:37:22 +01:00
}
public static final char[] numbers = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
2016-07-12 22:26:54 +02:00
}