Developer Platform
Python4Physics REST API
Programmatically access over 500+ computational physics codes, mathematical algorithms, and scientific simulations. Integrate directly with JupyterLab, Python clients, and research platforms.
1. Global Search API
Full-text instant search across 345 Python algorithms, 49 GNUplot visualizations, and 115 LaTeX formulations.
GET /api/search.php?q=Runge
2. Programs Query API
Retrieve structured code, mathematical formulations, and explanations by language, chapter, and topic.
GET /api/programs.php?lang=python&menu_id=12
3. Jupyter (.ipynb) Exporter
Dynamically generate and download standard Jupyter Notebooks with markdown theory and runnable code cells.
GET /api/export.php?id=350&format=ipynb
Live API Explorer
Test API queries directly from your browser to preview real-time JSON responses:
Status: Ready
Client Code Snippets
import requests
BASE_URL = "https://www.v2.python4physics.in/api"
# 1. Search for differential equation programs
search_res = requests.get(f"{BASE_URL}/search.php", params={"q": "Runge-Kutta"}).json()
print(f"Found {search_res['count']} results")
# 2. Fetch specific Python program
if search_res['results']:
first_prog = search_res['results'][0]
prog_id = first_prog['id']
detail = requests.get(f"{BASE_URL}/programs.php", params={"lang": "python", "id": prog_id}).json()
print("Code:\n", detail['program']['content'])
# 3. Download as Jupyter Notebook
notebook = requests.get(f"{BASE_URL}/export.php", params={"id": prog_id, "format": "ipynb"})
with open("simulation.ipynb", "wb") as f:
f.write(notebook.content)
print("Saved simulation.ipynb!")
const baseUrl = "https://www.v2.python4physics.in/api";
// Search algorithms
async function searchPhysics(query) {
const res = await fetch(`${baseUrl}/search.php?q=${encodeURIComponent(query)}`);
const data = await res.json();
console.log("Matching algorithms:", data.results);
return data.results;
}
searchPhysics("Fourier");
# Search across 509 programs
curl "https://www.v2.python4physics.in/api/search.php?q=harmonic"
# Fetch Python Chapter 12 ODE programs
curl "https://www.v2.python4physics.in/api/programs.php?lang=python&menu_id=12"
# Export Program #350 as Jupyter Notebook (.ipynb)
curl -O -J "https://www.v2.python4physics.in/api/export.php?id=350&format=ipynb"