AI + WebGPU for mathematical exploration

Create Math and Physics Simulations with AI and WebGPU

Describe a phenomenon—from orbital mechanics and electromagnetism to fluid dynamics and quantum physics—and turn it into an interactive GPU simulation in your browser.

GPUSims handles WebGPU resources, pipelines, rendering, and boilerplate so that AI can concentrate on the mathematical model and simulation logic.

Try a prompt: Create a schema for an N-body simulation.

From an idea to a running model

Make advanced simulations more approachable

AI can generate simulation code for fields such as classical mechanics, electromagnetism, fluid dynamics, statistical physics, and quantum mechanics. GPUSims provides the structure that helps the AI produce code that can actually be compiled, executed, inspected, and improved.

01

Describe the phenomenon

Begin with a natural-language request for the physical system, controls, and visual result you want to explore.

02

Generate the simulation

AI creates a declarative schema and implements the mathematical logic inside an app-generated WGSL skeleton.

03

Run, inspect, and learn

Execute the simulation, examine numerical and visual output, correct problems, and generate an explanatory article.

Why the architecture works

Separate WebGPU orchestration from simulation logic

WebGPU setup is powerful but complex. Instead of asking AI to build every buffer, binding, pipeline, and renderer from scratch, GPUSims divides the work into four clear stages.

  1. Schema

    Declare the blueprint

    AI defines GPU resources, shader passes, user controls, and execution order in a JSON-like schema.

  2. Skeleton

    Generate safe WGSL structure

    GPUSims converts the schema into shader skeletons with matching structs, bindings, and entry points.

  3. Logic

    Implement the mathematics

    AI fills in the core equations and algorithms without having to recreate the surrounding WebGPU infrastructure.

  4. Execution

    Run in the browser

    GPUSims compiles the shaders, executes the GPU pipeline, renders the result, and exposes controls and readback values.

The key idea: The app manages the machinery. AI focuses on translating mathematics and physics into executable shader logic.

Two ways to build

Stay in control or automate the whole pipeline

Interactive

Guided AI Workflow

Move step by step between GPUSims and your AI chat. This workflow is transparent, editable, and especially useful for learning.

  1. Copy the GPUSims system prompt into the AI chat.
  2. Ask the AI to generate a simulation schema.
  3. Paste the schema into GPUSims and generate the WGSL skeleton.
  4. Ask the AI to implement the skeleton, then run the simulation.

Execution is only the beginning

Debug code and question the result

Code-error correction

If a schema or shader fails, copy the reported error to the AI. It can revise the schema or WGSL code and continue the iteration.

Fix this error.

Numerical inspection

Readback values can be returned from GPU memory and examined to catch mistakes that are not obvious from the animation alone.

Visual inspection

Capture the rendered canvas and ask the AI to evaluate whether the visible behavior is consistent with the intended model.

Is this result physically plausible?

AI-assisted checks are useful for iteration, but they are not formal scientific verification. Complex or high-stakes models still require knowledgeable human review.

A visual path into difficult subjects

Learn through simulation, explanation, and questions

Abstract equations become easier to approach when you can observe and manipulate their behavior. After a simulation is complete, AI can write an article explaining the visible phenomenon, mathematical background, and code implementation.

The article is a starting point rather than the end: continue asking questions about any equation, algorithm, or unexpected result until the model becomes understandable.

Generated learning article

  • Observable phenomena
  • Mathematical background
  • Numerical method
  • WGSL implementation
  • Questions for further exploration

Technical scope

WebGPU strengths and limitations

Designed for browser-based GPU computing

WebGPU enables parallel computation and high-performance visualization without requiring a native desktop application.

Primarily single precision

Simulations generally use 32-bit floating-point values (f32), not the 64-bit precision common in scientific computing.

No traditional numerical libraries

Libraries such as LAPACK are not available directly, so required algorithms must be implemented for the GPU architecture.

A bridge toward CUDA concepts

The same foundations—parallel execution, workgroups, buffers, and memory access—provide useful preparation for more advanced GPU computing.

Begin with one idea

What physical world would you like to build?

Start with a familiar system, inspect what the AI creates, and use the simulation as a path into deeper mathematics and physics.

Vibe Coding Workflow
  1. Click to copy the System Prompt, paste & run in the AI chat.

  2. Enter the instruction to create a schema in the AI chat.


    Example:
    Create a schema for an N-body simulation.
  3. Copy the schema created by the AI and paste it below.

  4. Click to generate and copy the WGSL Skeleton, paste & run in the AI chat..

  5. Copy the finalized WGSL code by the AI and paste it below.



  6. Click to compile and launch your WebGPU pipeline.

GPU Fatal Error

You may copy the error message, paste it into the chat, and ask the AI ​​to fix the error.


    

Sign In

Set Your Nickname

Please choose a nickname that will be visible to other users.

Only letters, numbers, spaces, hyphens (-), underscores (_), and periods (.) are allowed.