Beispiel #1
0
def main(exp,x,y,y1=0,y2=0,y3=0):
    if(not('x' in exp) and not('y' in exp) and not('y\'' in exp) and not('y\'\'' in exp) and not('y\'\'\'' in exp)):
        return float(exp)
    if(exp[0]=='-'):
        exp='0'+exp
    if('(-' in exp):
        exp=exp.replace('(-','(0-')
    temp=[]
    temp=extract.argumentSeparator(exp)
    postfixStr=[]
    postfixStr=extract.convert_infix(temp)
    for i in range(0,len(postfixStr)):
        if(postfixStr[i]=='x'):
            postfixStr[i]=x
        if(postfixStr[i]=='y'):
            postfixStr[i]=y
        if(postfixStr[i]=='y\''):
            postfixStr[i]=y1
        if(postfixStr[i]=='y\'\''):
            postfixStr[i]=y2
        if(postfixStr[i]=='y\'\'\''):
            postfixStr[i]=y3
    finalVal=extract.PostfixEval(postfixStr)
    return finalVal
Beispiel #2
0
def CallDiff(exp,var):
    res=extract.argumentSeparator(exp)
    res=differentiation(extract.convert_infix(res),var)
    res= extract.post_infix(res)
    return res