Skip to content

Commit

Permalink
Additional content for front page.
Browse files Browse the repository at this point in the history
  • Loading branch information
chungyc committed Jan 6, 2025
1 parent 44fb0c8 commit a5f8602
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 3 deletions.
76 changes: 75 additions & 1 deletion site/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,88 @@ description: Symtegration is a Haskell library for symbolic integration.

Symtegration is a Haskell library intended to support symbolic integration of mathematical expressions.

It offers the following:

* Symbolic integration of mathematical expressions.

* Integration of polynomials.

* Integration of trigonometric functions.

* Integration of exponential and logarithmic functions.

* Partial support for integrating ratios of two polynomials.

* Integration by substitution.

* Symbolic representation of mathematical expressions.

* Utility functions to make it easier to read the mathematical expressions.
For example, deriving equivalent Haskell code for a mathematical expression,
and some support for simplifying symbolic representations.

## Integration {#integration}

Mathematical expressions with either numeric coefficients or symbolic coefficients
can be integrated. For example:

```haskell
>>> :load Symtegration
>>> import Symtegration
>>> toHaskell <$> integrate "x" (4 * "x" **3 + 1)
Just "x + (x ** 4)"
>>> toHaskell <$> integrate "x" (1 / (1 + "x" ** 2))
Just "atan x"
```

Concrete numbers can also be computed from these integrals. For example:

```haskell
>>> import Symtegration
>>> let (Just p) = integrate "x" (4 * "x" ** 3 + 1)
>>> fractionalEvaluate p (\case "x" -> Just (3 / 7 :: Rational))
Just (1110 % 2401)
```

### Symbolic integration in GHCi {#ghci}

With Symtegration, symbolic integration can be done within [GHCi].
When executing GHCi within the Symtegration project, it is best
to load only the `Symtegration` module to avoid name collisions,
so start GHCi without loading any modules.

```shell
$ stack ghci --no-load
```

Within GHCi, explicitly load the `Symtegration` module.
You can then proceed to symbolically integrate mathematical expressions
and compute approximate or exact values from these integrals.

```haskell
>>> :load Symtegration
>>> toHaskell <$> integrate "x" ("a" * "x" ** 4 + "x" + "b")
Just "b * x + (1 / 2) * (x ** 2) + a * ((x ** 5) / 5)"
>>>
>>> let (Just p) = integrate "x" ("x" ** 2)
>>> evaluate p (\case "x" -> Just 1)
Just 0.3333333333333333
>>>
>>> fractionalEvaluate p (\case "x" -> Just (1 :: Rational))
Just (1 % 3)
```

[GHCi]: https://downloads.haskell.org/ghc/latest/docs/users_guide/ghci.html

### Symblic integration in IHaskell {#ihaskell}

Symtegration can also be used in [IHaskell] to do symbolic integration.
Its use can be seen in an [example IHaskell notebook],
which you try out by [running on mybinder.org].

[IHaskell]: https://github.com/IHaskell/IHaskell
[example IHaskell notebook]: https://github.com/chungyc/haskell-notebooks/blob/main/Symtegration.ipynb
[running on mybinder.org]: https://mybinder.org/v2/gh/chungyc/ihaskell/custom?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.heygears.com%252Fchungyc%252Fhaskell-notebooks%26urlpath%3Dlab%252Ftree%252Fhaskell-notebooks%252FSymtegration.ipynb%26branch%3Dmain

## Project information {#information}

* [Source repository](https://github.com/symtegration/symtegration)
Expand Down
8 changes: 7 additions & 1 deletion site/style/default.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ listsStyle = do
\begin{code}
codeStyle :: Css
codeStyle = do
div # ".sourceCode" ? do
div # ".sourceCode" <> pre # ".shell" ? do
borderStyle solid
borderWidth $ px 1
marginTop $ em 1
Expand Down Expand Up @@ -147,6 +147,9 @@ lightColorScheme = do
a # link ? color blue
a # visited ? color purple
h1 ? do
color $ rgb 0 0 125
\end{code}

\begin{code}
Expand All @@ -158,4 +161,7 @@ darkColorScheme = do
a # link ? color cyan
a # visited ? color pink
h1 ? do
color $ rgb 255 255 125
\end{code}
2 changes: 1 addition & 1 deletion site/template/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h1>$title$</h1>
</main>

<footer>
<p>Content licensed under the <a href="/LICENSE">Apache-2.0 license</a></p>
<p>Content licensed under the <a href="/LICENSE">Apache-2.0 license</a>.</p>
</footer>
</body>
</html>

0 comments on commit a5f8602

Please # to comment.