mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Merge remote-tracking branch 'upstream/master' into omega-master
This commit is contained in:
6
.github/workflows/ci-workflow.yml
vendored
6
.github/workflows/ci-workflow.yml
vendored
@@ -60,13 +60,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: numworks/setup-emscripten@v1
|
||||
with:
|
||||
sdk: latest-fastcomp
|
||||
- uses: actions/checkout@v1
|
||||
- run: source $EMSDK/emsdk_env.sh && make -j2 PLATFORM=simulator TARGET=web
|
||||
- run: make -j2 PLATFORM=simulator TARGET=web
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: epsilon-simulator-web.zip
|
||||
path: output/release/simulator/web/simulator.zip
|
||||
- run: source $EMSDK/emsdk_env.sh && make -j2 PLATFORM=simulator TARGET=web test.headless.js
|
||||
- run: make -j2 PLATFORM=simulator TARGET=web test.headless.js
|
||||
- run: node output/release/simulator/web/test.headless.js
|
||||
build-simulator-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -59,7 +59,7 @@ Expression ComplexNode<T>::complexToExpression(Preferences::ComplexFormat comple
|
||||
tb = this->imag();
|
||||
}
|
||||
return Expression::CreateComplexExpression(
|
||||
Number::DecimalNumber<T>(std::fabs(ra)),
|
||||
Number::DecimalNumber<T>(std::fabs(ra)), // TODO: Maybe use Number::FloatNumber instead to speed up 'complexToExpression'
|
||||
Number::DecimalNumber<T>(std::fabs(tb)),
|
||||
complexFormat,
|
||||
(std::isnan(this->real()) || std::isnan(this->imag())),
|
||||
|
||||
@@ -127,14 +127,11 @@ Expression ComplexCartesian::norm(ExpressionNode::ReductionContext reductionCont
|
||||
a = imag();
|
||||
}
|
||||
if (!a.isUninitialized()) {
|
||||
ExpressionNode::Sign s = a.sign(reductionContext.context());
|
||||
if (s == ExpressionNode::Sign::Positive) {
|
||||
// Case 1: the expression is positive real
|
||||
return a;
|
||||
} else if (s == ExpressionNode::Sign::Negative) {
|
||||
// Case 2: the argument is negative real
|
||||
return a.setSign(ExpressionNode::Sign::Positive, reductionContext);
|
||||
}
|
||||
// norm = sign(a) * a
|
||||
Expression signa = SignFunction::Builder(a.clone());
|
||||
Expression norm = Multiplication::Builder(a, signa);
|
||||
signa.shallowReduce(reductionContext);
|
||||
return norm;
|
||||
}
|
||||
Expression n2 = squareNorm(reductionContext);
|
||||
Expression n = SquareRoot::Builder(n2);
|
||||
|
||||
@@ -25,7 +25,7 @@ bool NAryExpressionNode::childAtIndexNeedsUserParentheses(const Expression & chi
|
||||
|
||||
void NAryExpressionNode::sortChildrenInPlace(ExpressionOrder order, Context * context, bool canSwapMatrices, bool canBeInterrupted) {
|
||||
Expression reference(this);
|
||||
for (int i = reference.numberOfChildren()-1; i > 0; i--) {
|
||||
for (int i = 1; i < reference.numberOfChildren(); i++) {
|
||||
bool isSorted = true;
|
||||
for (int j = 0; j < reference.numberOfChildren()-1; j++) {
|
||||
/* Warning: Matrix operations are not always commutative (ie,
|
||||
|
||||
@@ -198,12 +198,12 @@ Expression Trigonometry::shallowReduceDirectFunction(Expression & e, ExpressionN
|
||||
|
||||
// reduce x^2
|
||||
res.childAtIndex(0).childAtIndex(1).shallowReduce(reductionContext);
|
||||
// reduce 1+*x^2
|
||||
// reduce 1+x^2
|
||||
res.childAtIndex(0).shallowReduce(reductionContext);
|
||||
if (e.type() == ExpressionNode::Type::Sine) {
|
||||
res = Multiplication::Builder(x, res);
|
||||
// reduce (1+x^2)^(-1/2)
|
||||
res.childAtIndex(0).shallowReduce(reductionContext);
|
||||
res.childAtIndex(1).shallowReduce(reductionContext);
|
||||
}
|
||||
e.replaceWithInPlace(res);
|
||||
// reduce (1+x^2)^(-1/2) or x*(1+x^2)^(-1/2)
|
||||
|
||||
@@ -604,6 +604,9 @@ QUIZ_CASE(poincare_simplication_trigonometry_functions) {
|
||||
// tan(asin)
|
||||
assert_parsed_expression_simplify_to("tan(asin(x))", "x/√(-x^2+1)", User, Degree);
|
||||
assert_parsed_expression_simplify_to("tan(asin(-x))", "-x/√(-x^2+1)", User, Degree);
|
||||
|
||||
// Mix
|
||||
assert_parsed_expression_simplify_to("sin(atan(3/4))", "3/5", User, Degree);
|
||||
}
|
||||
|
||||
QUIZ_CASE(poincare_simplication_hyperbolic_trigonometry_functions) {
|
||||
@@ -798,6 +801,8 @@ QUIZ_CASE(poincare_simplification_complex_format) {
|
||||
assert_parsed_expression_simplify_to("(-8)^(1/4)", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("(-8)^(1/3)", "-2", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("[[1,2+√(-1)]]", "unreal", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("atan(2)", "atan(2)", User, Radian, Real);
|
||||
assert_parsed_expression_simplify_to("atan(-2)", "-atan(2)", User, Radian, Real);
|
||||
|
||||
// User defined variable
|
||||
assert_parsed_expression_simplify_to("a", "a", User, Radian, Real);
|
||||
@@ -841,6 +846,8 @@ QUIZ_CASE(poincare_simplification_complex_format) {
|
||||
assert_parsed_expression_simplify_to("π", "π", User, Radian, Cartesian);
|
||||
assert_parsed_expression_simplify_to("𝐢", "𝐢", User, Radian, Cartesian);
|
||||
|
||||
assert_parsed_expression_simplify_to("atan(2)", "atan(2)", User, Radian, Cartesian);
|
||||
assert_parsed_expression_simplify_to("atan(-2)", "-atan(2)", User, Radian, Cartesian);
|
||||
assert_parsed_expression_simplify_to("abs(-3)", "3", User, Radian, Cartesian);
|
||||
assert_parsed_expression_simplify_to("abs(-3+𝐢)", "√(10)", User, Radian, Cartesian);
|
||||
assert_parsed_expression_simplify_to("atan(2)", "atan(2)", User, Radian, Cartesian);
|
||||
@@ -931,6 +938,8 @@ QUIZ_CASE(poincare_simplification_complex_format) {
|
||||
assert_parsed_expression_simplify_to("conj(2×ℯ^(𝐢×π/2))", "2×ℯ^\u0012-π/2×𝐢\u0013", User, Radian, Polar);
|
||||
assert_parsed_expression_simplify_to("-2×ℯ^(𝐢×π/2)", "2×ℯ^\u0012-π/2×𝐢\u0013", User, Radian, Polar);
|
||||
assert_parsed_expression_simplify_to("[[1,√(-1)]]", "[[1,ℯ^\u0012π/2×𝐢\u0013]]", User, Radian, Polar);
|
||||
assert_parsed_expression_simplify_to("atan(2)", "atan(2)", User, Radian, Polar);
|
||||
assert_parsed_expression_simplify_to("atan(-2)", "atan(2)×ℯ^\u0012π×𝐢\u0013", User, Radian, Polar);
|
||||
|
||||
// User defined variable
|
||||
assert_parsed_expression_simplify_to("a", "a", User, Radian, Polar);
|
||||
|
||||
Reference in New Issue
Block a user