<commit_before>%if False
\begin{code}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE TypeSynonymInstances #-}
module DSLsofMath.W06 where
import DSLsofMath.FunExp hiding (eval, derive)
import DSLsofMath.W05
import DSLsofMath.Algebra
import Prelude hiding (Num(..),(/),(^),Fractional(..),Floating(..))
import Prelude (abs)
import Data.Complex ()
\end{code}
%endif

\chapter{Higher-order Derivatives and their Applications}
\label{sec:deriv}

In this chapter we make heavy use of concepts from \cref{sec:CompSem}
and thus we urge the reader to verify their understanding of
\cref{sec:homomophism-roadmap} and do \cref{exc:findFunExp0} if they
might have skipped it.
%
We have seen in particular that we can give a numeric (|Field|, etc.)
structure not only to functions, but also to pairs of functions and
their derivatives (|Field x => Field (a -> x, a -> x)|).
%
But why stop there?
%
Why not compute a (lazy) list (also called a stream) of a function
together with its derivative, second derivative, etc.:
%
\begin{spec}
[f, f', f'', ...] :: [a -> a]
\end{spec}<commit_msg>tweak ref<commit_after>%if False
\begin{code}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE TypeSynonymInstances #-}
module DSLsofMath.W06 where
import DSLsofMath.FunExp hiding (eval, derive)
import DSLsofMath.W05
import DSLsofMath.Algebra
import Prelude hiding (Num(..),(/),(^),Fractional(..),Floating(..))
import Prelude (abs)
import Data.Complex ()
\end{code}
%endif

\chapter{Higher-order Derivatives and their Applications}
\label{sec:deriv}

In this chapter we make heavy use of concepts from \cref{sec:CompSem}
and thus we urge readers to verify their understanding of
\cref{sec:homomophism-roadmap,exc:findFunExp0} in case they
might have skipped it.
%
We have seen in particular that we can give a numeric (|Field|, etc.)
structure not only to functions, but also to pairs of functions and
their derivatives (|Field x => Field (a -> x, a -> x)|).
%
But why stop there?
%
Why not compute a (lazy) list (also called a stream) of a function
together with its derivative, second derivative, etc.:
%
\begin{spec}
[f, f', f'', ...] :: [a -> a]
\end{spec}
{'fraction_non_alphanumeric': 0.13127753303964756, 'fraction_numerical': 0.004405286343612335, 'mean_word_length': 4.7639593908629445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7075631', 'n_tokens_mistral': 800, 'n_tokens_neox': 763, 'n_words': 271}