module Symtegration.Integration.Trigonometric (integrate) where
import Data.Text (Text)
import Symtegration.Symbolic
integrate :: Text -> Expression -> Maybe Expression
integrate :: Text -> Expression -> Maybe Expression
integrate Text
_ (Number Integer
_) = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
_ (Symbol Text
_) = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Sin' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Negate' (Expression -> Expression) -> Expression -> Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Cos' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Cos' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Sin' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Tan' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Negate' (Expression -> Expression) -> Expression -> Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Log' (Expression -> Expression) -> Expression -> Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Abs' (Expression -> Expression) -> Expression -> Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Cos' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Asin' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Asin' Expression
x) Expression -> Expression -> Expression
:+: Expression -> Expression
Sqrt' (Expression
1 Expression -> Expression -> Expression
:-: (Expression
x Expression -> Expression -> Expression
:**: Expression
2))
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Acos' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Acos' Expression
x) Expression -> Expression -> Expression
:-: Expression -> Expression
Sqrt' (Expression
1 Expression -> Expression -> Expression
:-: (Expression
x Expression -> Expression -> Expression
:**: Expression
2))
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Atan' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Atan' Expression
x) Expression -> Expression -> Expression
:-: (Expression -> Expression
Log' ((Expression
x Expression -> Expression -> Expression
:**: Expression
2) Expression -> Expression -> Expression
:+: Expression
1) Expression -> Expression -> Expression
:/: Expression
2)
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Sinh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Cosh' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Cosh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Sinh' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Tanh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Log' (Expression -> Expression) -> Expression -> Expression
forall a b. (a -> b) -> a -> b
$ Expression -> Expression
Cosh' Expression
x
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Asinh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Asinh' Expression
x) Expression -> Expression -> Expression
:-: Expression -> Expression
Sqrt' ((Expression
x Expression -> Expression -> Expression
:**: Expression
2) Expression -> Expression -> Expression
forall a. Num a => a -> a -> a
+ Expression
1)
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Acosh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Acosh' Expression
x) Expression -> Expression -> Expression
:-: (Expression -> Expression
Sqrt' (Expression
x Expression -> Expression -> Expression
:+: Expression
1) Expression -> Expression -> Expression
:*: Expression -> Expression
Sqrt' (Expression
x Expression -> Expression -> Expression
:-: Expression
1))
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
v (Atanh' x :: Expression
x@(Symbol Text
s))
| Text
s Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
v = Expression -> Maybe Expression
forall a. a -> Maybe a
Just (Expression -> Maybe Expression) -> Expression -> Maybe Expression
forall a b. (a -> b) -> a -> b
$ (Expression
x Expression -> Expression -> Expression
:*: Expression -> Expression
Atanh' Expression
x) Expression -> Expression -> Expression
:+: (Expression -> Expression
Log' (Expression
1 Expression -> Expression -> Expression
:-: (Expression
x Expression -> Expression -> Expression
:**: Expression
2)) Expression -> Expression -> Expression
:/: Expression
2)
| Bool
otherwise = Maybe Expression
forall a. Maybe a
Nothing
integrate Text
_ Expression
_ = Maybe Expression
forall a. Maybe a
Nothing