Skip to content

Commit 01d1a84

Browse files
committed
Disabe negation of numerator/denominator in output form
1 parent 66d1acd commit 01d1a84

File tree

9 files changed

+132
-107
lines changed

9 files changed

+132
-107
lines changed

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/Algebra.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ private IExpr expandAST(final IAST ast, boolean evalParts) {
11501150
} else if (ast.isTimes()) {
11511151
// (a+b)*(c+d)...
11521152

1153-
IExpr[] temp = fractionalPartsTimesPower(ast, false, false, false, evalParts);
1153+
IExpr[] temp = fractionalPartsTimesPower(ast, false, false, false, evalParts, true);
11541154
IExpr tempExpr;
11551155
if (temp == null) {
11561156
return expandTimes(ast);
@@ -4726,11 +4726,13 @@ public static IExpr[] getNumeratorDenominator(IAST ast, EvalEngine engine) {
47264726
* try to find a trigonometric numerator/denominator form (Example: Csc[x] gives 1 / Sin[x])
47274727
* @param evalParts
47284728
* evaluate the determined numerator and denominator parts
4729+
* @param negateNumerDenom
4730+
* negate numerator and denominator, if they are both negative
47294731
* @return the numerator and denominator expression and an optional fractional number (maybe <code>null</code>), if
47304732
* splitNumeratorOne is <code>true</code>.
47314733
*/
47324734
public static IExpr[] fractionalPartsTimesPower(final IAST timesPower, boolean splitNumeratorOne,
4733-
boolean splitFractionalNumbers, boolean trig, boolean evalParts) {
4735+
boolean splitFractionalNumbers, boolean trig, boolean evalParts, boolean negateNumerDenom) {
47344736
if (timesPower.isPower()) {
47354737
IExpr[] parts = Apart.fractionalPartsPower(timesPower, trig);
47364738
if (parts != null) {
@@ -4817,7 +4819,7 @@ public static IExpr[] fractionalPartsTimesPower(final IAST timesPower, boolean s
48174819
result[0] = numerator.getOneIdentity(F.C1);
48184820
result[1] = denominator.getOneIdentity(F.C1);
48194821
}
4820-
if (result[0].isNegative() && result[1].isPlus() && ((IAST) result[1]).isAST2()) {
4822+
if (negateNumerDenom && result[0].isNegative() && result[1].isPlus() && ((IAST) result[1]).isAST2()) {
48214823
// negate numerator and denominator:
48224824
result[0] = result[0].negate();
48234825
result[1] = result[1].negate();
@@ -4851,7 +4853,7 @@ public static IExpr[] fractionalParts(final IExpr arg, boolean trig) {
48514853
if (arg.isAST()) {
48524854
IAST ast = (IAST) arg;
48534855
if (arg.isTimes()) {
4854-
parts = fractionalPartsTimesPower(ast, false, true, trig, true);
4856+
parts = fractionalPartsTimesPower(ast, false, true, trig, true, true);
48554857
} else if (arg.isPower()) {
48564858
parts = Apart.fractionalPartsPower(ast, trig);
48574859
if (parts == null) {

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/SeriesFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ private static IExpr substituteInfinity(final IAST arg1, LimitData data) {
540540
IExpr y = F.Power(x, F.CN1); // substituting by 1/x
541541
IExpr temp = F.evalQuiet(F.subst(arg1, x, y));
542542
if (temp.isTimes()) {
543-
IExpr[] parts = Algebra.fractionalPartsTimesPower((IAST) temp, false, false, true, true);
543+
IExpr[] parts = Algebra.fractionalPartsTimesPower((IAST) temp, false, false, true, true, true);
544544
if (parts != null) {
545545
if (!parts[1].isOne()) { // denominator != 1
546546
LimitData ndData = new LimitData(x, F.C0, F.Rule(x, F.C0), data.getDirection());
@@ -559,7 +559,7 @@ private static IExpr timesLimit(final IAST timesAST, LimitData data) {
559559
if (!isFreeResult.get(1).isOne()) {
560560
return F.Times(isFreeResult.get(1), data.limit(isFreeResult.get(2)));
561561
}
562-
IExpr[] parts = Algebra.fractionalPartsTimesPower(timesAST, false, false, true, true);
562+
IExpr[] parts = Algebra.fractionalPartsTimesPower(timesAST, false, false, true, true, true);
563563
if (parts != null) {
564564

565565
IExpr numerator = parts[0];

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/form/mathml/MathMLFormFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ public boolean convert(final StringBuilder buf, final IAST f, final int preceden
821821
*/
822822
public boolean convertTimesFraction(final StringBuilder buf, final IAST f, final int precedence,
823823
final boolean caller) {
824-
IExpr[] parts = Algebra.fractionalPartsTimesPower(f, false, true, false, false);
824+
IExpr[] parts = Algebra.fractionalPartsTimesPower(f, false, true, false, false, false);
825825
if (parts == null) {
826826
convertTimesOperator(buf, f, precedence, caller);
827827
return true;

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/form/output/ASCIIPrettyPrinter3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private void convertTimes(IAST times, final int precedence, boolean caller) {
212212
* @param ast
213213
*/
214214
private void convertTimesPowerFraction(IAST ast, final int precedence) {
215-
IExpr[] parts = Algebra.fractionalPartsTimesPower(ast, true, false, false, false);
215+
IExpr[] parts = Algebra.fractionalPartsTimesPower(ast, true, false, false, false, false);
216216
// IExpr[] parts = Algebra.getFractionalParts(ast, false);
217217
if (parts == null) {
218218
print(ast.toString());

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/form/output/OutputFormFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ private void convertPlusOperatorReversed(final Appendable buf, final IAST plusAS
587587

588588
private void convertTimesFraction(final Appendable buf, final IAST timesAST, final InfixOperator oper,
589589
final int precedence, boolean caller) throws IOException {
590-
IExpr[] parts = Algebra.fractionalPartsTimesPower(timesAST, true, false, false, false);
590+
IExpr[] parts = Algebra.fractionalPartsTimesPower(timesAST, true, false, false, false, false);
591591
if (parts == null) {
592592
convertTimesOperator(buf, timesAST, oper, precedence, caller);
593593
return;

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/form/tex/TeXFormFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ public boolean convert(final StringBuilder buf, final IAST f, final int preceden
845845
*/
846846
public boolean convertTimesFraction(final StringBuilder buf, final IAST f, final int precedence,
847847
final int caller) {
848-
IExpr[] parts = Algebra.fractionalPartsTimesPower(f, false, true, false, false);
848+
IExpr[] parts = Algebra.fractionalPartsTimesPower(f, false, true, false, false, false);
849849
if (parts == null) {
850850
convertTimesOperator(buf, f, precedence, caller);
851851
return true;

symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/LowercaseTestCase.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,16 @@ public void testApart() {
159159

160160
check("Sin(1 / (x ^ 2 - y ^ 2)) // Apart", "Sin(1/(x^2-y^2))");
161161

162-
check("Apart(1 / (x^2 + 5*x + 6))", "1/(2+x)+1/(-3-x)");
162+
check("Apart(1 / (x^2 + 5*x + 6))", "1/(2+x)-1/(3+x)");
163163
// TODO return -1 / (2 y (x + y)) + 1 / (2 y (x - y))
164164
check("Apart(1 / (x^2 - y^2), x)", "1/(x^2-y^2)");
165165
// TODO return 1 / (2 x (x + y)) + 1 / (2 x (x - y))
166166
check("Apart(1 / (x^2 - y^2), y)", "1/(x^2-y^2)");
167167

168-
check("Apart(1/((1 + x)*(5 + x)))", "1/(4+4*x)+1/(-20-4*x)");
169-
check("Apart(1 < (x + 1)/(x - 1) < 2)", "1<1+2/(-1+x)<2");
168+
check("Apart(1/((1 + x)*(5 + x)))", //
169+
"1/(4+4*x)-1/(20+4*x)");
170+
check("Apart(1 < (x + 1)/(x - 1) < 2)", //
171+
"1<1+2/(-1+x)<2");
170172
}
171173

172174
public void testAppend() {
@@ -298,7 +300,8 @@ public void testArcCot() {
298300
check("arccot(0)", "Pi/2");
299301
check("arccot(-11)", "-ArcCot(11)");
300302
check("arccot(-x)", "-ArcCot(x)");
301-
check("D(ArcCot(x),x)", "1/(-1-x^2)");
303+
check("D(ArcCot(x),x)", //
304+
"-1/(1+x^2)");
302305
}
303306

304307
public void testArcCoth() {
@@ -1151,7 +1154,7 @@ public void testCancel() {
11511154
check("Cancel((x^2 - 1)/(x - 1))", //
11521155
"1+x");
11531156
check("Cancel((x - y)/(x^2 - y^2) + (x^3 - 27)/(x^2 - 9) + (x^3 + 1)/(x^2 - x + 1))", //
1154-
"1+x+(9+3*x+x^2)/(3+x)+1/(x+y)");
1157+
"1+x+(9+3*x+x^2)/(3+x)-1/(-x-y)");
11551158
check("cancel((x - 1)/(x^2 - 1) + (x - 2)/(x^2 - 4))", //
11561159
"1/(1+x)+1/(2+x)");
11571160
check("together((x - 1)/(x^2 - 1) + (x - 2)/(x^2 - 4))", //
@@ -3804,7 +3807,7 @@ public void testFindFit() {
38043807
public void testFindInstance() {
38053808
check("FindInstance(2*Sin(x)==1/2,x)", //
38063809
"{{x->ArcSin(1/4)}}");
3807-
3810+
38083811
check("FindInstance({x^2==4,x+y^2==6}, {x,y})", "{{x->-2,y->-2*Sqrt(2)}}");
38093812
check("FindInstance(x+5.0==a,x)", "{{x->-5.0+a}}");
38103813

@@ -3818,7 +3821,7 @@ public void testFindInstance() {
38183821

38193822
check("FindInstance(2*Sin(x)==1/2,x)", //
38203823
"{{x->ArcSin(1/4)}}");
3821-
check("FindInstance(3+2*Cos(x)==1/2,x)",//
3824+
check("FindInstance(3+2*Cos(x)==1/2,x)", //
38223825
"{{x->ArcCos(-5/4)}}");
38233826
check("FindInstance(Sin(x)==0,x)", "{{x->0}}");
38243827
check("FindInstance(Sin(x)==0.0,x)", "{{x->0}}");
@@ -3830,8 +3833,10 @@ public void testFindInstance() {
38303833

38313834
checkNumeric("FindInstance(x^2+50*x-2500.00==0,x)", "{{x->30.901699437494745}}");
38323835

3833-
check("FindInstance(a*x + y == 7 && b*x - y == 1, {x, y})", "{{x->8/(a+b),y->(a-7*b)/(-a-b)}}");
3834-
check("FindInstance({a*x + y == 7, b*x - y == 1}, {x, y})", "{{x->8/(a+b),y->(a-7*b)/(-a-b)}}");
3836+
check("FindInstance(a*x + y == 7 && b*x - y == 1, {x, y})", //
3837+
"{{x->-8/(-a-b),y->(a-7*b)/(-a-b)}}");
3838+
check("FindInstance({a*x + y == 7, b*x - y == 1}, {x, y})", //
3839+
"{{x->-8/(-a-b),y->(a-7*b)/(-a-b)}}");
38353840

38363841
}
38373842

@@ -10574,9 +10579,9 @@ public void testSolve() {
1057410579
"{{x->30.901699437494745},{x->-80.90169943749474}}");
1057510580

1057610581
check("Solve(a*x + y == 7 && b*x - y == 1, {x, y})", //
10577-
"{{x->8/(a+b),y->(a-7*b)/(-a-b)}}");
10582+
"{{x->-8/(-a-b),y->(a-7*b)/(-a-b)}}");
1057810583
check("Solve({a*x + y == 7, b*x - y == 1}, {x, y})", //
10579-
"{{x->8/(a+b),y->(a-7*b)/(-a-b)}}");
10584+
"{{x->-8/(-a-b),y->(a-7*b)/(-a-b)}}");
1058010585

1058110586
check("Solve(-Infinity==(2*a2)/a3+(-2*a5)/a3,a3)", //
1058210587
"Solve(-Infinity==(2*a2)/a3+(-2*a5)/a3,a3)");
@@ -11776,7 +11781,7 @@ public void testTogether() {
1177611781
check("Together((-7*a^(-1)*b+1)*(-a^(-1)*b-1)^(-1))", "(a-7*b)/(-a-b)");
1177711782
check("Together(a*b^(-2)+c*d^(-3))", "(b^2*c+a*d^3)/(b^2*d^3)");
1177811783
check("Together(-a*b^(-2)-c*d^(-3))", "(-b^2*c-a*d^3)/(b^2*d^3)");
11779-
check("Together((-8)*a^(-1)*(-a^(-1)*b-1)^(-1))", "8/(a+b)");
11784+
check("Together((-8)*a^(-1)*(-a^(-1)*b-1)^(-1))", "-8/(-a-b)");
1178011785

1178111786
check("Together((2*(2*x^3-4*x+5)*x^3*(3*x^2+2)^(-1)-4*x*(2*x^3-4*x+5)*(3*x^2+2)^(-1)+5*(2*x^3-4*x+\n"
1178211787
+ "5)*(3*x^2+2)^(-1)-4*x^4+8*x^2-10*x)*(3*x^2+2)^(-1)+x^2-2)",
@@ -11786,15 +11791,17 @@ public void testTogether() {
1178611791
check("Together((2*(2*x^3-4*x+5)*x^3*(3*x^2+2)^(-1)-4*x*(2*x^3-4*x+5)*(3*x^2+2)^(-1)+5*(2*x^3-4*x+\n"
1178711792
+ "5)*(3*x^2+2)^(-1)-4*x^4+8*x^2-10*x)*(x)^(-1)-2)", "(25-64*x+32*x^2-16*x^3-8*x^6)/(2*x+3*x^3)");
1178811793
check("Together(a + c/g)", "(c+a*g)/g");
11789-
check("Together(((7*b*a^(-1)-1)*(-b*a^(-1)-1)^(-1)+7)*a^(-1))", "8/(a+b)");
11794+
check("Together(((7*b*a^(-1)-1)*(-b*a^(-1)-1)^(-1)+7)*a^(-1))", //
11795+
"-8/(-a-b)");
1179011796

1179111797
check("ExpandAll((x^2-1)*x^2+x*(x^2-1))", "-x-x^2+x^3+x^4");
1179211798
check("together(x^2/(x^2 - 1) + x/(x^2 - 1))", "x/(-1+x)");
1179311799
check("Together((1/3*x-1/6)*(x^2-x+1)^(-1))", //
1179411800
"(-1+2*x)/(6*(1-x+x^2))");
1179511801
check("Together((-a^2*r^2*x-a*b*r*x-a*c*x-a^2*r^3-2*a*b*r^2-a*c*r-b^2*r-b*c)*((a*r^2+b*r)^2+2*c*(a*r^2+b*r)+c^2)^(-1))",
1179611802
"(-b-a*r-a*x)/(c+b*r+a*r^2)");
11797-
check("Together((-8)*a^(-1)*(-a^(-1)*b-1)^(-1))", "8/(a+b)");
11803+
check("Together((-8)*a^(-1)*(-a^(-1)*b-1)^(-1))", //
11804+
"-8/(-a-b)");
1179811805

1179911806
check("Together(a/b + c/d)", "(b*c+a*d)/(b*d)");
1180011807
check("Together((-a^(-1)*b-1))", "(-a-b)/a");

symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/MainTestCase.java

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ public void testSystem038() {
665665

666666
check("D(Cosh(x),x)", "Sinh(x)"); // issue#39
667667
check("D(x^4, x)", "4*x^3");
668-
check("D((-x+2)/(2*x-6), x)", "(-2*(2-x))/(6-2*x)^2+1/(6-2*x)");
668+
check("D((-x+2)/(2*x-6), x)", //
669+
"(-2*(2-x))/(6-2*x)^2-1/(-6+2*x)");
669670
check("D((2*x-6)^(-1), x)", "-2/(6-2*x)^2");
670671

671672
// (-x+2)*(2*x-6)^(-2)*2
@@ -680,15 +681,15 @@ public void testSystem038() {
680681
check("Trace(D(Sin(x),x))", "{{{D(x,x),1},1*Cos(x),Cos(x)},Cos(x)}");
681682
check("D(Sin(x)^Cos(x),x)", "(Cos(x)*Cot(x)-Log(Sin(x))*Sin(x))*Sin(x)^Cos(x)");
682683
check("Trace(D(Sin(x)^Cos(x),x))",
683-
"{{{IntegerQ(#1)&&#1<0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},Sin(x)^Cos(x)*(D(Cos(x),x)*Log(Sin(x))+(Cos(x)*D(Sin(x),x))/Sin(x)),{{IntegerQ(#1)&&#1<\n" +
684-
"0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},{{{{{D(x,x),\n" +
685-
"1},(-1)*1*Sin(x),-Sin(x)},-Sin(x)},Log(Sin(x))*-Sin(x),-Log(Sin(x))*Sin(x)},{{{{D(x,x),\n" +
686-
"1},1*Cos(x),Cos(x)},Cos(x)},{{IntegerQ(#1)&&#1<0&[-1],IntegerQ(-1)&&-1<0,{IntegerQ(\n" +
687-
"-1),True},{-1<0,True},True},{{(-1)*(-1),1},Csc(x)^1,{IntegerQ(#1)&&#1<0&[1],IntegerQ(\n" +
688-
"1)&&1<0,{IntegerQ(1),True},{1<0,False},False},Csc(x)},Csc(x)},Cos(x)*Cos(x)*Csc(x),Cot(x)^\n" +
689-
"1*Cos(x),{{IntegerQ(#1)&&#1<0&[1],IntegerQ(1)&&1<0,{IntegerQ(1),True},{1<0,False},False},Cot(x)},Cos(x)*Cot(x)},Cos(x)*Cot(x)-Log(Sin(x))*Sin(x)},(Cos(x)*Cot(x)-Log(Sin(x))*Sin(x))*Sin(x)^Cos(x),{{IntegerQ(#1)&&#1<\n" +
690-
"0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},{{-Cos(x)*Cot(x),-Cos(x)*Cot(x)},{--Log(Sin(x))*Sin(x),(\n" +
691-
"-1)*(-1)*Log(Sin(x))*Sin(x),Log(Sin(x))*Sin(x)},-Cos(x)*Cot(x)+Log(Sin(x))*Sin(x)}}");
684+
"{{{IntegerQ(#1)&&#1<0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},Sin(x)^Cos(x)*(D(Cos(x),x)*Log(Sin(x))+(Cos(x)*D(Sin(x),x))/Sin(x)),{{IntegerQ(#1)&&#1<\n"
685+
+ "0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},{{{{{D(x,x),\n"
686+
+ "1},(-1)*1*Sin(x),-Sin(x)},-Sin(x)},Log(Sin(x))*-Sin(x),-Log(Sin(x))*Sin(x)},{{{{D(x,x),\n"
687+
+ "1},1*Cos(x),Cos(x)},Cos(x)},{{IntegerQ(#1)&&#1<0&[-1],IntegerQ(-1)&&-1<0,{IntegerQ(\n"
688+
+ "-1),True},{-1<0,True},True},{{(-1)*(-1),1},Csc(x)^1,{IntegerQ(#1)&&#1<0&[1],IntegerQ(\n"
689+
+ "1)&&1<0,{IntegerQ(1),True},{1<0,False},False},Csc(x)},Csc(x)},Cos(x)*Cos(x)*Csc(x),Cot(x)^\n"
690+
+ "1*Cos(x),{{IntegerQ(#1)&&#1<0&[1],IntegerQ(1)&&1<0,{IntegerQ(1),True},{1<0,False},False},Cot(x)},Cos(x)*Cot(x)},Cos(x)*Cot(x)-Log(Sin(x))*Sin(x)},(Cos(x)*Cot(x)-Log(Sin(x))*Sin(x))*Sin(x)^Cos(x),{{IntegerQ(#1)&&#1<\n"
691+
+ "0&[Cos(x)],IntegerQ(Cos(x))&&Cos(x)<0,{IntegerQ(Cos(x)),False},False}},{{-Cos(x)*Cot(x),-Cos(x)*Cot(x)},{--Log(Sin(x))*Sin(x),(\n"
692+
+ "-1)*(-1)*Log(Sin(x))*Sin(x),Log(Sin(x))*Sin(x)},-Cos(x)*Cot(x)+Log(Sin(x))*Sin(x)}}");
692693
}
693694

694695
public void testSystem039() {
@@ -964,9 +965,9 @@ public void testSystem080() {
964965

965966
public void testSystem081() {
966967
check("Inverse(s*{{1,0,0},{0,1,0},{0,0,1}}-{{-1,1,1},{-4,-4,1},{1,1,1}})",
967-
"{{(5-3*s-s^2)/(10-s-4*s^2-s^3),s/(-10+s+4*s^2+s^3),(5+s)/(-10+s+4*s^2+s^3)},\n" +
968-
" {(5-4*s)/(-10+s+4*s^2+s^3),(2-s^2)/(10-s-4*s^2-s^3),(-3+s)/(-10+s+4*s^2+s^3)},\n" +
969-
" {-s/(10-s-4*s^2-s^3),(-2-s)/(10-s-4*s^2-s^3),(8+5*s+s^2)/(-10+s+4*s^2+s^3)}}");
968+
"{{(5-3*s-s^2)/(10-s-4*s^2-s^3),s/(-10+s+4*s^2+s^3),(5+s)/(-10+s+4*s^2+s^3)},\n"
969+
+ " {(5-4*s)/(-10+s+4*s^2+s^3),(2-s^2)/(10-s-4*s^2-s^3),(-3+s)/(-10+s+4*s^2+s^3)},\n"
970+
+ " {-s/(10-s-4*s^2-s^3),(-2-s)/(10-s-4*s^2-s^3),(8+5*s+s^2)/(-10+s+4*s^2+s^3)}}");
970971
check("N(Inverse({{1,2.0},{3,4}}),50)", "{{-2,1},\n" + " {1.5,-5e-1}}");
971972

972973
check("Inverse({{1,2},{3,4}})", "{{-2,1},\n" + " {3/2,-1/2}}");
@@ -1524,16 +1525,15 @@ public void testSystem171() {
15241525
public void testSystem171a() {
15251526
check("Integrate(1/(x^5+x-7),x)", //
15261527
"Integrate(1/(-7+x+x^5),x)");
1527-
1528-
1528+
15291529
check("Rubi`PolyQ(x/(2*Sqrt(2)),x,1)", //
15301530
"True");
15311531
check("Rubi`PolyQ((2+2*x)/(2*Sqrt(2)),x)", //
15321532
"True");
1533-
// check("Rubi`PolyQ(2+2 *x,x,1)", //
1534-
// "True");
1535-
// check("Rubi`PolyQ(-(ArcTan((1+x)/Sqrt(2))/(2 Sqrt(2))),x )", //
1536-
// "True");
1533+
// check("Rubi`PolyQ(2+2 *x,x,1)", //
1534+
// "True");
1535+
// check("Rubi`PolyQ(-(ArcTan((1+x)/Sqrt(2))/(2 Sqrt(2))),x )", //
1536+
// "True");
15371537
check("Rubi`substaux(-ArcTan(x/(2*Sqrt(2)))/(2*Sqrt(2)),x,2+2*x,True)", //
15381538
"-ArcTan((1+x)/Sqrt(2))/(2*Sqrt(2))");
15391539
check("Integrate((x^2+2*x+3)^(-1),x)", //
@@ -1666,17 +1666,16 @@ public void testSystem171b() {
16661666

16671667
public void testSystem172() {
16681668

1669-
check("Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))",
1670-
"Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))");
1669+
check("Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))", "Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))");
16711670
check("Integrate(Cos(a*x)*Sin(b*x),x)", //
16721671
"Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))");
16731672
check("Integrate(Cos(a*x)*Sin(b*x),x)", //
16741673
"Cos((a-b)*x)/(2*(a-b))-Cos((a+b)*x)/(2*(a+b))");
1675-
1674+
16761675
check("Csc(b*x)^0", "1");
16771676
check("Integrate(Cos(x*(a+b)),x)", //
16781677
"Sin((a+b)*x)/(a+b)");
1679-
1678+
16801679
check("Integrate(Cos(a*x)*Sin(b*x)^2,x)",
16811680
"Sin(a*x)/(2*a)-Sin((a-2*b)*x)/(4*(a-2*b))-Sin((a+2*b)*x)/(4*(a+2*b))");
16821681
check("Integrate(Cos(a*x)^2*Sin(b*x),x)",
@@ -3182,7 +3181,7 @@ public void testSystem804() {
31823181
check("Integrate(1/(x^3 + 1), x)", //
31833182
"Log(1+x)/3-Log(1-x+x^2)/6");
31843183
check("D(1/3*(-3*ArcTan((2*x+1)*3^(-1/2))*3^(-1/2)-1/2*Log(x^2-x+1))+1/3*Log(x+1), x)", //
3185-
"1/(3*(1+x))+1/3*(-(-1+2*x)/(2*(1-x+x^2))+2/(-1-(1+2*x)^2/3))");
3184+
"1/(3*(1+x))+1/3*(-(-1+2*x)/(2*(1-x+x^2))-2/(1+(1+2*x)^2/3))");
31863185
check("Simplify(D(Integrate(1/(x^3 + 1), x), x))", //
31873186
"(1-x)/(2*(1+x^3))");
31883187
// check("Apart((1+(1/x))/(1+(2/x)))","");
@@ -3329,14 +3328,15 @@ public void testSystem994() {
33293328
}
33303329

33313330
public void testSystem995() {
3332-
check("Apart(1/((1 + x)*(5 + x)))", "1/(4+4*x)+1/(-20-4*x)");
3331+
check("Apart(1/((1 + x)*(5 + x)))", //
3332+
"1/(4+4*x)-1/(20+4*x)");
33333333
check("Apart((x)/(x^2-1))", "1/(-2+2*x)+1/(2+2*x)");
33343334
check("Apart((x+3)/(x^2-3*x-40))", "11/(-104+13*x)+2/(65+13*x)");
33353335
check("Apart((10*x^2+12*x+20)/(x^3-8))", "7/(-2+x)+(4+3*x)/(4+2*x+x^2)");
33363336
check("Apart((3*x+5)*(1-2*x)^(-2))", "13/8*1/(1/2-x)^2+3/(-2+4*x)");
33373337
check("Apart((10*x^2+12*x+20)/(x^3-8))", "7/(-2+x)+(4+3*x)/(4+2*x+x^2)");
33383338
check("Apart((10*x^2-63*x+29)/((x+2)*(x+3)^5))",
3339-
"195/(2+x)-308/(3+x)^5-185/(3+x)^4-195/(3+x)^3-195/(3+x)^2+195/(-3-x)");
3339+
"195/(2+x)-308/(3+x)^5-185/(3+x)^4-195/(3+x)^3-195/(3+x)^2-195/(3+x)");
33403340
}
33413341

33423342
public void testSystem996() {
@@ -3552,13 +3552,13 @@ public void testSystem1102() {
35523552
+ "{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n"
35533553
+ "{ 56.0, 4.0, 24.0, 56.0, 78.0, 0.0, 13.0, 0.0, 24.0, 57.0, 8.0, 1.0 },\n"
35543554
+ "{ 0.0, 0.0, 46.0, 666.0, 34.0, 13.0, 67.0, 9.0, 12.0, 45.0, 38.0, 0.0 }})", //
3555-
"{{1.0,0.0,0.0,0.0,0.0,0.0,2.10208,0.880296,1.20494,2.02695,0.0532847,-0.0238165},\n" +
3556-
" {0.0,1.0,0.0,0.0,0.0,0.0,15.92647,11.96727,11.32597,8.52651,4.08647,-0.243999},\n" +
3557-
" {0.0,0.0,1.0,0.0,0.0,0.0,35.20901,22.34247,20.93462,20.96898,8.61046,-0.47866},\n" +
3558-
" {0.0,0.0,0.0,1.0,0.0,0.0,-0.273706,-0.238202,-0.880791,-0.17439,-0.130603,0.0150597},\n" +
3559-
" {0.0,0.0,0.0,0.0,1.0,0.0,-12.79629,-7.9493,-6.94727,-7.48852,-2.70086,0.1789},\n" +
3560-
" {0.0,0.0,0.0,0.0,0.0,1.0,-71.94246,-45.37189,-9.85987,-42.21689,-13.79002,0.454309},\n" +
3561-
" {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}");
3555+
"{{1.0,0.0,0.0,0.0,0.0,0.0,2.10208,0.880296,1.20494,2.02695,0.0532847,-0.0238165},\n"
3556+
+ " {0.0,1.0,0.0,0.0,0.0,0.0,15.92647,11.96727,11.32597,8.52651,4.08647,-0.243999},\n"
3557+
+ " {0.0,0.0,1.0,0.0,0.0,0.0,35.20901,22.34247,20.93462,20.96898,8.61046,-0.47866},\n"
3558+
+ " {0.0,0.0,0.0,1.0,0.0,0.0,-0.273706,-0.238202,-0.880791,-0.17439,-0.130603,0.0150597},\n"
3559+
+ " {0.0,0.0,0.0,0.0,1.0,0.0,-12.79629,-7.9493,-6.94727,-7.48852,-2.70086,0.1789},\n"
3560+
+ " {0.0,0.0,0.0,0.0,0.0,1.0,-71.94246,-45.37189,-9.85987,-42.21689,-13.79002,0.454309},\n"
3561+
+ " {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}");
35623562

35633563
check("RowReduce({{ 0, 0, 0, 0 }})", "{{0,0,0,0}}");
35643564
check("RowReduce({{ 0.0, 1.0, 0.0, 0.0 }})", "{{0.0,1.0,0.0,0.0}}");
@@ -3570,9 +3570,8 @@ public void testSystem1102() {
35703570

35713571
check("RowReduce({{ 5.0, 7.0, 10.0, 3.0, 5.0, 8.0 },\n" + "{ 5.0, 2.0, 3.0, 10.0, 11.0, 9.0 },\n"
35723572
+ "{ 4.0, 3.0, 9.0, 12.0, 8.0, 9.0 }})",
3573-
"{{1.0,0.0,0.0,2.50862,2.67241,1.86207},\n" +
3574-
" {0.0,1.0,0.0,-3.19828,-1.46552,-0.827586},\n" +
3575-
" {0.0,0.0,1.0,1.28448,0.189655,0.448276}}");
3573+
"{{1.0,0.0,0.0,2.50862,2.67241,1.86207},\n" + " {0.0,1.0,0.0,-3.19828,-1.46552,-0.827586},\n"
3574+
+ " {0.0,0.0,1.0,1.28448,0.189655,0.448276}}");
35763575
check("RowReduce({{1,2,3},{4,5,6}})", "{{1,0,-1},\n" + " {0,1,2}}");
35773576

35783577
check("RowReduce({{1,1,0,1,5},{1,0,0,2,2},{0,0,1,4,-1},{0,0,0,0,0}})",
@@ -3790,14 +3789,14 @@ public void testNCalcGithub42() {
37903789
check("Together(1/(-3+x)-(2+x)/(3-x)^2)", "-5/(9-6*x+x^2)");
37913790
check("Simplify(1/(-3+x)-(2+x)/(3-x)^2)", "-5/(3-x)^2");
37923791
}
3793-
3794-
// public void testOutputformats() {
3795-
// check("{6.7^-4, 6.7^6, 6.7^8}", //
3796-
// "{0.0005,90458.38217,4.06067678*10^6}");
3797-
// check("{8.^5, 11.^7, 13.^9}", //
3798-
// "{32768.0,1.94871710*10^7,1.06044994*10^10}");
3799-
//
3800-
// checkNumeric("{6.7^-4, 6.7^6, 6.7^8}", //
3801-
// "{4.962503078612847E-4,90458.38216900002,4060676.7755664107}");
3802-
// }
3792+
3793+
// public void testOutputformats() {
3794+
// check("{6.7^-4, 6.7^6, 6.7^8}", //
3795+
// "{0.0005,90458.38217,4.06067678*10^6}");
3796+
// check("{8.^5, 11.^7, 13.^9}", //
3797+
// "{32768.0,1.94871710*10^7,1.06044994*10^10}");
3798+
//
3799+
// checkNumeric("{6.7^-4, 6.7^6, 6.7^8}", //
3800+
// "{4.962503078612847E-4,90458.38216900002,4060676.7755664107}");
3801+
// }
38033802
}

0 commit comments

Comments
 (0)