calculus.sls 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. ;;; Copyright © 2016 Federico Beffa
  2. ;;;
  3. ;;; This program is free software; you can redistribute it and/or modify it
  4. ;;; under the terms of the GNU General Public License as published by
  5. ;;; the Free Software Foundation; either version 3 of the License, or (at
  6. ;;; your option) any later version.
  7. ;;;
  8. ;;; This program is distributed in the hope that it will be useful, but
  9. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;;; GNU General Public License for more details.
  12. ;;;
  13. ;;; You should have received a copy of the GNU General Public License
  14. ;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Code
  16. #!chezscheme
  17. (library (scmutils calculus)
  18. (export
  19. ;;;./scmutils/calculus/dgutils.scm
  20. diffop-name s:sigma/r s:sigma/r/l s:sigma s:sigma/l
  21. simplify-numerical-expression with-incremental-simplifier
  22. ;;;./scmutils/calculus/indexed.scm
  23. argument-types has-argument-types? declare-argument-types!
  24. index-types has-index-types? declare-index-types!
  25. typed->indexed indexed->typed
  26. i:outer-product count-occurrences i:contract
  27. list-with-inserted-coord typed->structure
  28. structure->typed
  29. maybe-simplify-coeff-functions simplify-coeff-function
  30. simplify-coeff-functions? zero-manifold-function?
  31. one-manifold-function? manifold-function-cofunction?
  32. ;;;./scmutils/calculus/manifold.scm
  33. manifold-point
  34. make-manifold-point transfer-point get-coordinate-rep
  35. get-coordinates my-manifold-point? c:generate c:lookup
  36. specify-manifold patch attach-patch
  37. coordinate-system coordinate-system-at make-manifold
  38. attach-coordinate-system
  39. coordinate-system-dimension frame?
  40. chart point typical-point typical-coords
  41. corresponding-velocities install-coordinates
  42. *saved-environment-values* R^n R^n-type R1
  43. R1-rect the-real-line R2 R2-rect R2-polar R3 R3-rect R3-cyl
  44. R4 R4-rect R4-cyl spacetime spacetime-rect spacetime-sphere
  45. S^2-type S^2-coordinates
  46. S2 S^n-type S^n-coordinates
  47. S1 S1-circular S1-tilted S2p S2p-spherical S2p-tilted S3
  48. S3-spherical S3-tilted S^n-stereographic
  49. S2p-stereographic S2p-Riemann S^n-gnomic S1-gnomic
  50. S2p-gnomic S3-gnomic S3-stereographic SO3-type SO3
  51. Euler-angles alternate-angles literal-scalar-field
  52. zero-coordinate-function literal-manifold-function
  53. zero-manifold-function one-manifold-function
  54. constant-manifold-function S2-Riemann
  55. ;;;./scmutils/calculus/vector-fields.scm
  56. vector-field? procedure->vector-field vector-field-procedure
  57. components->vector-field vector-field->components vf:zero
  58. vf:zero-like vf:zero? literal-vector-field
  59. coordinate-basis-vector-field-procedure
  60. coordinate-basis-vector-field
  61. coordinate-system->vector-basis
  62. basis-components->vector-field
  63. vector-field->basis-components coordinatize evolution
  64. ;;;./scmutils/calculus/form-fields.scm
  65. form-field? 1form-field? procedure->1form-field ff:zero
  66. ff:zero-like ff:zero? 1form-field-procedure
  67. components->1form-field 1form-field->components
  68. literal-1form-field coordinate-basis-1form-field-procedure
  69. coordinate-basis-1form-field
  70. coordinate-system->1form-basis basis-components->1form-field
  71. 1form-field->basis-components function->1form-field
  72. differential-of-function
  73. ;;;./scmutils/calculus/basis.scm
  74. coordinate-basis? coordinate-system->basis basis->coordinate-system basis?
  75. make-basis basis->vector-basis basis->1form-basis
  76. basis->dimension contract vector-basis->dual
  77. make-constant-vector-field Jacobian
  78. ;;;./scmutils/calculus/wedge.scm ; OK
  79. wedge get-rank rank->arity procedure->nform-field Alt
  80. ;;;./scmutils/calculus/exterior-derivative.scm
  81. exterior-derivative-procedure d
  82. ;;;./scmutils/calculus/Lie.scm ; OK
  83. Lie-derivative
  84. ;;;./scmutils/calculus/interior-product.scm ; OK
  85. interior-product
  86. ;;;./scmutils/calculus/ode.scm
  87. Lie-D
  88. ;;;./scmutils/calculus/maps.scm ; OK
  89. pullback-function pushforward-function differential-of-map
  90. differential pushforward-vector literal-manifold-map
  91. vector-field->vector-field-over-map
  92. form-field->form-field-over-map
  93. basis->basis-over-map
  94. pullback-form pullback-vector-field pullback
  95. ;;;./scmutils/calculus/covariant-derivative.scm ; OK
  96. covariant-derivative covariant-derivative-ordinary
  97. covariant-derivative-function
  98. covariant-derivative-vector
  99. covariant-derivative-form
  100. covariant-derivative-argument-types
  101. covariant-differential Cartan->Christoffel
  102. Christoffel->Cartan Cartan-transform symmetrize-Christoffel
  103. symmetrize-Cartan make-Cartan Cartan? Cartan->forms
  104. Cartan->basis make-Christoffel Christoffel?
  105. Christoffel->symbols Christoffel->basis
  106. Cartan->Cartan-over-map
  107. geodesic-equation parallel-transport-equation
  108. ;;;./scmutils/calculus/curvature.scm ; OK
  109. Riemann-curvature Riemann Ricci
  110. torsion-vector torsion curvature-components
  111. ;;;./scmutils/calculus/metric.scm ; OK
  112. coordinate-system->metric-components
  113. embedding-map->metric-components coordinate-system->metric
  114. coordinate-system->inverse-metric
  115. make-metric literal-metric
  116. components->metric metric->components
  117. metric->inverse-components metric:invert
  118. metric-over-map lower
  119. vector-field->1form-field drop1 raise
  120. 1form-field->vector-field raise1 drop2 raise2
  121. trace2down trace2up sharpen S2-metric
  122. ;;;./scmutils/calculus/connection.scm
  123. make-Christoffel-1 metric->Christoffel-1 metric->Christoffel-2
  124. literal-Christoffel-names literal-Christoffel-1
  125. literal-Christoffel-2 literal-Cartan structure-constant
  126. metric->connection-1 metric->connection-2
  127. ;;;./scmutils/calculus/gram-schmidt.scm ; OK
  128. Gram-Schmidt completely-antisymmetric
  129. ;;;./scmutils/calculus/hodge-star.scm ; OK
  130. Hodge-star orthonormalize
  131. ;;;./scmutils/calculus/tensors.scm ; OK
  132. tensor-test literal-field
  133. ;;;./scmutils/calculus/vector-calculus.scm
  134. gradient curl divergence Laplacian
  135. coordinate-system->Lame-coefficients
  136. coordinate-system->orthonormal-vector-basis
  137. ;;;./scmutils/calculus/SR-boost.scm ; OK
  138. make-4tuple 4tuple->ct 4tuple->space proper-time-interval
  139. proper-space-interval general-boost general-boost2
  140. extended-rotation
  141. ;;;./scmutils/calculus/SR-frames.scm ; OK
  142. make-SR-coordinates SR-coordinates? SR-name coordinates->event
  143. event->coordinates boost-direction v/c
  144. coordinate-origin make-SR-frame base-frame-point base-frame-chart
  145. the-ether add-v/cs add-velocities
  146. )
  147. (import (except (rnrs base) error assert
  148. inexact? zero? sqrt exp log sin cos tan
  149. asin acos abs = < <= > >= + - * / expt gcd make-rectangular
  150. make-polar real-part imag-part magnitude angle
  151. atan apply)
  152. (rename (only (rnrs base) string<?) (string<? string:<?))
  153. (rnrs eval)
  154. (rnrs mutable-pairs)
  155. (rnrs io simple)
  156. (rnrs io ports)
  157. (rnrs r5rs)
  158. (rnrs conditions)
  159. (rnrs control)
  160. (rnrs syntax-case)
  161. (rename (except (rnrs lists) filter) (remq delq) (remv delv))
  162. (except (mit core) assert) ; assert is defined in general/logic-utils.scm
  163. (except (mit arithmetic) conjugate)
  164. (mit list)
  165. (except (mit vector) flo:subvector) ; flo:subvector in
  166. ; numerics/signal/cph-dsp/flovec.scm
  167. (mit curry)
  168. (except (mit arity) procedure-arity) ; use version in apply-hook
  169. (mit apply-hook)
  170. (mit hash-tables)
  171. (mit environment)
  172. (mit streams)
  173. (only (srfi :1) reduce reduce-right delete any every lset-adjoin
  174. make-list append-map)
  175. (srfi :9)
  176. (srfi :14) ; char-set
  177. (rename (srfi :41) (stream-cons cons-stream)
  178. (stream-fold stream-accumulate))
  179. (only (chezscheme) include import compile module eval-when
  180. last-pair environment? scheme-environment
  181. copy-environment interaction-environment
  182. make-parameter parameterize
  183. iota reverse! list-head random
  184. waiter-write console-output-port with-output-to-string
  185. void vector-copy)
  186. (scmutils base)
  187. (scmutils generic)
  188. (except (scmutils mechanics) Lie-derivative))
  189. ;;; FBE: used in calculus/manifold.scm
  190. (define user-generic-environment (interaction-environment))
  191. ;;; FBE: from mechanics
  192. ;;(include "./scmutils/mechanics/rotation.scm")
  193. ;;; **** calculus **********************************
  194. (include "./scmutils/calculus/dgutils.scm")
  195. (include "./scmutils/calculus/indexed.scm")
  196. (include "./scmutils/calculus/manifold.scm")
  197. (include "./scmutils/calculus/vector-fields.scm")
  198. (include "./scmutils/calculus/form-fields.scm")
  199. (include "./scmutils/calculus/basis.scm")
  200. (include "./scmutils/calculus/wedge.scm")
  201. (include "./scmutils/calculus/exterior-derivative.scm")
  202. (include "./scmutils/calculus/Lie.scm")
  203. (include "./scmutils/calculus/interior-product.scm")
  204. (include "./scmutils/calculus/ode.scm")
  205. (include "./scmutils/calculus/maps.scm")
  206. (include "./scmutils/calculus/covariant-derivative.scm")
  207. (include "./scmutils/calculus/curvature.scm")
  208. (include "./scmutils/calculus/metric.scm")
  209. ;; Connection derived from metric
  210. (include "./scmutils/calculus/connection.scm")
  211. ;; Hodge star depends on metric
  212. (include "./scmutils/calculus/gram-schmidt.scm")
  213. ;; gram-schmidt runs very slowly!
  214. (include "./scmutils/calculus/hodge-star.scm")
  215. (include "./scmutils/calculus/tensors.scm")
  216. (include "./scmutils/calculus/vector-calculus.scm")
  217. ;;(include "./scmutils/calculus/so3" SO3-environment) ; FBE
  218. ;; special relativity
  219. ;;; FBE in '(scmutils base)
  220. ;;(include "./scmutils/calculus/frame-maker" scmutils-base-environment)
  221. (include "./scmutils/calculus/SR-boost.scm")
  222. (include "./scmutils/calculus/SR-frames.scm")
  223. )