Rule of 3
Verb: ruleOf3
Applies the rule of three, according to its quantities, and returns the unknown value.
Rule of three is a mathematical cross-multiplication method for solving many problems involving two quantities directly or inversely proportional.
Syntax
ruleOf3 [--inputA1(Numeric)] [--inputA2(Numeric)] [--inputB1(Numeric)] [--inputB2(Numeric)] (Boolean)=success (Numeric)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--inputA1 | Quantity A1 | Optional | Number | First value of quantity A that stands for Quantity B1. |
--inputA2 | Quantity A2 | Optional | Number | Second value of quantity A that stands for Quantity B2. |
--inputB1 | Quantity B1 | Optional | Number | First value of quantity B that is relative to Quantity A1. |
--inputB2 | Quantity B2 | Optional | Number | Second value of quantity B which is relative to Quantity A2. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
success | Success | Boolean | Returns "True" if rule of three was successfully applied, or "False" if otherwise. |
value | Result | Number | Resulting value of the cross-multiplication; The unknown value. |
Example
This command applies the rule of three according to the entered quantities, returning the unknown value of Quantity B1.
defVar --name executionResult --type Boolean
defVar --name unknownResult --type Numeric
ruleOf3 --inputA1 100 --inputA2 2 --inputB2 58 executionResult=success unknownResult=value
logMessage --message "Command Execution Result: ${executionResult}\r\nThe unknown value is? ${unknownResult}" --type "Info"
// The unknown value is 2900.
Remarks
In this command, one of the input fields must be empty, and this empty field is treated as the unknown value.