Skip to content

Commit 47ca8ef

Browse files
committed
WIP #939 Solve returns completely wrong result
1 parent 4856526 commit 47ca8ef

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,11 @@ private static IASTAppendable unitPolynomial(int varDegree, ExprPolynomial polyn
771771
}
772772
IExpr zDenominator;
773773
if (rhsDenominator.isTimes()) {
774-
IASTMutable temp = rhsDenominator.mapThread(F.Power(F.Slot1, F.QQ(-1, varDegree)), 1);
775774
if (rhsDenominator.first().isNegative()) {
776775
isNegative = !isNegative;
777-
temp.set(1, rhsDenominator.first().negate());
776+
rhsDenominator = ((IAST) rhsDenominator).setAtCopy(1, rhsDenominator.first().negate());
778777
}
778+
IASTMutable temp = rhsDenominator.mapThread(F.Power(F.Slot1, F.QQ(-1, varDegree)), 1);
779779
zDenominator = EvalEngine.get().evaluate(temp);
780780
} else {
781781
if (rhsDenominator.isNegative()) {

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

+10
Original file line numberDiff line numberDiff line change
@@ -2043,6 +2043,16 @@ public void testIssue919() {
20432043
"{{x->1125899906842624*Sqrt(1635/5747513123739563366932509455047)}}");
20442044
}
20452045

2046+
@Test
2047+
public void testIssue939() {
2048+
check("Solve(8000 ==60*(x^3/32*Pi),x)", //
2049+
"{{x->(8*(-5)^(2/3))/(3*Pi)^(1/3)},{x->(8*5^(2/3))/(3*Pi)^(1/3)},{x->(-8*(-1)^(1/\n"
2050+
+ "3)*5^(2/3))/(3*Pi)^(1/3)}}");
2051+
check("Solve(8000/(x^3/32*Pi)==60,x)", //
2052+
"{{x->(8*(-5)^(2/3))/(3*Pi)^(1/3)},{x->(8*5^(2/3))/(3*Pi)^(1/3)},{x->(-8*(-1)^(1/\n"
2053+
+ "3)*5^(2/3))/(3*Pi)^(1/3)}}");
2054+
}
2055+
20462056
/** The JUnit setup method */
20472057
@Override
20482058
public void setUp() {

0 commit comments

Comments
 (0)