LPFP 1.1.5 → 1.2.1
raw patch · 2 files changed
+12/−6 lines, 2 files
Files
- LPFP.cabal +4/−4
- src/LPFP/ElectricField.hs +8/−2
LPFP.cabal view
@@ -1,12 +1,12 @@ name: LPFP-version: 1.1.5+version: 1.2.1 synopsis: Code for the book Learn Physics with Functional Programming description: Haskell code to help the user learn mechanics of one particle, mechanics of multiple interacting particles, and electromagnetic theory. homepage: https://lpfp.io author: Scott N. Walck maintainer: walck@lvc.edu-copyright: 2024 Scott N. Walck+copyright: 2024-2025 Scott N. Walck license: BSD3 license-file: LICENSE build-type: Simple@@ -37,8 +37,8 @@ base >= 4.7 && < 5, containers >= 0.6.7 && < 0.8, Vis >= 1.0.0 && < 1.1,- diagrams-cairo >= 1.4.2 && < 1.5,- diagrams-lib >= 1.4.6 && < 1.5,+ diagrams-cairo >= 1.4.2 && < 1.6,+ diagrams-lib >= 1.4.6 && < 1.6, gloss >= 1.13.2 && < 1.14, gnuplot >= 0.5.7 && < 0.6, linear >= 1.22 && < 1.24
src/LPFP/ElectricField.hs view
@@ -195,8 +195,14 @@ in zip ps (drop 1 ps) linSpaced :: Int -> R -> R -> [R]-linSpaced n x0 x1 = take (n+1) [x0, x0+dx .. x1]- where dx = (x1 - x0) / fromIntegral n+linSpaced n x0 x1+ = let dx = (x1 - x0) / fromIntegral n+ try = take n [x0, x0+dx .. x1] ++ [x1]+ in if length try == n + 1+ then try+ else if length try == 1+ then replicate (n + 1) x0+ else error "linSpaced is facing difficulties" surfaceSample :: Int -> Surface -> [(Position,Vec)] surfaceSample n s = [(triCenter tri, triArea tri) | tri <- triangles n s]