This release adds a number of performance upgrades, and completes the port of all code in the mechanics
package of the original scmutils
library.
This will also be the final release before extracting most of the code in the library out and giving it a new identity and home as the "Emmy Computer Algebra System", housed at https://github.com/mentat-collective/emmy.
New Code / Upgrades
-
#531:
-
Adds proper self-require forms to all
cljc
namespaces with macros; this removes the need for:include-macros true
or:refer-macros
and makes the life of consumers simpler. -
Upgrades sci, test.check, core.match, timbre, clojurescript, shadow-cljs dependencies to remove various warnings.
-
Adds
sicmutils.structure/symbol-set
-
Adds
IHash
implementations forjs/BigInt
,goog.math.Long
,goog.map.Integer
andRatio
types
-
-
#514:
-
Modifies
sicmutils.calculus.derivative/taylor-series
to return a properPowerSeries
instance, which the user can call with somedx
to get back the 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 yourdx
components in a
vector before supplying them to the returnedPowerSeries
. -
sicmutils.series/function->
works the same way now, and functions identically, 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 for structures 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 for big 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
-
-
-
#512:
-
adds
sicmutils.mechanics.routhian
, with implementations ofLagrangian->Routhian
,Routh-equations
,Routhian->acceleration
,Routhian->state-derivative
,Lagrangian-state->Routhian-state
andRouthian-state->Lagrangian-state
. -
adds missing
sicmutils.mechanics.{routhian,time-evolution,noether}
tosicmutils.env.sci
-
-
#509:
-
Fixes a bug with
down*Matrix
multiplication, and adds tests for correctness. -
Adds
sicmutils.matrix.{symmetric?,antisymmetric?}
predicates -
The mechanics port continues with
sicmutils.mechanics.rigid
:-
T-rigid-body
moves toT-body-Euler
with an alias back to its original name. Same situation forEuler-state->L-body
=>L-body-Euler
andEuler-state->L-space
=>L-space-Euler
. -
New functions:
three-vector-components->antisymmetric
,T-body
,L-body
,L-space
,Euler->omega
,Euler->omega-body
,quaternion-state->omega-body
,quaternion-state->omega-space
,qw-state->L-body
,qw-state->L-space
,T-quaternion-state
-
-
-
#511 focuses on adding more rotations and efficiency to
sicmutils.quaternion
. Specifically:-
magnitude-sq
andmagnitude
are now more efficient. -
New functions to get to and from quaternions and various matrix representations:
from-rotation-matrix
,->rotation-matrix
,from-complex-matrix
,->complex-matrix
,from-4x4-matrix
,->4x4-matrix
-
New instances
ONE-matrix
,I-matrix
,J-matrix
,K-matrix
, matrix representations of the corresponding quaternion elements. -
Similar to the matrix elements, we also now have
ONE-tensor
,I-tensor
,J-tensor
,K-tensor
.
-
-
#503:
-
adds
sicmutils.mechanics.lagrange/Lagrangian
for building function signatures of Lagrangians. -
adds the
sicmutils.mechanics.time-evolution
namespace -
adds
sicmutils.mechanics.lagrange/L-axisymmetric-top
, more efficient than the version insicmutils.examples.top
-
Fleshes out
sicmutils.mechanics.hamilton
:-
New functions:
H-state?
,compatible-H-state?
,state->p
,momenta
,P
,literal-Hamiltonian-state
,L-state->H-state
,H-state->L-state
,H-state->matrix
,matrix->H-state
,make-Hamiltonian
,D-phase-space
,Hamiltonian->Lagrangian-procedure
,Hamiltonian->Lagrangian
,flow-derivative
,flow-transform
,standard-map-inverse
,F->K
,J-func
,T-func
,canonical-H?
,canonical-K?
,linear-function->multiplier
,Phi
,Phi*
,qp-canonical?
,polar-canonical-inverse
,two-particle-center-of-mass
,two-particle-center-of-mass-canonical
,transpose-function
,multiplicative-transpose
,symplectic-two-form
,canonical-transform?
,J-matrix
,symplectic?
-
F->CH
moves toF->CT
(F->CT
is now an alias) -
Legendre-transform-fn
becomesLegendre-transform-procedure
and gains more correctness tests, toggled on and off by the*validate-Legendre-transform?*
dynamic variable.
-
-
-
#508 adds
sicmutils.mechanics.noether
namespace, withNoether-integral
. -
#506 tidies up the build by removing unneeded reader conditionals and replacing renames like
core-=
with a proper require ofclojure.core
. -
#502 begins the port of the remaining items in the scmutils
mechanics
package over the Clojure. This PR focuses onsicmutils.mechanics.lagrange
, which contains functions from many files in the originalmechanics
folder.-
momentum-tuple
moves here fromsicmutils.mechanics.hamilton
-
New functions
->L-state
,->local
,->state
,state->n-dof
,time
,state->{q,qdot,qddot}
,coordinates
,velocities
,accelerations
,Q
,Qdot
,Qdotdot
,literal-Lagrangian-state
path->state-path
(alias for the existingGamma
),Rayleigh-dissipation
,qv->local-path
,Lagrange-equations-first-order
, (withLagrange-equations-1
alias),Lagrangian->power-loss
,T3-spherical
,L3-central
,Dt-procedure
and the wrapping operatorDt
,Euler-lagrange-operator
(withLagrange-equations-operator
andLE
aliases),generalized-LE
. -
Many of these are aliased into
sicmutils.env
. Ask if you think more should be there! -
many new built-in Lagrangians:
L-Kepler-polar
,L-coupled-harmonic
,L-sliding-pend
,L-pendulum
,L-two-particle
-
Lagrange-equations
,Lagrangian->acceleration
,Lagrangian->state-derivative
now take a dissipation function -
local-state-derivative
aliases the 1-arity version ofLagrangian->state-derivative
-
New
rectangular->polar
,polar->rectangular
,spherical->rectangular
andrectangular->spherical
that operate on coordinates, with associatedr->p
(new),p->r
,s->r
andr->s
(new).
-
-
#501 moves
elliptic-integrals
fromsicmutils.special.elliptical-test
sicmutils.special.elliptical
, as it's needed by the upcomingsicmutils.mechanics.pendulum
namespace.
Bug Fixes
-
#531:
-
Fixes a typo in one of the rules in
sicmutils.simplify.rules/expand-multiangle
, closing #530 -
Forces the subexpression walk in
pattern.rule/try-subexpressions
withdoall
-
Adds type hints to all remaining
Complex
calls in js, to fix issues with advanced compilation (thanks to @mhuebert for finding this) -
#515:
-
-
tidies up the
square
andcube
speedups thanks to a tip from GJS -
Converts more
(mul x x)
tosquare
in the derivatives of thesicmutils.generic
namespace. -
fixes a bug in the
numeric-zero?
check of exponent's derivative. -
#503:
-
Changes the default implementation of
square
andcube
for differentials to use(expt <> 2)
etc instead of(* <> <>)
.This is a big deal! For certain expressions there's a huge blowup when you square a big symbolic term, and taking the derivative of it TWICE is very messy.
With this change, differentials use the chain rule to calculuate the derivative of
$x^2$ as$2x*x'$ , instead of using the product rule and achieving a SECOND differentiatation of the same form and another multiplication:$xx' + x'x$ .Before a judicious
simplify
call I added, this change dropped the runtime of thesicmutils.sicm.ch3-test
suite down by 6x. After the simplify change insicmutils.examples.top
the tests were still 40% faster in that namespace. -
Fixes a bug where the
RationalFunction
cube implementation actually calledsquare
.
-
Misc
-
#532:
-
Removes the
potemkin
dependency by importing only what we need directly intosicmutils.util.def
. This makes sense since our versions add afork
call so that they work for ClojureScript as well. -
Moves all
examples
into the tests so that we don't ship them with the library. These will eventually be converted to Clerk notebooks. -
Removes the
hiccup
dependency. -
Upgrades
test.chuck
and removes all:include-macros true
calls for that library. Onlysame/ish
requires them now! -
Capitalizes the "Script" in ClojureScript everywhere it appears.
-
-
#531:
- Drops cljsjs dependencies in favor of
deps.cljs
entries
- Drops cljsjs dependencies in favor of