Skip to content

Commit 12bf83d

Browse files
committed
Bug tr5(Sin(x)^3) returns (1-Cos(x)^2)*Sin(x)^2but that's Sin(x)^4
1 parent a04e083 commit 12bf83d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,20 @@ public void testTrigSimplifyTR6() {
318318
public void testTrigSimplifyTR56() {
319319
Function<IExpr, IExpr> h = x -> F.C1.subtract(x);
320320

321+
// only an even exponent can be halved, so an odd power stays untouched
321322
IExpr tr56 = TrigSimplifyFu.tr56(F.Power(F.Sin(F.x), F.C3), F.Sin, F.Cos, h, F.C4, false);
322-
assertEquals("(1-Cos(x)^2)*Sin(x)^2", tr56.toString());
323+
assertEquals("Sin(x)^3", tr56.toString());
323324

324325
tr56 = TrigSimplifyFu.tr56(F.Power(F.Sin(F.x), F.C10), F.Sin, F.Cos, h, F.C4, false);
325326
assertEquals("Sin(x)^10", tr56.toString());
326327

328+
// fractional exponents have no integer half either
329+
tr56 = TrigSimplifyFu.tr56(F.Sqrt(F.Sin(F.x)), F.Sin, F.Cos, h, F.C4, false);
330+
assertEquals("Sqrt(Sin(x))", tr56.toString());
331+
332+
tr56 = TrigSimplifyFu.tr56(F.Power(F.Sin(F.x), F.QQ(3, 2)), F.Sin, F.Cos, h, F.C4, false);
333+
assertEquals("Sin(x)^(3/2)", tr56.toString());
334+
327335
tr56 = TrigSimplifyFu.tr56(F.Power(F.Sin(F.x), F.C6), F.Sin, F.Cos, h, F.C6, false);
328336
assertEquals("(1-Cos(x)^2)^3", tr56.toString());
329337

0 commit comments

Comments
 (0)