1<TeXmacs|1.0.7.16> 2 3<style|tmdoc> 4 5<\body> 6 <tmdoc-title|Example of a <name|Reduce> session> 7 8 Here follows a sample session (with mathematical input mode). 9 10 <\session|reduce|default> 11 <\output> 12 \; 13 14 Reduce (Free PSL version), 31-Jan-2012 ... 15 16 \; 17 </output> 18 19 <\unfolded-io-math> 20 REDUCE]\ 21 <|unfolded-io-math> 22 a\<assign\><around*|(|x+y|)><rsup|2> 23 <|unfolded-io-math> 24 <with|color|black|mode|math|math-display|true|a<with|math-font-family|rm|:=>x<rsup|2>+2*x*y+y<rsup|2>> 25 </unfolded-io-math> 26 27 <\unfolded-io-math> 28 REDUCE]\ 29 <|unfolded-io-math> 30 x\<assign\>z+1$ a; 31 <|unfolded-io-math> 32 \; 33 34 <with|color|black|mode|math|math-display|true|y<rsup|2>+2*y*z+2*y+z<rsup|2>+2*z+1> 35 </unfolded-io-math> 36 37 <\unfolded-io-math> 38 REDUCE]\ 39 <|unfolded-io-math> 40 x\<assign\>z-1$ a; 41 <|unfolded-io-math> 42 \; 43 44 <with|color|black|mode|math|math-display|true|y<rsup|2>+2*y*z-2*y+z<rsup|2>-2*z+1> 45 </unfolded-io-math> 46 47 <\unfolded-io-math> 48 REDUCE]\ 49 <|unfolded-io-math> 50 clear x; a; 51 <|unfolded-io-math> 52 \; 53 54 <with|color|black|mode|math|math-display|true|x<rsup|2>+2*x*y+y<rsup|2>> 55 </unfolded-io-math> 56 57 <\unfolded-io-math> 58 REDUCE]\ 59 <|unfolded-io-math> 60 <frac|x<rsup|2>+y<rsup|2>|x<rsup|2>-y<rsup|2>>-<frac|x<rsup|2>-y<rsup|2>|x<rsup|2>+y<rsup|2>> 61 <|unfolded-io-math> 62 <with|color|black|mode|math|math-display|true|<frac|4*x<rsup|2>*y<rsup|2>|x<rsup|4>-y<rsup|4>>> 63 </unfolded-io-math> 64 65 <\unfolded-io-math> 66 REDUCE]\ 67 <|unfolded-io-math> 68 <around*|(|<sqrt|x>-<sqrt|y>|)><rsup|4> 69 <|unfolded-io-math> 70 <with|color|black|mode|math|math-display|true|-4*<sqrt|y>*<sqrt|x>*x-4*<sqrt|y>*<sqrt|x>*y+x<rsup|2>+6*x*y+y<rsup|2>> 71 </unfolded-io-math> 72 73 <\input-math> 74 REDUCE]\ 75 <|input-math> 76 load_package trigsimp 77 </input-math> 78 79 <\unfolded-io-math> 80 REDUCE]\ 81 <|unfolded-io-math> 82 trigsimp<around*|(|sin<around*|(|\<alpha\>|)>*cos<around*|(|\<beta\>|)>,combine|)> 83 <|unfolded-io-math> 84 <with|color|black|mode|math|math-display|true|<frac|sin<around*|(|\<alpha\>-\<beta\>|)>+sin<around*|(|\<alpha\>+\<beta\>|)>|2>> 85 </unfolded-io-math> 86 87 <\unfolded-io-math> 88 REDUCE]\ 89 <|unfolded-io-math> 90 sin<around*|(|-x|)>; cos<around*|(|<frac|\<pi\>|6>|)>; 91 log<around*|(|\<mathe\><rsup|x>|)>; 92 <around*|(|2+3*\<mathi\>|)><rsup|2>; 93 <|unfolded-io-math> 94 <with|color|black|mode|math|math-display|true|-sin<around*|(|x|)>> 95 96 <with|color|black|mode|math|math-display|true|<frac|<sqrt|3>|2>> 97 98 <with|color|black|mode|math|math-display|true|x> 99 100 <with|color|black|mode|math|math-display|true|<with|math-font-family|rm|12>*i-5> 101 </unfolded-io-math> 102 103 <\unfolded-io-math> 104 REDUCE]\ 105 <|unfolded-io-math> 106 a\<assign\>\<mathe\><rsup|c*x>*cos<around*|(|x|)> 107 <|unfolded-io-math> 108 <with|color|black|mode|math|math-display|true|a<with|math-font-family|rm|:=>e<rsup|c*x>*cos<around*|(|x|)>> 109 </unfolded-io-math> 110 111 <\unfolded-io-math> 112 REDUCE]\ 113 <|unfolded-io-math> 114 df<around*|(|a,x|)> 115 <|unfolded-io-math> 116 <with|color|black|mode|math|math-display|true|e<rsup|c*x>*<around*|(|cos<around*|(|x|)>*c-sin<around*|(|x|)>|)>> 117 </unfolded-io-math> 118 119 <\input-math> 120 REDUCE]\ 121 <|input-math> 122 clear a 123 </input-math> 124 125 <\unfolded-io-math> 126 REDUCE]\ 127 <|unfolded-io-math> 128 <big|int><sqrt|x<rsup|2>+a>*\<mathd\>x 129 <|unfolded-io-math> 130 <with|color|black|mode|math|math-display|true|<frac|<sqrt|a+x<rsup|2>>*x+log<around*|(|<frac|<sqrt|a+x<rsup|2>>+x|<sqrt|a>>|)>*a|2>> 131 </unfolded-io-math> 132 133 <\input-math> 134 REDUCE]\ 135 <|input-math> 136 load_package defint 137 </input-math> 138 139 <\unfolded-io-math> 140 REDUCE]\ 141 <|unfolded-io-math> 142 <big|int><rsub|0><rsup|\<infty\>><frac|sin<around*|(|x|)>|x>*\<mathd\>x 143 <|unfolded-io-math> 144 <with|color|black|mode|math|math-display|true|<frac|\<pi\>|2>> 145 </unfolded-io-math> 146 147 <\unfolded-io-math> 148 REDUCE]\ 149 <|unfolded-io-math> 150 <big|sum><rsub|n=0><rsup|m>n<rsup|2> 151 <|unfolded-io-math> 152 <with|color|black|mode|math|math-display|true|<frac|m*<around*|(|2*m<rsup|2>+3*m+1|)>|6>> 153 </unfolded-io-math> 154 155 <\unfolded-io-math> 156 REDUCE]\ 157 <|unfolded-io-math> 158 <big|sum><rsub|n=1><rsup|10><frac|1|n<rsup|2>> 159 <|unfolded-io-math> 160 <with|color|black|mode|math|math-display|true|<frac|<with|math-font-family|rm|1968329>|<with|math-font-family|rm|1270080>>> 161 </unfolded-io-math> 162 163 <\input-math> 164 REDUCE]\ 165 <|input-math> 166 load_package sum 167 </input-math> 168 169 <\unfolded-io-math> 170 REDUCE]\ 171 <|unfolded-io-math> 172 <big|sum><rsub|n=1><rsup|\<infty\>><frac|1|n<rsup|2>> 173 <|unfolded-io-math> 174 <with|color|black|mode|math|math-display|true|<frac|\<pi\><rsup|2>|6>> 175 </unfolded-io-math> 176 177 <\input-math> 178 REDUCE]\ 179 <|input-math> 180 load_package tps 181 </input-math> 182 183 <\unfolded-io-math> 184 REDUCE]\ 185 <|unfolded-io-math> 186 sinx\<assign\>ps<around*|(|sin<around*|(|x|)>,x,0|)> 187 <|unfolded-io-math> 188 <with|color|black|mode|math|math-display|true|<with|math-font-family|rm|sinx:=>*x-<frac|1|6>*x<rsup|3>+<frac|1|<with|math-font-family|rm|120>>*x<rsup|5>+O<around*|(|x<rsup|7>|)>> 189 </unfolded-io-math> 190 191 <\unfolded-io-math> 192 REDUCE]\ 193 <|unfolded-io-math> 194 cosx\<assign\>ps<around*|(|cos<around*|(|x|)>,x,0|)> 195 <|unfolded-io-math> 196 <with|color|black|mode|math|math-display|true|<with|math-font-family|rm|cosx:=>*1-<frac|1|2>*x<rsup|2>+<frac|1|<with|math-font-family|rm|24>>*x<rsup|4>-<frac|1|<with|math-font-family|rm|720>>*x<rsup|6>+O<around*|(|x<rsup|7>|)>> 197 </unfolded-io-math> 198 199 <\unfolded-io-math> 200 REDUCE]\ 201 <|unfolded-io-math> 202 a\<assign\>sinx<rsup|2>+cosx<rsup|2> 203 <|unfolded-io-math> 204 <with|color|black|mode|math|math-display|true|a<with|math-font-family|rm|:=>1+O<around*|(|x<rsup|7>|)>> 205 </unfolded-io-math> 206 207 <\unfolded-io-math> 208 REDUCE]\ 209 <|unfolded-io-math> 210 psexplim 10$ a; 211 <|unfolded-io-math> 212 \; 213 214 <with|color|black|mode|math|math-display|true|1+O<around*|(|x<rsup|<with|math-font-family|rm|11>>|)>> 215 </unfolded-io-math> 216 217 <\input-math> 218 REDUCE]\ 219 <|input-math> 220 clear a,sinx,cosx 221 </input-math> 222 223 <\unfolded-io-math> 224 REDUCE]\ 225 <|unfolded-io-math> 226 solve<around*|(|a*x<rsup|2>+b*x+c=0,x|)> 227 <|unfolded-io-math> 228 <with|color|black|mode|math|math-display|true|<around*|{|x=<frac|<sqrt|-4*a*c+b<rsup|2>>-b|2*a><space|0.25spc><with|math-font-family|rm|,<space|0.25spc>><space|0.25spc>x=<frac|-<around*|(|<sqrt|-4*a*c+b<rsup|2>>+b|)>|2*a>|}>> 229 </unfolded-io-math> 230 231 <\unfolded-io-math> 232 REDUCE]\ 233 <|unfolded-io-math> 234 solve<around*|(|<around*|{|a*x+b*y=u,c*x+d*y=v|}>,<around*|{|x,y|}>|)> 235 <|unfolded-io-math> 236 <with|color|black|mode|math|math-display|true|<around*|{|<around*|{|x=<frac|-b*v+d*u|a*d-b*c><space|0.25spc><with|math-font-family|rm|,<space|0.25spc>><space|0.25spc>y=<frac|a*v-c*u|a*d-b*c>|}>|}>> 237 </unfolded-io-math> 238 239 <\unfolded-io-math> 240 REDUCE]\ 241 <|unfolded-io-math> 242 m\<assign\><matrix|<tformat|<table|<row|<cell|a>|<cell|b>>|<row|<cell|c>|<cell|d>>>>> 243 <|unfolded-io-math> 244 <with|color|black|mode|math|math-display|true|m<with|math-font-family|rm|:=><around*|(|<tabular*|<tformat|<table|<row|<cell|a>|<cell|b>>|<row|<cell|c>|<cell|d>>>>>|)>> 245 </unfolded-io-math> 246 247 <\unfolded-io-math> 248 REDUCE]\ 249 <|unfolded-io-math> 250 mi\<assign\>m<rsup|-1> 251 <|unfolded-io-math> 252 <with|color|black|mode|math|math-display|true|<with|math-font-family|rm|mi:=><around*|(|<tabular*|<tformat|<table|<row|<cell|<frac|d|a*d-b*c>>|<cell|<frac|-b|a*d-b*c>>>|<row|<cell|<frac|-c|a*d-b*c>>|<cell|<frac|a|a*d-b*c>>>>>>|)>> 253 </unfolded-io-math> 254 255 <\unfolded-io-math> 256 REDUCE]\ 257 <|unfolded-io-math> 258 m*mi 259 <|unfolded-io-math> 260 <with|color|black|mode|math|math-display|true|<around*|(|<tabular*|<tformat|<table|<row|<cell|1>|<cell|0>>|<row|<cell|0>|<cell|1>>>>>|)>> 261 </unfolded-io-math> 262 263 <\input-math> 264 REDUCE]\ 265 <|input-math> 266 clear m,mi 267 </input-math> 268 269 <\unfolded-io-math> 270 REDUCE]\ 271 <|unfolded-io-math> 272 <det|<tformat|<table|<row|<cell|a>|<cell|b>>|<row|<cell|c>|<cell|d>>>>> 273 <|unfolded-io-math> 274 <with|color|black|mode|math|math-display|true|a*d-b*c> 275 </unfolded-io-math> 276 277 <\input-math> 278 REDUCE]\ 279 <|input-math> 280 for all x,y let log<around*|(|x*y|)>=log<around*|(|x|)>+log<around*|(|y|)>, 281 282 log<around*|(|<frac|x|y>|)>=log<around*|(|x|)>-log<around*|(|y|)>, 283 284 log<around*|(|x<rsup|y>|)>=y*log<around*|(|x|)> 285 </input-math> 286 287 <\unfolded-io-math> 288 REDUCE]\ 289 <|unfolded-io-math> 290 log<around*|(|x*\<mathe\><rsup|y>|)> 291 <|unfolded-io-math> 292 <with|color|black|mode|math|math-display|true|log<around*|(|x|)>+y> 293 </unfolded-io-math> 294 295 <\input-math> 296 REDUCE]\ 297 <|input-math> 298 for all x,y clear log<around*|(|x*y|)>,log<around*|(|<frac|x|y>|)>,log<around*|(|x<rsup|y>|)> 299 </input-math> 300 301 <\unfolded-io-math> 302 REDUCE]\ 303 <|unfolded-io-math> 304 procedure fac<around*|(|n|)>; 305 306 if n\<gtr\>1 then n*fac<around*|(|n-1|)> else 1; 307 <|unfolded-io-math> 308 <with|color|black|mode|math|math-display|true|math-font-family|rm|fac> 309 </unfolded-io-math> 310 311 <\unfolded-io-math> 312 REDUCE]\ 313 <|unfolded-io-math> 314 load_package rdebug 315 <|unfolded-io-math> 316 *** fluid \0lispsystem!*' cannot become global 317 318 *** \0break_prompt' has not been defined, because it is flagged LOSE 319 320 \; 321 </unfolded-io-math> 322 323 <\unfolded-io-math> 324 REDUCE]\ 325 <|unfolded-io-math> 326 tr fac 327 <|unfolded-io-math> 328 \; 329 330 (fac) 331 332 \; 333 </unfolded-io-math> 334 335 <\unfolded-io-math> 336 REDUCE]\ 337 <|unfolded-io-math> 338 fac<around*|(|5|)> 339 <|unfolded-io-math> 340 fac being entered 341 342 \ \ \ n: \ \ 5 343 344 \; 345 346 \ \ fac (level 2) being entered 347 348 \ \ \ \ \ n: 4 349 350 \; 351 352 \ \ \ \ fac (level 3) being entered 353 354 \ \ \ \ \ \ \ n: \ \ \ \ \ \ 3 355 356 \; 357 358 \ \ \ \ \ \ fac (level 4) being entered 359 360 \ \ \ \ \ \ \ \ \ n: \ \ \ \ 2 361 362 \; 363 364 \ \ \ \ \ \ \ \ fac (level 5) being entered 365 366 \ \ \ \ \ \ \ \ \ \ \ n: \ \ 1 367 368 \; 369 370 \ \ \ \ \ \ \ \ fac (level 5) = 1 371 372 \; 373 374 \ \ \ \ \ \ fac (level 4) = 2 375 376 \; 377 378 \ \ \ \ fac (level 3) = 6 379 380 \; 381 382 \ \ fac (level 2) = 24 383 384 \; 385 386 fac = 120 387 388 \; 389 390 <with|color|black|mode|math|math-display|true|120> 391 </unfolded-io-math> 392 393 <\input-math> 394 REDUCE]\ 395 <|input-math> 396 untr fac 397 </input-math> 398 399 <\input-math> 400 REDUCE]\ 401 <|input-math> 402 load_package gnuplot 403 </input-math> 404 405 <\input-math> 406 REDUCE]\ 407 <|input-math> 408 plot<around*|(|<frac|sin<around*|(|x|)>|x>,x=<around*|(|-4*\<pi\>\<ldots\>4*\<pi\>|)>|)> 409 </input-math> 410 411 <\unfolded-io-math> 412 REDUCE]\ 413 <|unfolded-io-math> 414 bye 415 <|unfolded-io-math> 416 \; 417 418 Quitting 419 420 <script-dead> 421 </unfolded-io-math> 422 423 <\input-math> 424 REDUCE]\ 425 <|input-math> 426 \; 427 </input-math> 428 </session> 429 430 <tmdoc-copyright|2012|Andrey Grozin> 431 432 <tmdoc-license|Permission is granted to copy, distribute and/or modify this 433 document under the terms of the GNU Free Documentation License, Version 1.1 434 or any later version published by the Free Software Foundation; with no 435 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 436 Texts. A copy of the license is included in the section entitled "GNU Free 437 Documentation License".> 438</body> 439 440<\initial> 441 <\collection> 442 <associate|language|english> 443 <associate|preamble|false> 444 </collection> 445</initial>