Open GeorgesOatesLarsen opened 4 years ago
This is a pretty tricky one, honestly.
To me, it would seem wise to completely generalize the problem to all possible circuits of three resistors and a single voltage source. That is going to require some fairly generalized circuit handling.
In general: Randomly pick one of the possible circuits of 3 resistors, and ask it to generate nice values for its resistors and voltage. (define nice as integer values of resistances that would allow for all currents in the system and the voltage source voltage to be integral in nature.
Pick a random piece of information not to give: A resistance, a voltage, or a current. Use sympy and the associated system of equations to identify a set of four non-redundant variables that could be provided to allow the test-taker to solve for the variable in question. Provide these variables. False answers can be based on the prime factorizations of all provided information.
Update: This is implemented! Some minor bugs, such as an occasional crash, and some minor visual defects. Neither are worth fixing ATM. Will close this once pushed
Thanks to Joe Shields for coming up with a nice way to generate integer solutions for these circuits
Our first circuits fundamentals problem : - )
Inspiration:
(figure shows 20Vvoltage source, in series with 1ohm resistor, branching from there to two resistors in parallel, 1ohm and 2ohm respectively (with the 2 ohm resistor indicated as the resistor of interest), with both resistors immediately merging to a single branch onto the negative terminal of the voltage source).