randRange( 1, 2 )
randRange( 2, 3, NUM_EXPRESSIONS )
[ randRange( 1, 9, 3 ), randRange( 1, 9, 3 ) ]
(function() {
var variables = [ [ "a", "b", "c" ], [ "x", "y", "z" ] ];
var group = [];
for ( var i = 0; i < NUM_EXPRESSIONS; i++ ) {
group.push( variables.shift().slice( 0, NUM_TERMS[ i ] ) );
}
return group;
})()
[ randRangeNonZero( -10, 10 ), randRangeNonZero( -10, 10 ) ]
[ randRangeNonZero( -10, 10 ), randRangeNonZero( -10, 10 ) ]
(function() {
var originals = [];
$.each( GROUPS, function( index, group ) {
var coeffs = COEFFICIENTS[ index ];
var o = [];
$.each( group, function( i, variable ) {
o.push( expr( [ "*", coeffs[ i ], variable] ) );
});
originals.push( o );
});
return originals;
})()
(function() {
var expression = [];
$.each( GROUPS, function( index, group ) {
var coeffs = COEFFICIENTS[ index ];
$.each( group, function( i, variable ) {
expression.push( expr( [ "*", (coeffs[ i ] * FACTORS[ index ] ), variable ] ) );
});
});
return expression;
})()
shuffle( MULTIPLIED_EXPRESSIONS ).join( " + " )
(function() {
var answer = 0;
for ( var i = 0; i < NUM_EXPRESSIONS; i++ ) {
answer += ( FACTORS[ i ] * VALUES[ i ] );
}
return answer;
})()
If ORIGINAL_EXPRESSIONS[ 0 ].join( " + " ) = VALUES[ 0 ]
and ORIGINAL_EXPRESSIONS[ 1 ].join( " + " ) = VALUES[ 1 ]
,
what is QUESTION
?
ANSWER
= MULTIPLIED_EXPRESSIONS.join( " + " )
= (FACTORS[ 0 ]) \cdot (ORIGINAL_EXPRESSIONS[ 0 ].join( " + " ))
+ (FACTORS[ 1 ] ) \cdot (ORIGINAL_EXPRESSIONS[ 1 ].join( " + " ))
= (FACTORS[ 0 ]) \cdot ( VALUES[ 0 ])
+ (FACTORS[ 1 ]) \cdot ( VALUES[ 1 ])
= FACTORS[ 0 ] * VALUES[ 0 ] + FACTORS[ 1 ] * VALUES[ 1 ]
= ANSWER