28

2

Ohm's law tells us that the current (I) in amps flowing through a resistance (R) in Ohms when a voltage (V) is applied across it is given as follows:

```
V = I / R
```

Similarly the power (P) in watts dissipated by that resistance is given by:

```
P = V * I
```

By rearrangement and substitution, formulae may be derived for calculating two of these quantities when any of the other two is given. These formulae are summarised as follows (note this image uses `E`

instead of `V`

for volts):

Given an input of any two of these quantities in a string, output the other two.

- Input numbers will be decimals in whatever format is appropriate for your language. Precision should be to at least 3 decimal places. (IEEE 754-2008 binary32 floats are sufficient.)
- Each input number will be suffixed with a unit. This will be one of
`V A W R`

for Voltage, Amperage, Power and Resistance (or the equivalent lowercase). Additionally, you may use`Ω`

instead of`R`

. The units will not have any decimal prefixes (Kilo-, milli-, etc). - The two input quantities will be given in any order in one string, separated by a single space.
- Input quantities will always be real numbers greater than 0.
- Output will be in the same format as input.
- Equation-solving builtins are disallowed.

### Example Inputs

```
1W 1A
12V 120R
10A 10V
8R 1800W
230V 13A
1.1W 2.333V
```

### Corresponding Outputs

```
1V 1R
0.1A 1.2W
1R 100W
120V 15A
2990W 17.692R
0.471A 4.948R
```

It should be noted that solutions to this challenge will effectively be self-inverses. In other words if you apply a solution to input `A B`

and get output `C D`

, then apply a solution to input `C D`

, then the output should be `A B`

again, though possibly out of order and perturbed due to FP rounding. So test inputs and outputs may be used interchangeably.

Can we output all 4 values? – CalculatorFeline – 2016-03-08T21:58:40.967

@CatsAreFluffy No - input and output will always both be exactly 2 values. – Digital Trauma – 2016-03-08T22:03:04.400

12This may actually be the most immediately descriptive title I've ever seen for a challenge. – Alex A. – 2016-03-09T01:23:36.837

5@AlexA. yes, I was trying to think up something catchy and exciting -

electrifying, if you will. But I came up short - Captain Obvious won the day – Digital Trauma – 2016-03-09T01:27:39.377