Fix the inefficient evaluation of translated predicates
[maxima.git] / tests / rtestparser_continuations_cr.mac
blob9f02e50ea445bca246f17841764e270ca73e1fa8
1 prederror : false;\rfalse;\r\r\f\o\o\b\a\r;\rfoobar;\r\r"\f\o\o\b\a\r";\r"foobar";\r\r"foo\\r\\r\\r\\r\\rbar";\r"foobar";\r\r"foo\\\\r\\rbar";\r"foo\\bar";\r\r"foo\"\\rbar\"\\rbaz";\r"foo\"bar\"baz";\r\r"\?foo\ bar";\r"?foo bar";\r\r1\\r2\\r3\\r4\\r5\\r6;\r123456;\r\r"a\ \ \ \ b";\r"a    b";\r\r"a\\\ \\\b";\r"a\\ \\b";\r\r125\\r125e-3;\r125125e-3;\r\r125125\\re-3;\r125125e-3;\r\r125125e\\r-3;\r125125e-3;\r\r125125e-\\r3;\r125125e-3;\r\rsi\\rn(1);\rsin(1);\r\rcos(\\r1);\rcos(1);\r\r12!\\r!;\r12!!;\r\r(infix("blurfle"), 0);\r0;\r\ra blurf\\rle b;\ra blurfle b;\r\r(mnewton(FuncList,VarList,GuessList):=block(\r        [nfunc,NewtonMatrix,det,Solutions,Increments,numdet,solved:false,i,j,k,\r         keepfloat:true,ratprint:false],GuessList:float(GuessList),\r        nfunc:length(FuncList),\r        if length(VarList) # nfunc\r            then (print("mnewton: incorrect number of variable names (",nfunc,\r                        "functions but",length(VarList),"variable names)."),\r                  return(false)),\r        if length(GuessList) # nfunc\r            then (print("mnewton: incorrect number of approach values (",nfunc,\r                        "variables but",length(GuessList),\r                        "approximation values)."),return(false)),\r        apply(kill,VarList),NewtonMatrix:zeromatrix(nfunc,nfunc),\r        for i thru nfunc do\r            (for j thru nfunc do\r                 NewtonMatrix[i][j]:diff(FuncList[i],VarList[j])),\r        det:determinant(NewtonMatrix),NewtonMatrix:adjoint(NewtonMatrix),\r        NewtonMatrix:NewtonMatrix . FuncList,\r        for k thru NEWTONMAXITER do\r            (Solutions:map("=",VarList,GuessList),\r             numdet:float(sublis(Solutions,det)),\r             if abs(numdet) < NEWTONEPSILON then return(0),\r             Increments:float(rectform(expand(\r                                        sublis(Solutions,\r                                               NewtonMatrix/numdet)))),\r             if atom(Increments) then Increments:matrix([Increments]),\r             GuessList:GuessList-makelist(Increments[i][1],i,1,nfunc),\r             solved:true,\r             for i thru nfunc do\r                 solved:solved and abs(Increments[i][1]) < NEWTONEPSILON,\r             if solved then return(0)),\r        if solved = false\r            then (print("mnewton: the process doesn't converge or it converges too slowly."),\r                  return([])),Solutions:map("=",VarList,GuessList),\r        return([Solutions])),\rmnewton_defn1: fundef (mnewton), 0);\r0;\r\r/* following is the result of (linel : 32, string (fundef (mnewton))) given the above definition. */\r\r(mnewton(FuncList,VarList,\\rGuessList):=block([nfunc,Newton\\rMatrix,det,Solutions,Increments\\r,numdet,solved:false,i,j,k,keep\\rfloat:true,ratprint:false],Gues\\rsList:float(GuessList),nfunc:le\\rngth(FuncList),if length(VarLis\\rt) # nfunc then (print("mnewton\\r: incorrect number of variable \\rnames (",nfunc,"functions but",\\rlength(VarList),"variable names\\r)."),return(false)),if length(G\\ruessList) # nfunc then (print("\\rmnewton: incorrect number of ap\\rproach values (",nfunc,"variabl\\res but",length(GuessList),"appr\\roximation values)."),return(fal\\rse)),apply(kill,VarList),Newton\\rMatrix:zeromatrix(nfunc,nfunc),\\rfor i thru nfunc do (for j thru\\r nfunc do NewtonMatrix[i][j]:di\\rff(FuncList[i],VarList[j])),det\\r:determinant(NewtonMatrix),Newt\\ronMatrix:adjoint(NewtonMatrix),\\rNewtonMatrix:NewtonMatrix . Fun\\rcList,for k thru NEWTONMAXITER \\rdo (Solutions:map("=",VarList,G\\ruessList),numdet:float(sublis(S\\rolutions,det)),if abs(numdet) <\\r NEWTONEPSILON then return(0),I\\rncrements:float(rectform(expand\\r(sublis(Solutions,NewtonMatrix/\\rnumdet)))),if atom(Increments) \\rthen Increments:matrix([Increme\\rnts]),GuessList:GuessList-makel\\rist(Increments[i][1],i,1,nfunc)\\r,solved:true,for i thru nfunc d\\ro solved:solved and abs(Increme\\rnts[i][1]) < NEWTONEPSILON,if s\\rolved then return(0)),if solved\\r = false then (print("mnewton: \\rthe process doesn't converge or\\r it converges too slowly."),ret\\rurn([])),Solutions:map("=",VarL\\rist,GuessList),return([Solution\\rs])),\rmnewton_defn2: fundef (mnewton), 0);\r0;\r\ris (equal (mnewton_defn1, mnewton_defn2));\rtrue;\r\rprederror : true;\rtrue;\r\r