generator zadań z fizyki, z prądu stałego

Zrobiłem generator zadań z fizyki, z prądu stałego. Zna on pięć wzorów wiążących ze sobą siedem wielkości fizycznych:

Program losuje kilka wielkości żeby były dane, jedną wielkość żeby była szukaną, znajduje najkrótszą ścieżkę w grafie tworzonym przez te wzory, losuje wartości tych wielkości danych - i prezentuje to jako zadanie z fizyki.

Przykładowy wynik wygląda tak:

Do źródła stałego napięcia podłączono grzałkę. Płynie przez nią stały prąd.

Dane:
  czas: 17 s
  energia: 5008 J
  ładunek: 491 C
  moc: 251 W

Szukane: opór (0.30 Ω)

--- Schemat rozwiązania ---
Krok 1: do wzoru "Q=I·t" wstaw Q oraz t, wylicz I.
Krok 2: do wzoru "P=U·I" wstaw P oraz I, wylicz U.
Krok 3: do wzoru "U=I·R" wstaw U oraz I, wylicz R.

Jeśli chcesz użyć tego programu, to tutaj masz wersję webową, napisaną w javaskrypcie (więc najszybszą do użycia), a tutaj masz wersje napisaną w Pythonie.

Program wygenerowałem zaczynając od tego prompta.

Oto graf z wzorami:


physics problem generator for direct current

I made a physics problem generator for direct current. It knows five formulas linking seven physical quantities:

The program selects several quantities to be given, one quantity to be found, determines the shortest path in the graph formed by these formulas, draws values for the given quantities, and presents it as a physics problem.

A sample result looks like this:

A heater is connected to a constant voltage source. A constant current flows through it.

Given:
  energy: 8452 J
  charge: 97 C
  power: 953 W
  time: 5 s

Find: resistance (2.53 Ω)

--- Solution scheme ---
Step 1: substitute Q and t into the formula "Q=I·t", calculate I.
Step 2: substitute P and I into the formula "P=U·I", calculate U.
Step 3: substitute U and I into the formula "U=I·R", calculate R.

If you want to use this program, here is the web version, written in JavaScript (thus the fastest to use), and here is the Python version.

I generated the program starting from this prompt.

Here is the graph with the formulas: