0
$\begingroup$

I'm attempting to define an algorithm using math notation which runs a function on value pairs, the pairs are generated as a result of a Cartesian product of all elements in set and if the result of the function for one of the pairs exceeds 2 then return the value of the function.

Is this correct ? :

$$ s = \{s1, s2, s3, s4\dots\} $$

$$ \varphi_1 : function(s_a , s_b) $$

$$ \forall (s\times s) \varphi_1 > 2 \rightarrow value(\varphi_1) $$

I accessed if notation from Representing IF ... THEN ... ELSE ... in math notation

Update :

Each member of the set represents a group of characters and the function returns 2 if $s_a$ contains more characters than $s_b$.

So in this example where

$$ s = \{"test words" , "test"\} $$

Cartesian product of s is ("testwords" , "test"),("test" , "testwords"),("test" , "test"),("words" , "words")

function applied to ("testwords" , "test") returns 2
function applied to ("test" , "testwords") returns nothing
function applied to ("test" , "test") returns nothing
function applied to ("testwords" , "testwords") returns nothing
  • 0
    Mathematically what you have written looks strange to me, but I don't really understand the input or output of your function (maybe a small example would help?). It's more common to see a piecewise function for "if, then" type formulas; $$f(x) = \begin{cases}\text{1st option}, & \text{(implicit ``if'') 1st condition} \\ \text{2nd option}, & \text{2nd condition} \\ \text{etc.}\end{cases}$$2017-01-08
  • 1
    @pjs36 please see question update2017-01-08

0 Answers 0