@@ -121,7 +121,7 @@ module ExpressionPatterns =
121121 | Function ( Sin, _) | Function ( Cos, _) as r -> Some ( r, Number BigRational.One)
122122 | Function ( Sinh, _) | Function ( Cosh, _) as r -> Some ( r, Number BigRational.One)
123123 | Power ( Function ( Sin, _) as r, ( Number n as p)) when n.IsInteger && n.IsPositive -> Some ( r, p)
124- | Power ( Function ( Cos, _) as r, ( Number n as p)) when n.IsInteger && n.IsPositive -> Some ( r, p)
124+ | Power ( Function ( Cos, _) as r, ( Number n as p)) when n.IsInteger && n.IsPositive -> Some ( r, p)
125125 | Power ( Function ( Sinh, _) as r, ( Number n as p)) when n.IsInteger && n.IsPositive -> Some ( r, p)
126126 | Power ( Function ( Cosh, _) as r, ( Number n as p)) when n.IsInteger && n.IsPositive -> Some ( r, p)
127127 | _ -> None
@@ -342,15 +342,15 @@ module Operators =
342342 | oo, Zero when isInfinity oo -> undefined
343343 | oo, PositiveInfinity when isInfinity oo -> complexInfinity
344344 | oo, Number b when isInfinity oo && b.IsNegative -> zero
345- | ComplexInfinity, Positive -> complexInfinity
345+ | ComplexInfinity, Positive -> complexInfinity
346346 | PositiveInfinity, Positive -> infinity
347347 | NegativeInfinity, Number b when b.IsPositive && b.IsInteger ->
348348 if ( b.Numerator % 2 I) .IsZero then infinity else negativeInfinity
349349 | One, oo | MinusOne, oo when isInfinity oo -> undefined
350350 | _, Zero | One, _ -> one
351351 | a, One -> a
352352 | Positive, PositiveInfinity -> infinity
353- | Negative, PositiveInfinity -> complexInfinity
353+ | Negative, PositiveInfinity -> complexInfinity
354354 | _, NegativeInfinity -> zero
355355 | _, ComplexInfinity -> undefined
356356 | Number a, Number b when not ( b.IsInteger) -> Power ( x, y)
@@ -366,7 +366,7 @@ module Operators =
366366 let rec invert = function
367367 | Undefined -> undefined
368368 | Zero -> complexInfinity
369- | oo when isInfinity oo -> zero
369+ | oo when isInfinity oo -> zero
370370 | Values.Value v -> Values.invert v
371371 | Product ax -> Product ( ax |> List.map invert)
372372 | Power ( r, p) -> pow r ( negate p)
@@ -396,7 +396,7 @@ module Operators =
396396 | NegativeInfinity -> zero
397397 | Zero -> one
398398 | One -> Constant E
399- | MinusOne -> invert ( Constant E)
399+ | MinusOne -> invert ( Constant E)
400400 | Product [ Constant Pi; Constant I;] -> minusOne // exp(n*pi*j) for ...-1, -1/2, 0, 1/2, 1,...
401401 | Product [ Number n; Constant Pi; Constant I;] when n.IsInteger
402402 -> if n.Numerator.IsEven then one else minusOne
@@ -468,7 +468,7 @@ module Operators =
468468 | Function ( Acos, x') -> divide ( sqrt ( subtract one ( pow x' two))) x' // tan(acos(x)) = sqrt(1 - x^2)/x
469469 | Function ( Atan, x') -> x' // tan(atan(x)) = x
470470 | Function ( Acsc, x') -> invert ( multiply x' ( sqrt ( subtract one ( invert ( pow x' two))))) // tan(acsc(x)) = 1/(sqrt(1 - 1/x^2)*x)
471- | Function ( Asec, x') -> multiply x' ( sqrt ( subtract one ( invert ( pow x' two)))) // tan(asec(x)) = x*sqrt(1 - 1/x^2)
471+ | Function ( Asec, x') -> multiply x' ( sqrt ( subtract one ( invert ( pow x' two)))) // tan(asec(x)) = x*sqrt(1 - 1/x^2)
472472 | Function ( Acot, x') -> invert x' // tan(acot(x)) = 1/x
473473 | x -> Function ( Tan, x)
474474 let csc = function
@@ -478,7 +478,7 @@ module Operators =
478478 | Constant Pi -> complexInfinity // csc(pi) = coo
479479 | Constant I -> Function ( Csch, one) |> multiply ( Constant I) |> negate // csc(j) = -j*csch(1), csc(j*x) = -j*csch(x)
480480 | Number n when n.IsNegative -> Function ( Csc, Number - n) |> negate // csc(-x) = -csc(x)
481- | Product (( Number n):: ax) when n.IsNegative -> Function ( Csc, multiply ( Number - n) ( Product ax)) |> negate
481+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Csc, multiply ( Number - n) ( Product ax)) |> negate
482482 | Function ( Asin, x') -> invert x' // csc(asin(x)) = 1/x
483483 | Function ( Acos, x') -> invert ( sqrt ( subtract one ( pow x' two))) // csc(acos(x)) = 1/sqrt(1 - x^2)
484484 | Function ( Atan, x') -> divide ( sqrt ( add one ( pow x' two))) x' // csc(atan(x)) = sqrt(1 + x^2)/x
@@ -493,7 +493,7 @@ module Operators =
493493 | Constant Pi -> minusOne // sec(pi) = -1
494494 | Constant I -> Function ( Sech, one) // sec(j) = sech(1), sec(j*x) = sech(x)
495495 | Number n when n.IsNegative -> Function ( Sec, Number - n) // sec(-x) = sec(x)
496- | Product (( Number n):: ax) when n.IsNegative -> Function ( Sec, multiply ( Number - n) ( Product ax))
496+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Sec, multiply ( Number - n) ( Product ax))
497497 | Function ( Asin, x') -> invert ( sqrt ( subtract one ( pow x' two))) // sec(asin(x)) = 1/sqrt(1 - x^2)
498498 | Function ( Acos, x') -> invert x' // sec(acos(x)) = 1/x
499499 | Function ( Atan, x') -> sqrt ( add one ( pow x' two)) // sec(atan(x)) = sqrt(1 + x^2)
@@ -505,14 +505,14 @@ module Operators =
505505 | Undefined -> undefined
506506 | oo when isInfinity oo -> undefined
507507 | Zero -> complexInfinity // cot(0) = coo
508- | Constant Pi -> complexInfinity // cot(pi) = coo
508+ | Constant Pi -> complexInfinity // cot(pi) = coo
509509 | Constant I -> Function ( Coth, one) |> multiply ( Constant I) |> negate // cot(j) = -j*coth(1), cot(j*x) = -j*coth(x)
510510 | Number n when n.IsNegative -> Function ( Cot, Number - n) |> negate // cot(-x) = -cot(x)
511- | Product (( Number n):: ax) when n.IsNegative -> Function ( Cot, multiply ( Number - n) ( Product ax)) |> negate
511+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Cot, multiply ( Number - n) ( Product ax)) |> negate
512512 | Function ( Asin, x') -> divide ( sqrt ( subtract one ( pow x' two))) x' // cot(asin(x)) = sqrt(1 - x^2)/x
513513 | Function ( Acos, x') -> divide x' ( sqrt ( subtract one ( pow x' two))) // cot(acos(x)) = x/sqrt(1 - x^2)
514514 | Function ( Atan, x') -> invert x' // cot(atan(x)) = 1/x
515- | Function ( Acsc, x') -> multiply x' ( sqrt ( subtract one ( invert ( pow x' two)))) // cot(acsc(x)) = x*sqrt(1 - 1/x^2)
515+ | Function ( Acsc, x') -> multiply x' ( sqrt ( subtract one ( invert ( pow x' two)))) // cot(acsc(x)) = x*sqrt(1 - 1/x^2)
516516 | Function ( Asec, x') -> invert ( multiply x' ( sqrt ( subtract one ( invert ( pow x' two))))) // cot(asec(x)) = 1/(x*sqrt(1 - 1/x^2))
517517 | Function ( Acot, x') -> x' // cot(acot(x)) = x
518518 | x -> Function ( Cot, x)
@@ -524,7 +524,7 @@ module Operators =
524524 | Zero -> zero // sinh(0) = 0
525525 | Constant I -> Function ( Sin, one) |> multiply ( Constant I) // sinh(j) = j*sin(1), sinh(j*x) = j*sin(x)
526526 | Number n when n.IsNegative -> Function ( Sinh, Number - n) |> negate // sinh(-x) = -sinh(x)
527- | Product (( Number n):: ax) when n.IsNegative -> Function ( Sinh, multiply ( Number - n) ( Product ax)) |> negate
527+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Sinh, multiply ( Number - n) ( Product ax)) |> negate
528528 | Function ( Asinh, x') -> x' // sinh(asinh(x)) = x
529529 | Function ( Acosh, x') -> multiply ( add one x') ( sqrt ( divide ( subtract x' one) ( add x' one))) // sinh(acosh(x)) = (x + 1)*sqrt((x - 1)/(x + 1))
530530 | Function ( Atanh, x') -> divide x' ( sqrt ( subtract one ( pow x' two))) // sinh(atanh(x)) = x/sqrt(1 - x^2)
@@ -535,30 +535,30 @@ module Operators =
535535 let cosh = function
536536 | Undefined | ComplexInfinity -> undefined
537537 | PositiveInfinity | NegativeInfinity -> infinity // cosh(oo) = cosh(-oo) = oo
538- | Zero -> one // cosh(0) = 1
538+ | Zero -> one // cosh(0) = 1
539539 | Constant I -> Function ( Cos, one) // cosh(j) = cos(1), cosh(j*x) = cos(x)
540540 | Number n when n.IsNegative -> Function ( Cosh, Number - n) // cosh(-x) = cosh(x)
541- | Product (( Number n):: ax) when n.IsNegative -> Function ( Cosh, multiply ( Number - n) ( Product ax))
541+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Cosh, multiply ( Number - n) ( Product ax))
542542 | Function ( Asinh, x') -> sqrt ( add ( pow x' two) one) // cosh(asinh(x)) = sqrt(x^2 + 1)
543543 | Function ( Acosh, x') -> x' // cosh(acosh(x)) = x
544544 | Function ( Atanh, x') -> invert ( sqrt ( subtract one ( pow x' two))) // cosh(atanh(x)) = 1/sqrt(1 - x^2)
545545 | Function ( Acsch, x') -> sqrt ( add ( invert ( pow x' two)) one) // cosh(acsch(x)) = sqrt(1/x^2 + 1)
546546 | Function ( Asech, x') -> invert x' // cosh(asech(x)) = 1/x
547547 | Function ( Acoth, x') -> invert ( sqrt ( subtract one ( invert ( pow x' two)))) // cosh(acoth(x)) = 1/sqrt(1 - 1/x^2)
548- | x -> Function ( Cosh, x)
548+ | x -> Function ( Cosh, x)
549549 let tanh = function
550550 | Undefined | ComplexInfinity -> undefined
551551 | PositiveInfinity -> one // tanh(oo) = 1, tanh(-oo) = -1
552552 | NegativeInfinity -> minusOne
553553 | Zero -> zero // tanh(0) = 0
554554 | Constant I -> Function ( Tan, one) |> multiply ( Constant I) // tanh(j) = j*tan(1), tanh(j*x) = j*tan(x)
555555 | Number n when n.IsNegative -> Function ( Tanh, Number - n) |> negate // tanh(-x) = -tanh(x)
556- | Product (( Number n):: ax) when n.IsNegative -> Function ( Tanh, multiply ( Number - n) ( Product ax)) |> negate
556+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Tanh, multiply ( Number - n) ( Product ax)) |> negate
557557 | Function ( Asinh, x') -> divide x' ( sqrt ( add ( pow x' two) one)) // tanh(asinh(x)) = x/sqrt(x^2 + 1)
558558 | Function ( Acosh, x') -> divide ( multiply ( add x' one) ( sqrt ( divide ( subtract x' one) ( add x' one)))) x' // tanh(acosh(x)) = ((x + 1)*sqrt((x - 1)/(x + 1)))/x
559559 | Function ( Atanh, x') -> x' // tanh(atanh(x)) = x
560560 | Function ( Acsch, x') -> invert ( multiply x' ( sqrt ( add ( invert ( pow x' two)) one))) // tanh(acsch(x)) = 1/(x*sqrt(1/x^2 + 1))
561- | Function ( Asech, x') -> multiply ( add x' one) ( sqrt( divide ( subtract one x') ( add x' one))) // tanh(asech(x)) = (x + 1)*sqrt((1 - x)/(x + 1))
561+ | Function ( Asech, x') -> multiply ( add x' one) ( sqrt( divide ( subtract one x') ( add x' one))) // tanh(asech(x)) = (x + 1)*sqrt((1 - x)/(x + 1))
562562 | Function ( Acoth, x') -> invert x' // tanh(acoth(x)) = 1/x
563563 | x -> Function ( Tanh, x)
564564 let csch = function
@@ -567,7 +567,7 @@ module Operators =
567567 | Zero -> complexInfinity // csch(0) = coo
568568 | Constant I -> Function ( Csc, one) |> multiply ( Constant I) |> negate // csch(j) = -j*csc(1), csch(j*x) = -j*csc(x)
569569 | Number n when n.IsNegative -> Function ( Csch, Number - n) |> negate // csch(-x) = -csch(x)
570- | Product (( Number n):: ax) when n.IsNegative -> Function ( Csch, multiply ( Number - n) ( Product ax)) |> negate
570+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Csch, multiply ( Number - n) ( Product ax)) |> negate
571571 | Function ( Asinh, x') -> invert x' // csch(asinh(x)) = 1/x
572572 | Function ( Acosh, x') -> invert ( multiply ( add one x') ( sqrt ( divide ( subtract x' one) ( add x' one)))) // csch(acosh(x)) = 1/((x + 1)*sqrt((x - 1)/(x + 1)))
573573 | Function ( Atanh, x') -> divide ( sqrt ( subtract one ( pow x' two))) x' // csch(atanh(x)) = sqrt(1 - x^2)/x
@@ -581,7 +581,7 @@ module Operators =
581581 | Zero -> one // sech(0) = 1
582582 | Constant I -> Function ( Sec, one) // sech(j*x) = sec(x)
583583 | Number n when n.IsNegative -> Function ( Sech, Number - n) // sech(-x) = sech(x)
584- | Product (( Number n):: ax) when n.IsNegative -> Function ( Sech, multiply ( Number - n) ( Product ax))
584+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Sech, multiply ( Number - n) ( Product ax))
585585 | Function ( Asinh, x') -> invert ( sqrt ( add ( pow x' two) one)) // sech(asinh(x)) = 1/sqrt(x^2 + 1)
586586 | Function ( Acosh, x') -> invert x' // sech(acosh(x)) = 1/x
587587 | Function ( Atanh, x') -> sqrt ( subtract one ( pow x' two)) // sech(atanh(x)) = sqrt(1 - x^2)
@@ -595,7 +595,7 @@ module Operators =
595595 | Zero -> complexInfinity
596596 | Constant I -> Function ( Cot, one) |> multiply ( Constant I) |> negate // coth(j*x) = -j*cot(x)
597597 | Number n when n.IsNegative -> Function ( Coth, Number - n) |> negate // coth(-x) = -coth(x)
598- | Product (( Number n):: ax) when n.IsNegative -> Function ( Coth, multiply ( Number - n) ( Product ax)) |> negate
598+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Coth, multiply ( Number - n) ( Product ax)) |> negate
599599 | Function ( Asinh, x') -> divide ( sqrt ( add ( pow x' two) one)) x' // coth(asinh(x)) = sqrt(x^2 + 1)/x
600600 | Function ( Acosh, x') -> divide x' ( multiply ( add x' one) ( sqrt ( divide ( subtract x' one) ( add x' one)))) // coth(acosh(x)) = x/((x + 1)*sqrt((x - 1)/(x + 1)))
601601 | Function ( Atanh, x') -> invert x' // coth(atanh(x)) = 1/x
@@ -652,7 +652,7 @@ module Operators =
652652 | oo when isInfinity oo -> zero // acot(coo) = acot(oo) = acot(-oo) = 0
653653 | Zero -> divide pi two // acot(0) = pi/2
654654 | One -> divide pi four // acot(1) = pi/4, acot(-1) = -pi/4
655- | MinusOne -> divide pi four |> negate
655+ | MinusOne -> divide pi four |> negate
656656 | Constant I -> multiply ( Constant I) negativeInfinity // atan(j) = -oo*j
657657 | Number n when n.IsNegative -> Function ( Acot, Number - n) |> negate // acot(-x) = -acot(x)
658658 | Product (( Number n):: ax) when n.IsNegative -> Function ( Acot, multiply ( Number - n) ( Product ax)) |> negate
@@ -662,10 +662,10 @@ module Operators =
662662 | Undefined | ComplexInfinity -> undefined
663663 | PositiveInfinity -> infinity // asinh(oo) = oo, asinh(-oo) = -oo
664664 | NegativeInfinity -> negativeInfinity
665- | Zero -> zero // asinh(0) = 0
665+ | Zero -> zero // asinh(0) = 0
666666 | Constant I -> divide ( multiply pi ( Constant I)) two // asinh(j) = pi*j/2, asinh(n*j) = j*asin(n)
667667 | Number n when n.IsNegative -> Function ( Asinh, Number - n) |> negate // asinh(-x) = -asinh(x)
668- | Product (( Number n):: ax) when n.IsNegative -> Function ( Asinh, multiply ( Number - n) ( Product ax)) |> negate
668+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Asinh, multiply ( Number - n) ( Product ax)) |> negate
669669 | x -> Function ( Asinh, x)
670670 let arccosh = function
671671 | Undefined | ComplexInfinity -> undefined
@@ -683,15 +683,15 @@ module Operators =
683683 | MinusOne -> negativeInfinity
684684 | Constant I -> divide ( multiply pi ( Constant I)) four // atanh(j) = pi*j/4
685685 | Number n when n.IsNegative -> Function ( Atanh, Number - n) |> negate // atanh(-x) = -atanh(x)
686- | Product (( Number n):: ax) when n.IsNegative -> Function ( Atanh, multiply ( Number - n) ( Product ax)) |> negate
686+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Atanh, multiply ( Number - n) ( Product ax)) |> negate
687687 | x -> Function ( Atanh, x)
688688 let arccsch = function
689689 | Undefined | ComplexInfinity -> undefined
690690 | PositiveInfinity | NegativeInfinity -> zero // acsch(oo) = acsch(-oo) = 0
691- | Zero | One | MinusOne -> complexInfinity // acsch(0) = coo
691+ | Zero | One | MinusOne -> complexInfinity // acsch(0) = coo
692692 | Constant I -> divide ( multiply pi ( Constant I)) two |> negate // acsch(j) = -pi*j/2
693693 | Number n when n.IsNegative -> Function ( Acsch, Number - n) |> negate // acsch(-x) = -acsch(x)
694- | Product (( Number n):: ax) when n.IsNegative -> Function ( Acsch, multiply ( Number - n) ( Product ax)) |> negate
694+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Acsch, multiply ( Number - n) ( Product ax)) |> negate
695695 | x -> Function ( Acsch, x)
696696 let arcsech = function
697697 | Undefined | ComplexInfinity -> undefined
@@ -708,7 +708,7 @@ module Operators =
708708 | MinusOne -> negativeInfinity
709709 | Constant I -> divide ( multiply pi ( Constant I)) four |> negate // atanh(j) = -pi*j/4
710710 | Number n when n.IsNegative -> Function ( Acoth, Number - n) |> negate // acoth(-x) = -acoth(x)
711- | Product (( Number n):: ax) when n.IsNegative -> Function ( Acoth, multiply ( Number - n) ( Product ax)) |> negate
711+ | Product (( Number n):: ax) when n.IsNegative -> Function ( Acoth, multiply ( Number - n) ( Product ax)) |> negate
712712 | x -> Function ( Acoth, x)
713713
714714 let apply f x =
@@ -728,7 +728,7 @@ module Operators =
728728 | Tanh -> tanh x
729729 | Csch -> csch x
730730 | Sech -> sech x
731- | Coth -> coth x
731+ | Coth -> coth x
732732 | Asin -> arcsin x
733733 | Acos -> arccos x
734734 | Atan -> arctan x
@@ -741,7 +741,7 @@ module Operators =
741741 | Acsch -> arccsch x
742742 | Asech -> arcsech x
743743 | Acoth -> arccoth x
744-
744+
745745
746746 let applyN ( f : Function ) ( xs : Expression list ) =
747747 match f, xs with
@@ -796,7 +796,7 @@ type Expression with
796796 static member Cot ( x ) = Operators.cot x
797797
798798 static member Sinh ( x ) = Operators.sinh x
799- static member Cosh ( x ) = Operators.cosh x
799+ static member Cosh ( x ) = Operators.cosh x
800800 static member Tanh ( x ) = Operators.tanh x
801801 static member Coth ( x ) = Operators.coth x
802802 static member Csch ( x ) = Operators.csch x
0 commit comments