Merge branch 'rtoy-refactor-specvars-defint-ll-ul'
[maxima.git] / tests / rtestparser_continuations_crnl.mac
blob05dba1971c56c6b2b16d23eaef0a80ce0dbdb82c
1 prederror : false;\r
2 false;\r
3 \r
4 \f\o\o\b\a\r;\r
5 foobar;\r
6 \r
7 "\f\o\o\b\a\r";\r
8 "foobar";\r
9 \r
10 "foo\\r
11 \\r
12 \\r
13 \\r
14 \\r
15 bar";\r
16 "foobar";\r
18 "foo\\\\r
19 \\r
20 bar";\r
21 "foo\\bar";\r
23 "foo\"\\r
24 bar\"\\r
25 baz";\r
26 "foo\"bar\"baz";\r
28 "\?foo\ bar";\r
29 "?foo bar";\r
31 1\\r
32 2\\r
33 3\\r
34 4\\r
35 5\\r
36 6;\r
37 123456;\r
39 "a\ \ \ \ b";\r
40 "a    b";\r
42 "a\\\ \\\b";\r
43 "a\\ \\b";\r
45 125\\r
46 125e-3;\r
47 125125e-3;\r
49 125125\\r
50 e-3;\r
51 125125e-3;\r
53 125125e\\r
54 -3;\r
55 125125e-3;\r
57 125125e-\\r
58 3;\r
59 125125e-3;\r
61 si\\r
62 n(1);\r
63 sin(1);\r
65 cos(\\r
66 1);\r
67 cos(1);\r
69 12!\\r
70 !;\r
71 12!!;\r
73 (infix("blurfle"), 0);\r
74 0;\r
76 a blurf\\r
77 le b;\r
78 a blurfle b;\r
80 (mnewton(FuncList,VarList,GuessList):=block(\r
81         [nfunc,NewtonMatrix,det,Solutions,Increments,numdet,solved:false,i,j,k,\r
82          keepfloat:true,ratprint:false],GuessList:float(GuessList),\r
83         nfunc:length(FuncList),\r
84         if length(VarList) # nfunc\r
85             then (print("mnewton: incorrect number of variable names (",nfunc,\r
86                         "functions but",length(VarList),"variable names)."),\r
87                   return(false)),\r
88         if length(GuessList) # nfunc\r
89             then (print("mnewton: incorrect number of approach values (",nfunc,\r
90                         "variables but",length(GuessList),\r
91                         "approximation values)."),return(false)),\r
92         apply(kill,VarList),NewtonMatrix:zeromatrix(nfunc,nfunc),\r
93         for i thru nfunc do\r
94             (for j thru nfunc do\r
95                  NewtonMatrix[i][j]:diff(FuncList[i],VarList[j])),\r
96         det:determinant(NewtonMatrix),NewtonMatrix:adjoint(NewtonMatrix),\r
97         NewtonMatrix:NewtonMatrix . FuncList,\r
98         for k thru NEWTONMAXITER do\r
99             (Solutions:map("=",VarList,GuessList),\r
100              numdet:float(sublis(Solutions,det)),\r
101              if abs(numdet) < NEWTONEPSILON then return(0),\r
102              Increments:float(rectform(expand(\r
103                                         sublis(Solutions,\r
104                                                NewtonMatrix/numdet)))),\r
105              if atom(Increments) then Increments:matrix([Increments]),\r
106              GuessList:GuessList-makelist(Increments[i][1],i,1,nfunc),\r
107              solved:true,\r
108              for i thru nfunc do\r
109                  solved:solved and abs(Increments[i][1]) < NEWTONEPSILON,\r
110              if solved then return(0)),\r
111         if solved = false\r
112             then (print("mnewton: the process doesn't converge or it converges too slowly."),\r
113                   return([])),Solutions:map("=",VarList,GuessList),\r
114         return([Solutions])),\r
115 mnewton_defn1: fundef (mnewton), 0);\r
116 0;\r
118 /* following is the result of (linel : 32, string (fundef (mnewton))) given the above definition. */\r
120 (mnewton(FuncList,VarList,\\r
121 GuessList):=block([nfunc,Newton\\r
122 Matrix,det,Solutions,Increments\\r
123 ,numdet,solved:false,i,j,k,keep\\r
124 float:true,ratprint:false],Gues\\r
125 sList:float(GuessList),nfunc:le\\r
126 ngth(FuncList),if length(VarLis\\r
127 t) # nfunc then (print("mnewton\\r
128 : incorrect number of variable \\r
129 names (",nfunc,"functions but",\\r
130 length(VarList),"variable names\\r
131 )."),return(false)),if length(G\\r
132 uessList) # nfunc then (print("\\r
133 mnewton: incorrect number of ap\\r
134 proach values (",nfunc,"variabl\\r
135 es but",length(GuessList),"appr\\r
136 oximation values)."),return(fal\\r
137 se)),apply(kill,VarList),Newton\\r
138 Matrix:zeromatrix(nfunc,nfunc),\\r
139 for i thru nfunc do (for j thru\\r
140  nfunc do NewtonMatrix[i][j]:di\\r
141 ff(FuncList[i],VarList[j])),det\\r
142 :determinant(NewtonMatrix),Newt\\r
143 onMatrix:adjoint(NewtonMatrix),\\r
144 NewtonMatrix:NewtonMatrix . Fun\\r
145 cList,for k thru NEWTONMAXITER \\r
146 do (Solutions:map("=",VarList,G\\r
147 uessList),numdet:float(sublis(S\\r
148 olutions,det)),if abs(numdet) <\\r
149  NEWTONEPSILON then return(0),I\\r
150 ncrements:float(rectform(expand\\r
151 (sublis(Solutions,NewtonMatrix/\\r
152 numdet)))),if atom(Increments) \\r
153 then Increments:matrix([Increme\\r
154 nts]),GuessList:GuessList-makel\\r
155 ist(Increments[i][1],i,1,nfunc)\\r
156 ,solved:true,for i thru nfunc d\\r
157 o solved:solved and abs(Increme\\r
158 nts[i][1]) < NEWTONEPSILON,if s\\r
159 olved then return(0)),if solved\\r
160  = false then (print("mnewton: \\r
161 the process doesn't converge or\\r
162  it converges too slowly."),ret\\r
163 urn([])),Solutions:map("=",VarL\\r
164 ist,GuessList),return([Solution\\r
165 s])),\r
166 mnewton_defn2: fundef (mnewton), 0);\r
167 0;\r
169 is (equal (mnewton_defn1, mnewton_defn2));\r
170 true;\r
172 prederror : true;\r
173 true;\r