@@ -237,12 +237,13 @@ let tests =
237
237
238
238
test " Algebraic Expansion" {
239
239
240
- // Auto-simplification does not expand expressions:
241
- ( a+ b)-( a+ b) ==> " a + b - (a + b) "
240
+ // Auto-simplification does not expand expressions, but -1 distributes inside parentheses :
241
+ ( a+ b)-( a+ b) ==> " 0 "
242
242
( a+ b)-( a+ b) |> Algebraic.expand ==> " 0"
243
- 2 *( a+ b)-( a+ b) ==> " a + b "
243
+ 2 *( a+ b)-( a+ b) ==> " -a - b + 2*(a + b) "
244
244
( a+ b)- 2 *( a+ b) |> Algebraic.expand ===> " (-1)*a + (-1)*b"
245
245
( a+ b)- 2 *( a+ b) |> Algebraic.expand ==> " -a - b"
246
+ -( a + b) + 2 *( a + b) ==> " -a - b + 2*(a + b)"
246
247
247
248
( a* b)/( b* a) ==> " 1"
248
249
( a* b)** 2 /( b* a) ==> " a*b"
@@ -285,7 +286,7 @@ let tests =
285
286
286
287
test " Algebaric Operators" {
287
288
288
- negate ( x + y** 2 ) ==> " -(x + y^2) "
289
+ negate ( x + y** 2 ) ==> " -x - y^2"
289
290
290
291
Algebraic.factors ( b* cos( x)* ln( d)* x) ==+> [ " b" ; " x" ; " ln(d)" ; " cos(x)" ]
291
292
Algebraic.factors ( b* cos( x)* log10( d)* x) ==+> [ " b" ; " x" ; " log(d)" ; " cos(x)" ]
@@ -402,7 +403,7 @@ let tests =
402
403
403
404
// TODO: expected: 0
404
405
Trigonometric.simplify ( sin( x) + sin( y) - 2 * sin( x/ 2 + y/ 2 )* cos( x/ 2 - y/ 2 ))
405
- ==> " sin(y) - sin(x - y)/2 - sin(x/2 - y/2 - (x/2 - y/2)) /2 - sin(-x/2 + y/2 - (x/2 - y/2))/2 - sin(x/2 + y/2 - (x/2 - y/2)) "
406
+ ==> " - sin(-x + y) /2 - sin(x - y)/2 " // "0 "
406
407
}
407
408
408
409
test " Differentiation and Taylor Series" {
@@ -482,7 +483,7 @@ let tests =
482
483
solve x ( 2 + 3 * x) ==> " -2/3"
483
484
484
485
// sin(a)+x*cos(b)+c = 0 --> x =
485
- solve x ( sin( a)+ x* cos( b)+ c) ==> " -(c + sin(a))/cos(b)"
486
+ solve x ( sin( a)+ x* cos( b)+ c) ==> " (-c - sin(a))/cos(b)"
486
487
487
488
// (x^2-1)/(x+1) = 0 --> x =
488
489
solve x (( x** 2-1 )/( x+ 1 )) ==> " 1"
0 commit comments