This repository was archived by the owner on Jun 18, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 69
new sinc, sinhc, tanc, tanhc generics + remaining trig functions #449
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #449 +/- ##
==========================================
- Coverage 85.79% 85.55% -0.25%
==========================================
Files 99 99
Lines 13357 13542 +185
Branches 719 716 -3
==========================================
+ Hits 11460 11586 +126
- Misses 1178 1240 +62
+ Partials 719 716 -3
Continue to review full report at Codecov.
|
sritchie
commented
Jan 19, 2022
src/sicmutils/generic.cljc
Outdated
(defgeneric sin 1 {:dfdx cos}) | ||
|
||
;; TODO add defaults for these too! | ||
;; https://www.johndcook.com/blog/2021/01/05/bootstrapping-math-library/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add notes about WHAT needs to exist at the base.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
new sinc, sinhc, tanc, tanhc generics + remaining trig functions #449:
All missing trigonometric functions have been filled in
sicmutils.generic
and aliased in
sicmutils.env
:acot
asec
acsc
coth
andacoth
sech
andasech
csch
andacsch
All of these have default implementations and derivatives defined. They'll
work out of the box for all types with
atan
defined (and potentiallyexp
,sqrt
andlog
.)Thanks to John D Cook's 'Bootstrapping a minimal math
library'
for his inspiration on the defaults and implementation order of these new
functions.
expt
gains a new default implementation for non-native-integral powers,making
expt
work for any type withexp
,log
andmul
defined.sqrt
gains a default implementation for all types implementingexp
,mul
andlog
.All trig functions now have derivatives and docstrings.
New
sinc
,tanc
,sinhc
,tanhc
functions live insicmutils.generic
and are aliased into
sicmutils.env
. These are generically defined as(/ (sin x) x)
,(/ (tan x) x)
(and similar withsinh
andtanh
), withcorrect definitions for 0 and infinite-valued inputs.
These functions all support derivatives as well.
New default
acot
implementation insicmutils.series
.