This repository was archived by the owner on Jun 18, 2025. It is now read-only.
Taylor series upgrades + extra tidying #514
Merged
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.
Taylor series upgrades + extra tidying #514:
Modifies
sicmutils.calculus.derivative/taylor-series
to return a properPowerSeries
instance, which the user can call with somedx
to get backthe old behavior.
The new version can take any number of arguments in addition to
f
.Supplying no arguments returns the expansion at 0; if you supply many
arguments (totally fine!), you'll need to wrap your
dx
components in avector before supplying them to the returned
PowerSeries
.sicmutils.series/function->
works the same way now, and functionsidentically, but with a different implementation. (previously it took a
single expansion point under a keyword argument
:x0
.)The new
sicmutils.calculus.derivative/symbolic-taylor-series
is a port ofTaylor-series-coefficients
fromscmutils
. It has the same contract astaylor-series
, except that the full expansion is performed symbolically,and the original arguments are substituted in after expansion and
simplification.
Other changes:
Installs
1
as theone-like
andidentity-like
return values forstructures and vectors. A true identity element would be an identity
element compatible with all entries of the structure; but as defined now,
1
is a fine choice and matches thescmutils
implementation.new
sicmutils.differential/map-coefficients
, which makessimplify
slightly more efficient by filtering terms .
more efficient
sicmutils.expression/variables-in
, maybe 30% faster forbig expressions; this makes a difference in the simplifier!
sicmutils.expression/substitute
now works for properLiteral
instances. Before it only worked for unwrapped literals.
matrix walks made slightly faster by caching a row or column before
traversal