complex () * ()

From PenguinMod Wiki (Official)
Complex () * ()
Jump to navigation Jump to search

The complex () * () block is a reporter block in the Extra Mathematics extension that reports the product of the entered complex numbers (which use real and imaginary JSON pairs).

Workaround

This block can be worked around by using the multiplication of the numbers:

define complex (num1) * (num2)
set [real part] to ((get [real] from (num1)::#0fbd8c) * (get [real] from (num2)::#0fbd8c)):: #0869c2
change [real part] by ((-1) * ((get [real] from (num1)::#0fbd8c) * (get [real] from (num2)::#0fbd8c))) :: #0869c2
set [im part] to ((get [imaginary] from (num1)::#0fbd8c) * (get [real] from (num2)::#0fbd8c)):: #0869c2
change [im part] by ((get [real] from (num1)::#0fbd8c) * (get [imaginary] from (num2)::#0fbd8c)) :: #0869c2
return (join [{"real":] (get [real part]:: #0869c2) [,"imaginary":] (get [im part]:: #0869c2) [}]::operators)::custom cap

The complex () + () custom reporter would then be used in place of the actual block. Subtraction and addition can also be used instead of changing the value of the temporary variables.

See also