r/swift • • 10h ago

Project Using Swift for scientific computing — building a nonlinear differential equation solver with Accelerate and LAPACK

Post image
13 Upvotes

I've been developing Numerical Solver, a native scientific computing application for macOS and iOS, using Swift and SwiftUI.

One of the most interesting challenges has been implementing a numerical solver for nonlinear boundary value problems.

The numerical engine combines:

  • Newton–Raphson iterations
  • Finite difference discretization
  • Symbolic computation of analytical Jacobians
  • LAPACK through Apple's Accelerate framework
  • Automatic boundary-layer detection
  • Adaptive mesh refinement

One important architectural improvement was moving from dense Jacobian matrices using dgesv_ to banded matrices using dgbsv_.

By reorganizing the unknowns and exploiting the structure of the discretized differential equations, I was able to avoid storing and solving unnecessarily large dense matrices — especially as adaptive mesh refinement increases the number of grid points around steep boundary layers.

Swift is often associated with application development, but I've found it very capable for implementing numerical algorithms as well.

I'm currently porting the updated numerical engine to the Windows version of the application, which brings its own interesting challenges, particularly replacing Accelerate.

The latest macOS version is now available.

Website: https://numericalsolver.com

I'm curious whether other developers here are using Swift for scientific computing or numerical analysis:

  • What has your experience been with Accelerate and LAPACK interoperability in Swift?
  • Have you found clean patterns for memory management and performance in tight numerical loops?

r/swift • • 2h ago

AVAudioPlayer is very laggy, am I using it wrong or should I look for another solution?

Post image
2 Upvotes

The sound is firing off every 100ms and it is causing lag in animations. Am I doing something wrong or should I look for a different way to play this audio?


r/swift • • 10h ago

Tutorial iOS 27.1: DeviceHinge

Thumbnail
antongubarenko.substack.com
0 Upvotes

r/swift • • 18h ago

Is there a way to disable tapping on an already selected tab?

0 Upvotes

I want to prevent the double tap quirk that takes you to the top of a view.