sympatch.red 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. module sympatch;
  2. % from rprint.red
  3. load!_package 'rprint;
  4. fluid '(!*n buffp combuff!* curmark curpos orig pretop pretoprinf rmar);
  5. symbolic procedure rprint u;
  6. begin integer !*n; scalar buff,buffp,curmark,rmar,x;
  7. curmark := 0;
  8. buff := buffp := list list(0,0);
  9. rmar := linelength nil;
  10. x := get('!*semicol!*,pretop);
  11. !*n := 0;
  12. mprino1(u,list(caar x,cadar x));
  13. % prin2ox ";";
  14. prin2ox "$"; %3.11 91 KG
  15. omarko curmark;
  16. prinos buff
  17. end;
  18. % error in treatment of roots in connection
  19. % with conjugate of complex numbers
  20. symbolic procedure reimexpt u;
  21. if cadr u eq 'e
  22. then addsq(reimcos list('cos,reval list('times,'i,caddr u)),
  23. multsq(simp list('minus,'i),
  24. reimsin list('sin,reval list('times,'i,caddr u))))
  25. else if fixp cadr u and cadr u > 0
  26. and eqcar(caddr u,'quotient)
  27. and fixp cadr caddr u
  28. and fixp caddr caddr u
  29. then mksq(u,1)
  30. else addsq(mkrepart u,multsq(simp 'i,mkimpart u));
  31. put('expt,'cmpxsplitfn,'reimexpt);
  32. put('cos,'cmpxsplitfn,'reimcos);
  33. put('sin,'cmpxsplitfn,'reimsin);
  34. endmodule;
  35. % algebraic repart(pi):=pi; % Present in 3.4.1 and later versions.
  36. % algebraic impart(pi):=0;
  37. % error in treatment of roots in connection
  38. % with conjugate of complex numbers
  39. % end;
  40. end;