Example #1
0
def computeResult(keyStr, args):
    '''Calls the relevant function to perform the computation.

        @param keyStr - the key string identifying the computation (operation)
        @param args - the keys of the object on which to apply the computation'''
    noArgs = generic_cas_computations.getNoArgs(keyStr)

    if len(args) > 2:
        error_reporter.reportProgramError("sympy_act.py:compute :- This function does not yet handle arguments of length greater than 2. noArgs = "+noArgs+", arge.length = "+len(args))
        return
    elif len(args) != noArgs:
        error_reporter.reportProgramError("sympy_act.py:compute :- Number of arguments given does not match expected number of arguments. noArgs = "+noArgs+", len(args) = "+len(args))
        return
    
    try:
        if noArgs == 1:
            return generic_cas_computations.getFunction(keyStr)(args[0]) #sympy_computation_list.getFunction(keyStr)(args[0])
        if noArgs == 2:
            return generic_cas_computations.getFunction(keyStr)(args[0], args[1]) #sympy_computation_list.getFunction(keyStr)(args[0], args[1])
    except NotImplementedError:
        return []