Web Analytics
Open Source Physics (OSP) – Open-Source Physics

OSP (Open Source Physics) – Open-Source Physics

Open-Source Physics (OSP) is a community-driven project, originally supported by the National Science Foundation and the American Association of Physics Teachers, whose goal is to provide free, open-source curricular materials and software tools for teaching and learning physics through computational modeling. compadre.org

Its flagship resources include:

  • Tracker – a video-analysis and modeling tool that allows students to track objects frame by frame and build Newtonian models directly on the video. opensourcephysics.github.io
  • EJS (Easy Java Simulations) – a framework for creating interactive Java (and now JavaScript) simulations without deep programming expertise. compadre.org
  • Curriculum Packages – collections of simulations, worksheets, and guided activities organized by topic.
  • Programming Libraries – Java (and JavaScript) libraries for reusable components to build custom computational-physics applications.

OSP has grown from a simple Java simulation framework into a comprehensive, web-accessible ecosystem of tools for learning and researching physics. Its history mirrors the evolution of educational technology: from desktop Java applications to modern JavaScript cloud-based solutions.

You can create physical-phenomenon simulations as desktop applications in Java, using Swing and AWT for the graphical interface; this capability has been significantly extended by additional libraries in org.opensourcephysics.

Overview of Core Classes in org.opensourcephysics.display


1. Dataset

What it does: Stores and displays a series of points (x, y).

Usage: Use it to “feed” data into a plot and have it automatically drawn on a drawing panel (e.g. PlottingPanel).

Key methods/features:

  • add(x, y) — adds a new data point.
  • clear() — clears all data.
  • It also extends AbstractTableModel, so the data can be displayed in a Swing table.

2. PlottingPanel

What it does: A panel for drawing Cartesian plots with axes, title, and multiple datasets.

Usage: The main class for creating 2D plots. Instantiate with axis labels and title, call addDrawable(dataset), then render() or enable automatic refreshing.

Key methods/features:

  • setPreferredMinMax(xmin, xmax, ymin, ymax) — manually set axis ranges.
  • createPolarType1(...) — static constructors for special panel types (polar plot, alternative axis styles).

3. DrawingPanel

What it does: A general panel for 2D drawing of any Drawable objects (lines, circles, text, datasets, etc.).

Usage: If you don’t want the full plot frame, you can draw shapes directly by adding Drawable objects with addDrawable(...).

Key methods:

  • addDrawable(Drawable d)
  • setPreferredMinMax(...)
  • clearDrawables()

4. Trail

What it does: A specialized Drawable that draws the trajectory of a point through a series of steps.

Usage: Ideal for motion simulations where you want to display the path of an object over time.


5. DataFunction

What it does: A Dataset that computes values by evaluating a function f(x).

Usage: Use it to plot an analytic function rather than discrete data points.


6. XMLControl

What it does: A tool for serializing and loading objects to and from XML.

Usage: Enables saving simulation settings, model parameters, or even complete Dataset/PlottingPanel instances in human-readable XML files.


7. Numerical Classes: ODE and RungeKutta

What they do: Base classes for solving ordinary differential equations (ODEs).

Usage: In dynamics simulations (e.g., the planetary system or harmonic oscillator) use implementations like RK4 or EulerSolver, which require you to implement the ODE interface with getState() and getRate() methods.

Typical Usage Workflow

  1. Model (numerics): Write a class implementing org.opensourcephysics.numerics.ODE or a simpler numerical method.
  2. Visualization: Create one or more Dataset (or Trail) objects and add them to a PlottingPanel.
  3. Control & interaction: Use XMLControl to save/load parameters, connect GUI controls (sliders, buttons) to model variables, and call panel.render() on each simulation step.

How Active Is OSP Today?

Recent Updates:

  • Web EJS and Tracker Online (a pure-JavaScript version of Tracker) were released in early 2025, enabling OSP materials to run immediately on Chromebooks and tablets without requiring a Java install.
  • New curricular materials continue to be added (e.g., “Using Tracker Online, Web EJS, and ComPADRE” on March 24, 2025; “Acoustics Supplement” on April 15, 2025).

Community Engagement:

  • Multiple new discussion threads appear each month on the OSP forums (most recently in May 2025), indicating an active user base exchanging technical questions and answers.
  • Tracker alone has over 2 million users in 31 languages, with version 6 released in February 2025.

Broader Ecosystem:

  • The term “open-source physics” now also includes high-performance C++ engines like Project Chrono and AI-driven physics simulators (e.g., NVIDIA Newton), reflecting the growing importance of open tools in both education and research.

Conclusion: OSP remains highly relevant in 2025 as a leading repository for computational physics education. Its tools are actively maintained and evolving (with JS-based versions for modern browsers), thousands of educators worldwide rely on its simulations and video-analysis software, and the community continually contributes new materials and support.

History of OSP

  1. Origins (late 1990s): The idea emerged under the leadership of Prof. Wolfgang Christian and Dr. Francisco Esquembre at Davidson College, aiming to enrich physics education with interactive simulations and video analysis.
  2. First-generation tools (2001–2005):
    • Easy Java Simulations (EJS) appeared around 2003: a Java environment for quickly creating and customizing physics simulations.
    • NSF and AAPT began supporting development and dissemination.
  3. Tracker & community growth (2006–2012):
    • 2006: Tracker was released – a tool for motion video analysis.
    • By 2010: the ComPADRE forum and repository expanded, lowering barriers for global participation.
  4. Shift to JavaScript and Web EJS (2015–2020):
    • EJS gained a Web EJS version (pure-JS), allowing simulations to run directly in modern browsers.
    • Tracker Online (JS edition) removed the need for a desktop Java runtime.
  5. Today’s phase (2021–2025):
    • OSP now includes Web EJS, Tracker Online, and a rich set of guides, exercises, and ready-made simulations.
    • A global community of teachers and students regularly publishes new resources and updates.

Useful Resources

Main Tools & Platforms:

Documentation & Tutorials:

Ready-Made Simulations & Curriculum Units:

Communities & Forums:

JavaScript (Web EJS) vs. OSP Java Libraries

Most of today’s new OSP simulations use JavaScript (Web EJS) instead of the legacy Java platform, for several reasons:

  1. Browser support:
    • Java applets or desktop Java apps require a JRE or plugin, which modern browsers no longer support.
    • JavaScript simulations run directly in any modern browser without extra installs.
  2. Distribution & access:
    • Web EJS simulations launch via a single URL on tablets and Chromebooks.
    • Java packages often get blocked by security settings.
  3. Tools & libraries:
    • OSP Java libraries (org.opensourcephysics) remain powerful, but development has largely shifted to JS (EJSS, p5.js + ports).
    • Java versions are still maintained (Tracker Desktop, EJS Eclipse plugin), but see fewer new extensions.
  4. Performance & ecosystem:
    • JS runtimes (V8, SpiderMonkey) + WebGL can render complex 3D scenes effectively.
    • Fast development cycle, rich npm ecosystem, easy integration with web services and frameworks.

Recommendations

  • For new projects and curricular materials: adopt JavaScript/Web EJS.
  • If you already have substantial Java code: plan a gradual migration to JS.
  • Hybrid approach: use Tracker Desktop (Java) for video analysis, and Web EJS or p5.js + OSP-JS libraries for simulations.

Conclusion: Although OSP’s Java libraries are not deprecated, modern simulation development is predominantly in JavaScript. For maximum accessibility and long-term sustainability, focusing on Web EJS/JS solutions is best.