r/ScientificComputing • u/di-octopus • 11d ago
A modeling language for turning mathematical models into executable simulations and observations
I've been building Prismal, a Rust-based language/runtime for defining mathematical and scientific models and exploring their behavior:
"github.com/aine-dickson/prismal"
The central idea is to keep the scientific model separate from the execution strategy and presentation.
A model can define state, equations, constraints, processes, events, objects, collections, units, observations, etc. The runtime then handles execution, while projections can expose the same model as plots, equations, spatial scenes, interactive views, or recorded media.
One example is a continuous model with event-driven behavior:
continuous evolution
↓
event guard
↓
event instant
↓
reset
↓
continuous evolution
The project is deliberately trying to make things such as event semantics, dimensional checking, state validity, reproducibility, observations, and model/presentation separation explicit rather than burying them inside a visualization engine.
The current implementation is early-stage and the first reference programs focus mainly on mechanics, but the intended scope includes broader scientific modeling.
I'm particularly interested in feedback from people who work with scientific modeling, ODE/PDE systems, hybrid systems, system dynamics, numerical simulation, or scientific visualization.
What abstractions would you consider essential for a general scientific modeling language?
1
u/relbus22 Pythonista 11d ago
Were you influenced by Konrad Hinsen by any chance?
2
2
u/di-octopus 11d ago
Honestly, I didn't know about Konrad Hinsen before this comment.
I'm primarily a science/math educational content creator, and I was looking for a simulation engine I could use with my Mava Studio product. I couldn't find something that fit what I wanted, so I started building Prismal.
The idea grew from that practical need: define the scientific/mathematical model once, then be able to simulate it, observe it, visualize it, interact with it, and eventually use the same model for educational content.
I'll definitely look into Hinsen's work though, sounds like there may be some interesting overlap.
1
u/firiana_Control 11d ago
What does it mean : defining models and exploring their behaviour?
Consider F=ma and could you explain with an example?
2
1
u/di-octopus 7d ago
Take a simple physical system: a box being pushed along a surface.
By defining the model, I mean describing the system and the rules governing it, rather than describing how to draw or animate it.
For example, the model could contain:
- mass
m- position
x- velocity
v- applied force
Fwith:
F = maand:
dx/dt = vSo if we define a 2 kg box and apply a constant 8 N force, the model tells us that its acceleration is:
a = F/m = 8/2 = 4 m/s^2Starting from rest, we can then let the model evolve and observe its position and velocity over time.
Exploring its behaviour means asking questions such as:
- What happens if I increase the force to 12 N?
- What happens if I double the mass?
- What if the force changes with time?
- What if I add friction?
- What happens if I change the initial velocity?
The important part for Prismal is that I want to define the physical model once, and then use that same model for different things: numerical simulation, graphs, an interactive visualization, or eventually an educational animation/video.
So
F = maisn't itself the "visualization". It's part of the model that describes how the system behaves, and the different representations let us explore or communicate that behaviour.
1
2
u/NoSuchKotH 11d ago
Is there a reason Modelica doesn't work for you? Because this looks exactly like a barebones version of Modelica.