Array functions can now be translated (again)
[maxima.git] / tests / rtest6b.mac
blob3bad586b0b9d89fee6ecd36842cbfeef5d302264
1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*-  ******************/
2 /***************************************************************************
3 ***                                                                    *****
4 ***     Copyright (c) 1984 by William Schelter,University of Texas     *****
5 ***     All rights reserved                                            *****
6 ***************************************************************************/
9 1/(x^2+2);
10 1/(x^2+2)$
11 substpart(3/2,%,2,1,2);
12 1/(x^(3/2)+2)$
13 27*y^3+54*x*y^2+36*x^2*y+y+8*x^3+x+1;
14 27*y^3+54*x*y^2+36*x^2*y+y+8*x^3+x+1$
15 substpart(factor(piece),%,[1,2,3,5]);
16 (3*y+2*x)^3+y+x+1$
17 1/x+y/x-1/z;
18 -1/z+y/x+1/x$
19 substpart(xthru(piece),%,[2,3]);
20 (y+1)/x-1/z$
21 substpart("+",%,1,0);
22 -1/z+y+x+1$
23 ratsimp((k^2*x^2-1)*(cos(x)+eps)/(3*k+n[1])/(5*k-n[2]));
24 ((k^2*x^2-1)*cos(x)+eps*k^2*x^2-eps)/(15*k^2+(5*n[1]-3*n[2])*k-n[1]*n[2])$
25 factor(%);
26 (k*x-1)*(k*x+1)*(cos(x)+eps)/((3*k+n[1])*(5*k-n[2]))$
27 substpart(ratsimp(piece),%,1,[1,2]);
28 (k^2*x^2-1)*(cos(x)+eps)/((3*k+n[1])*(5*k-n[2]))$
29 -substpart(-piece,%,1,1);
30 -((1-k^2*x^2)*(cos(x)+eps)/((3*k+n[1])*(5*k-n[2])))$
31 a+b/(x*(y+(a+b)*x)+1);
32 b/(x*(y+(b+a)*x)+1)+a$
33 substpart(multthru(piece),%,1,2,1);
34 b/(x*y+(b+a)*x^2+1)+a$
35 x . 'diff(f(x),x,2);
36 x . 'diff(f(x),x,2)$
37 substinpart(d^2,%,2);
38 x . d^2$
39 substinpart(f1,f[1](x+1),0);
40 f1(x+1)$
42 /* SF bug #2667: "tex1 of f(x)^n" */
44 simp:false $
45 false $
47 tex1 (sqrt(x)^n);
48 "\\sqrt{x}^{n}";
50 simp:true $
51 true $
53 tex1(sin(x)^2);
54 "\\sin ^2x";
56 tex1(f(x)^2);
57 "f\\left(x\\right)^2";
59 tex1(sin(x)^n);
60 "\\sin ^{n}x";
62 tex1(f(x)^n);
63 "f\\left(x\\right)^{n}";
65 tex1(sin(x)^-1);
66 "{{1}\\over{\\sin x}}";
68 tex1(f(x)^-1);
69 "{{1}\\over{f\\left(x\\right)}}";
71 tex1(sin(x)^-2);
72 "{{1}\\over{\\sin ^2x}}";
74 tex1(f(x)^-2);
75 "{{1}\\over{f\\left(x\\right)^2}}";
77 /* see: https://stackoverflow.com/questions/66056058/wxmaxima-texput-for-powers-of-expressions
78  */
80 logexpand: false; /* disable log simplifications */
81 false;
83 foo: map (tex1, [log(x), log(x+1), log(x)^n]);
84 ["\\log x","\\log \\left(x+1\\right)","\\left(\\log x\\right)^{n}"];
86 texput (log, "\\ln ");
87 "\\ln ";
89 bar: map (tex1, [log(x), log(x+1), log(x)^n]);
90 ["\\ln x","\\ln \\left(x+1\\right)","\\left(\\ln x\\right)^{n}"];
92 /* verify that log is just as it was before but with \ln instead of \log */
94 if bar = map (lambda ([s], ssubst ("ln", "log", s)), foo) then true else bar;
95 true;
97 /* there's no user-level interface for this, and :lisp isn't recognized in test scripts, so ... */
98 block([simp:false], ?nconc(?\*tex\-mexpt\-trig\-like\-fns\*, ?list(log)), 0);
101 baz: map (tex1, [log(x), log(x+1), log(x)^n]);
102 ["\\ln x","\\ln \\left(x+1\\right)","\\ln ^{n}x"];
104 /* verify that now, log acts just like tan in tex output */
106 map (lambda ([s], ssubst ("ln", "tan", s)), map (tex1, [tan(x), tan(x+1), tan(x)^n]));
107 ''baz;
109 (reset (), 0);