nerdamer 1.1.9 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Algebra.js +2061 -1850
- package/Calculus.js +761 -680
- package/Extra.js +148 -117
- package/README.md +30 -1
- package/Solve.js +476 -332
- package/all.min.js +1 -0
- package/gulpfile.js +16 -0
- package/index.d.ts +150 -13
- package/nerdamer.core.js +2166 -1901
- package/package.json +57 -52
- package/spec/LaTeX.spec.js +14 -44
- package/spec/TeXConvert.spec.js +3 -2
- package/spec/algebra.spec.js +181 -732
- package/spec/calculus.spec.js +160 -673
- package/spec/core.spec.js +35 -8
- package/spec/extra.spec.js +39 -171
- package/spec/solve.spec.js +89 -305
package/spec/calculus.spec.js
CHANGED
|
@@ -8,689 +8,176 @@ var round = nerdamer.getCore().Utils.round;
|
|
|
8
8
|
describe('calculus', function () {
|
|
9
9
|
|
|
10
10
|
it('should differentiate correctly', function () {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
given: 'diff(sqrt(x)*x,x)',
|
|
47
|
-
expected: '(3/2)*x^(1/2)'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
given: 'diff(sqrt(x)-1/sqrt(x),x)',
|
|
51
|
-
expected: '(1/2)*x^(-1/2)+(1/2)*x^(-3/2)'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
given: 'diff(x^2/3-3/x^2,x)',
|
|
55
|
-
expected: '(2/3)*x+6*x^(-3)'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
given: 'diff(sqrt(x)*(x^2+1),x)',
|
|
59
|
-
expected: '(1/2)*(1+x^2)*x^(-1/2)+2*x^(3/2)'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
given: 'diff(e^x/(e^x-1),x)',
|
|
63
|
-
expected: '(-1+e^x)^(-1)*e^x-(-1+e^x)^(-2)*e^(2*x)'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
given: 'diff(e^x,x)',
|
|
67
|
-
expected: 'e^x'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
given: 'diff(e^x/x,x)',
|
|
71
|
-
expected: '-e^x*x^(-2)+e^x*x^(-1)'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
given: 'diff(tan(x)*log(1/cos(x)),x)',
|
|
75
|
-
expected: '-(-cos(x)^(-1)*sin(x)*tan(x)+log(cos(x))*sec(x)^2)'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
given: 'diff((2*x)^(e),x)',
|
|
79
|
-
expected: '2^e*e*x^(-1+e)'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
given: 'diff(2*cos(x)*log(x),x)',
|
|
83
|
-
expected: '2*(-log(x)*sin(x)+cos(x)*x^(-1))'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
given: 'diff(cos(5*x)*log(sec(sqrt(cos(x^(4/5))^2))/y^2)*y,x)',
|
|
87
|
-
expected: '(-4/5)*abs(cos(x^(4/5)))^(-1)*cos(x^(4/5))*sec(abs(cos(x^(4/5))))*sin(x^(4/5))*tan(abs(cos(x^(4/5))))*x^(-1/5)*y^(-2)*cos(5*x)' +
|
|
88
|
-
'*sec(abs(cos(x^(4/5))))^(-1)*y^3-5*log(sec(abs(cos(x^(4/5))))*y^(-2))*sin(5*x)*y'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
given: 'diff(x*cos(x)^log(x),x)',
|
|
92
|
-
expected: '(-cos(x)^(-1)*log(x)*sin(x)+log(cos(x))*x^(-1))*cos(x)^log(x)*x+cos(x)^log(x)'
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
given: 'diff(cos(2*x),x)',
|
|
96
|
-
expected: '-2*sin(2*x)'
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
given: 'diff(cos(x)*tan(x),x)',
|
|
100
|
-
expected: '-sin(x)*tan(x)+cos(x)*sec(x)^2'
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
given: 'diff(sec(sqrt(cos(x^(4/5))^2)),x)',
|
|
104
|
-
expected: '(-4/5)*abs(cos(x^(4/5)))^(-1)*cos(x^(4/5))*sec(abs(cos(x^(4/5))))*sin(x^(4/5))*tan(abs(cos(x^(4/5))))*x^(-1/5)'
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
given: 'diff(log(log(log(cos(t*t)^z))),t)',
|
|
108
|
-
expected: '-2*cos(t^2)^(-1)*sin(t^2)*t*z*log(cos(t^2))^(-1)*log(log(cos(t^2))*z)^(-1)*z^(-1)'
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
given: 'diff(6*log(x)^(3*log(x^2)),x)',
|
|
112
|
-
expected: '36*(log(log(x))*x^(-1)+x^(-1))*log(x)^(6*log(x))'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
given: 'diff(sinh(x^2)^cos(x),x)',
|
|
116
|
-
expected: '(-log(sinh(x^2))*sin(x)+2*cos(x)*cosh(x^2)*sinh(x^2)^(-1)*x)*sinh(x^2)^cos(x)'
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
given: 'diff(tan(x)*tanh(x),x)',
|
|
120
|
-
expected: 'sec(x)^2*tanh(x)+sech(x)^2*tan(x)'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
given: 'diff(4*x*tan(x)*7*tanh(x),x)',
|
|
124
|
-
expected: '28*(sec(x)^2*tanh(x)*x+sech(x)^2*tan(x)*x+tan(x)*tanh(x))'
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
given: 'diff(y*tan(y)*7*tanh(y),x)',
|
|
128
|
-
expected: '0'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
given: 'diff(yx*tan(y)*7*tanh(y),x)',
|
|
132
|
-
expected: '0'
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
given: 'diff(y,x)',
|
|
136
|
-
expected: '0'
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
given: 'diff(x*y,x)',
|
|
140
|
-
expected: 'y'
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
given: 'diff([sin(x), x^2, x],x)',
|
|
144
|
-
expected: '[cos(x),2*x,1]'
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
given: 'diff(sinc(a*x^3+b),x)',
|
|
148
|
-
expected: '3*((a*x^3+b)*cos(a*x^3+b)-sin(a*x^3+b))*(a*x^3+b)^(-2)*a*x^2'
|
|
149
|
-
}
|
|
150
|
-
];
|
|
151
|
-
|
|
152
|
-
for (var i = 0; i < testCases.length; ++i) {
|
|
153
|
-
// when
|
|
154
|
-
var parsed = nerdamer(testCases[i].given);
|
|
155
|
-
|
|
156
|
-
// then
|
|
157
|
-
expect(parsed.toString()).toEqual(testCases[i].expected);
|
|
158
|
-
}
|
|
11
|
+
expect(nerdamer('diff(cos(x),x)').toString()).toEqual('-sin(x)');
|
|
12
|
+
expect(nerdamer('diff(log(x),x)').toString()).toEqual('x^(-1)');
|
|
13
|
+
expect(nerdamer('diff(tan(x),x)').toString()).toEqual('sec(x)^2');
|
|
14
|
+
expect(nerdamer('diff(4*tan(x)*sec(x),x)').toString()).toEqual('4*(sec(x)*tan(x)^2+sec(x)^3)');
|
|
15
|
+
expect(nerdamer('diff(sqrt(7),x)').toString()).toEqual('0');
|
|
16
|
+
expect(nerdamer('diff(4,x)').toString()).toEqual('0');
|
|
17
|
+
expect(nerdamer('diff(x^2,x)').toString()).toEqual('2*x');
|
|
18
|
+
expect(nerdamer('diff(2*x^2+4,x)').toString()).toEqual('4*x');
|
|
19
|
+
expect(nerdamer('diff(sqrt(x)*x,x)').toString()).toEqual('(3/2)*x^(1/2)');
|
|
20
|
+
expect(nerdamer('diff(sqrt(x)-1/sqrt(x),x)').toString()).toEqual('(1/2)*x^(-1/2)+(1/2)*x^(-3/2)');
|
|
21
|
+
expect(nerdamer('diff(x^2/3-3/x^2,x)').toString()).toEqual('(2/3)*x+6*x^(-3)');
|
|
22
|
+
expect(nerdamer('diff(sqrt(x)*(x^2+1),x)').toString()).toEqual('(1/2)*(1+x^2)*x^(-1/2)+2*x^(3/2)');
|
|
23
|
+
expect(nerdamer('diff(e^x/(e^x-1),x)').toString()).toEqual('(-1+e^x)^(-1)*e^x-(-1+e^x)^(-2)*e^(2*x)');
|
|
24
|
+
expect(nerdamer('diff(e^x,x)').toString()).toEqual('e^x');
|
|
25
|
+
expect(nerdamer('diff(e^x/x,x)').toString()).toEqual('-e^x*x^(-2)+e^x*x^(-1)');
|
|
26
|
+
expect(nerdamer('diff(tan(x)*log(1/cos(x)),x)').toString()).toEqual('-(-cos(x)^(-1)*sin(x)*tan(x)+log(cos(x))*sec(x)^2)');
|
|
27
|
+
expect(nerdamer('diff((2*x)^(e),x)').toString()).toEqual('2^e*e*x^(-1+e)');
|
|
28
|
+
expect(nerdamer('diff(2*cos(x)*log(x),x)').toString()).toEqual('2*(-log(x)*sin(x)+cos(x)*x^(-1))');
|
|
29
|
+
expect(nerdamer('diff(cos(5*x)*log(sec(sqrt(cos(x^(4/5))^2))/y^2)*y,x)').toString()).toEqual('(-4/5)*abs(cos(x^(4/5)))^(-1)*cos(x^(4/5))*sec(abs(cos(x^(4/5))))*sin(x^(4/5))*tan(abs(cos(x^(4/5))))*x^(-1/5)*y^(-2)*cos(5*x)*sec(abs(cos(x^(4/5))))^(-1)*y^3-5*log(sec(abs(cos(x^(4/5))))*y^(-2))*sin(5*x)*y');
|
|
30
|
+
expect(nerdamer('diff(x*cos(x)^log(x),x)').toString()).toEqual('(-cos(x)^(-1)*log(x)*sin(x)+log(cos(x))*x^(-1))*cos(x)^log(x)*x+cos(x)^log(x)');
|
|
31
|
+
expect(nerdamer('diff(cos(2*x),x)').toString()).toEqual('-2*sin(2*x)');
|
|
32
|
+
expect(nerdamer('diff(cos(x)*tan(x),x)').toString()).toEqual('-sin(x)*tan(x)+cos(x)*sec(x)^2');
|
|
33
|
+
expect(nerdamer('diff(sec(sqrt(cos(x^(4/5))^2)),x)').toString()).toEqual('(-4/5)*abs(cos(x^(4/5)))^(-1)*cos(x^(4/5))*sec(abs(cos(x^(4/5))))*sin(x^(4/5))*tan(abs(cos(x^(4/5))))*x^(-1/5)');
|
|
34
|
+
expect(nerdamer('diff(log(log(log(cos(t*t)^z))),t)').toString()).toEqual('-2*cos(t^2)^(-1)*sin(t^2)*t*z*log(cos(t^2))^(-1)*log(log(cos(t^2))*z)^(-1)*z^(-1)');
|
|
35
|
+
expect(nerdamer('diff(6*log(x)^(3*log(x^2)),x)').toString()).toEqual('36*(log(log(x))*x^(-1)+x^(-1))*log(x)^(6*log(x))');
|
|
36
|
+
expect(nerdamer('diff(sinh(x^2)^cos(x),x)').toString()).toEqual('(-log(sinh(x^2))*sin(x)+2*cos(x)*cosh(x^2)*sinh(x^2)^(-1)*x)*sinh(x^2)^cos(x)');
|
|
37
|
+
expect(nerdamer('diff(tan(x)*tanh(x),x)').toString()).toEqual('sec(x)^2*tanh(x)+sech(x)^2*tan(x)');
|
|
38
|
+
expect(nerdamer('diff(4*x*tan(x)*7*tanh(x),x)').toString()).toEqual('28*(sec(x)^2*tanh(x)*x+sech(x)^2*tan(x)*x+tan(x)*tanh(x))');
|
|
39
|
+
expect(nerdamer('diff(y*tan(y)*7*tanh(y),x)').toString()).toEqual('0');
|
|
40
|
+
expect(nerdamer('diff(yx*tan(y)*7*tanh(y),x)').toString()).toEqual('0');
|
|
41
|
+
expect(nerdamer('diff(y,x)').toString()).toEqual('0');
|
|
42
|
+
expect(nerdamer('diff(x*y,x)').toString()).toEqual('y');
|
|
43
|
+
expect(nerdamer('diff([sin(x), x^2, x],x)').toString()).toEqual('[cos(x),2*x,1]');
|
|
44
|
+
expect(nerdamer('diff(sinc(a*x^3+b),x)').toString()).toEqual('3*((a*x^3+b)*cos(a*x^3+b)-sin(a*x^3+b))*(a*x^3+b)^(-2)*a*x^2');
|
|
45
|
+
expect(nerdamer('diff(sqrt(e^x + a),x)').toString()).toEqual('(1/2)*(a+e^x)^(-1/2)*e^x');
|
|
159
46
|
});
|
|
160
47
|
|
|
161
48
|
it('should calculate sums correctly', function () {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
given: 'sum(x^2+x, x, 0, 10)',
|
|
170
|
-
expected: '440'
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
given: 'sum(x^2*z^2+x*y-z+1, x, 0, 10)',
|
|
174
|
-
expected: '-11*z+385*z^2+11+55*y'
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
given: 'sum(x^2*z^2+x*y-z+1, z, 0, 10)',
|
|
178
|
-
expected: '-44+11*x*y+385*x^2'
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
given: 'sum(sqrt(x)*sin(x), x, 0, 10)',
|
|
182
|
-
expected: '775334583/372372283'
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
given: 'sum(e^(-x^2*π/9),x,1,100)',
|
|
186
|
-
expected: '633863423979/633863423978'
|
|
187
|
-
},
|
|
188
|
-
];
|
|
189
|
-
|
|
190
|
-
for (var i = 0; i < testCases.length; ++i) {
|
|
191
|
-
// when
|
|
192
|
-
var parsed = nerdamer(testCases[i].given).evaluate();
|
|
193
|
-
|
|
194
|
-
// then
|
|
195
|
-
expect(parsed.toString()).toEqual(testCases[i].expected);
|
|
196
|
-
}
|
|
49
|
+
expect(nerdamer('sum(x+y, x, 0, 3)').evaluate().toString()).toEqual('4*y+6');
|
|
50
|
+
expect(nerdamer('sum(x^2+x, x, 0, 10)').evaluate().toString()).toEqual('440');
|
|
51
|
+
expect(nerdamer('sum(x^2*z^2+x*y-z+1, x, 0, 10)').evaluate().toString()).toEqual('-11*z+385*z^2+11+55*y');
|
|
52
|
+
expect(nerdamer('sum(x^2*z^2+x*y-z+1, z, 0, 10)').evaluate().toString()).toEqual('-44+11*x*y+385*x^2');
|
|
53
|
+
expect(nerdamer('sum(sqrt(x)*sin(x), x, 0, 10)').evaluate().toString()).toEqual('775334583/372372283');
|
|
54
|
+
expect(nerdamer('sum(e^(-x^2*π/9),x,1,100)').evaluate().toString()).toEqual('633863423979/633863423978');
|
|
197
55
|
});
|
|
198
|
-
|
|
199
|
-
it('should calculate the definite integral correctly', function () {
|
|
200
|
-
//I don't really care to read warnings
|
|
201
|
-
nerdamer.set('SILENCE_WARNINGS', true);
|
|
202
|
-
// given
|
|
203
|
-
var testCases = [
|
|
204
|
-
{
|
|
205
|
-
given: 'defint(cos(x),1,2,x)',
|
|
206
|
-
expected: '0.067826442018'
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
given: 'defint(cos(x)^3*x^2-1,-1,9)',
|
|
210
|
-
expected: '8.543016466395'
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
given: 'defint(cos(x^x),1,2,x)',
|
|
214
|
-
expected: '-0.27113666621'
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
given: 'defint(cos(x^log(sin(x))),2,3,x)',
|
|
218
|
-
expected: '0.805604089074'
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
given: 'defint(log(2*cos(x/2)),-π,π,x)',
|
|
222
|
-
expected: '0'
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
given: 'defint(log(cos(x/2)),-π,π,x)',
|
|
226
|
-
expected: '-4.355172180607'
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
given: 'defint(log(x+1), -1, 1, x)',
|
|
230
|
-
expected: '-0.6137056388801095'
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
given: 'defint(log(x), 0, 1, x)',
|
|
234
|
-
expected: '-1'
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
given: 'defint((x^2-3)/(-x^3+9x+1), 1, 3, x)',
|
|
238
|
-
expected: '0.732408192445406585'
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
given: 'defint(x*(x-5)^(1/2),5,8)',
|
|
242
|
-
expected: '23.555890982936999348'
|
|
243
|
-
}
|
|
244
|
-
];
|
|
245
56
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
57
|
+
it('should calculate the definite integral correctly', function () {
|
|
58
|
+
expect(round(nerdamer('defint(cos(x),1,2,x)').evaluate(), 14)).toEqual(round(0.067826442018, 14));
|
|
59
|
+
expect(round(nerdamer('defint(cos(x)^3*x^2-1,-1,9)').evaluate(), 14)).toEqual(round(8.543016466395, 14));
|
|
60
|
+
expect(round(nerdamer('defint(cos(x^x),1,2,x)').evaluate(), 14)).toEqual(round(-0.27113666621, 14));
|
|
61
|
+
expect(round(nerdamer('defint(cos(x^log(sin(x))),2,3,x)').evaluate(), 14)).toEqual(round(0.805604089074, 14));
|
|
62
|
+
expect(round(nerdamer('defint(log(2*cos(x/2)),-π,π,x)').evaluate(), 14)).toEqual(round(-0, 14));
|
|
63
|
+
expect(round(nerdamer('defint(log(cos(x/2)),-π,π,x)').evaluate(), 14)).toEqual(round(-4.355172180607, 14));
|
|
64
|
+
expect(round(nerdamer('defint(log(x+1), -1, 1, x)').evaluate(), 14)).toEqual(round(-0.6137056388801095, 14));
|
|
65
|
+
expect(round(nerdamer('defint(log(x), 0, 1, x)').evaluate(), 14)).toEqual(round(-1, 14));
|
|
66
|
+
expect(round(nerdamer('defint((x^2-3)/(-x^3+9x+1), 1, 3, x)').evaluate(), 14)).toEqual(round(0.732408192445406585, 14));
|
|
67
|
+
expect(round(nerdamer('defint(x*(x-5)^(1/2),5,8)').evaluate(), 14)).toEqual(round(23.555890982936999348, 14));
|
|
68
|
+
expect(round(nerdamer('defint(sqrt(4(x^2)+4), 0, 3)').evaluate(), 14)).toEqual(round(11.305279439735999908, 14));
|
|
253
69
|
});
|
|
254
|
-
|
|
255
|
-
xit('should calculate limits correctly', function () {
|
|
256
|
-
// given
|
|
257
|
-
var testCases = [
|
|
258
|
-
{
|
|
259
|
-
given: 'limit((2-2*x^2)/(x-1), x, 1)',
|
|
260
|
-
expected: '-4'
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
given: 'limit(1/2*(x^2 - 1)/(x^2 + 1), x, 3)',
|
|
264
|
-
expected: '2/5'
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
given: 'limit(tan(3*x)/tan(x), x, pi/2)',
|
|
268
|
-
expected: '1/3'
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
given: 'limit(cos(sin(x)+2), x, Infinity)',
|
|
272
|
-
expected: '[cos(1),cos(3)]'
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
given: 'limit(x/(3*abs(4*x)),x, 0)',
|
|
276
|
-
expected: '[-1/12,1/12]'
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
given: 'limit((4x^2-x)/(3x^2+x),x,∞)',
|
|
280
|
-
expected: '4/3'
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
given: 'limit((x^(1/2)+x^(-1/2))/(x^(1/2)-x^(-1/2)),x,Infinity)',
|
|
284
|
-
expected: '1'
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
given: 'limit((2sin(x)-sin(2x))/(x-sin(x)),x,0)',
|
|
288
|
-
expected: '6'
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
given: 'limit((3*sin(x)-sin(2*x))/(x-sin(x)),x,0)',
|
|
292
|
-
expected: 'Infinity'
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
given: 'limit(x/(x+1)^2, x, -1)',
|
|
296
|
-
expected: '-Infinity'
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
given: 'limit((x+1)^(1+1/x)-x^(1+x),x, Infinity)',
|
|
300
|
-
expected: '-Infinity'
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
given: 'limit((2*x+log(x))/(x*log(x)),x,Infinity)',
|
|
304
|
-
expected: '0'
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
given: 'limit(log(x),x, 0)',
|
|
308
|
-
expected: 'Infinity'
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
given: 'limit(e^(-x)+2,x,Infinity)',
|
|
312
|
-
expected: '2'
|
|
313
|
-
}
|
|
314
|
-
];
|
|
315
|
-
|
|
316
|
-
for (var i = 0; i < testCases.length; ++i) {
|
|
317
|
-
// when
|
|
318
|
-
var parsed = nerdamer(testCases[i].given);
|
|
319
70
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
71
|
+
it('should calculate limits correctly', function () {
|
|
72
|
+
expect(nerdamer('limit((2-2*x^2)/(x-1), x, 1)').toString()).toEqual('-4');
|
|
73
|
+
expect(nerdamer('limit(1/2*(x^2 - 1)/(x^2 + 1), x, 3)').toString()).toEqual('2/5');
|
|
74
|
+
expect(nerdamer('limit(tan(3*x)/tan(x), x, pi/2)').toString()).toEqual('1/3');
|
|
75
|
+
expect(nerdamer('limit(x/(3*abs(4*x)),x, 0)').toString()).toEqual('[-1/12,1/12]');
|
|
76
|
+
expect(nerdamer('limit((4x^2-x)/(3x^2+x),x,∞)').toString()).toEqual('4/3');
|
|
77
|
+
expect(nerdamer('limit((x^(1/2)+x^(-1/2))/(x^(1/2)-x^(-1/2)),x,Infinity)').toString()).toEqual('1');
|
|
78
|
+
expect(nerdamer('limit((2*x+log(x))/(x*log(x)),x,Infinity)').toString()).toEqual('0');
|
|
79
|
+
expect(nerdamer('limit(e^(-x)+2,x,Infinity)').toString()).toEqual('2');
|
|
80
|
+
expect(nerdamer('limit((x+1)^(1+1/x)-x^(1+x),x, Infinity)').toString()).toEqual('-Infinity');
|
|
81
|
+
expect(nerdamer('limit(x/(x+1)^2, x, -1)').toString()).toEqual('-Infinity');
|
|
82
|
+
|
|
83
|
+
// Revisit.
|
|
84
|
+
/*
|
|
85
|
+
expect(nerdamer('limit(cos(sin(x)+2), x, Infinity)').toString()).toEqual('[cos(1),cos(3)]');
|
|
86
|
+
expect(nerdamer('limit((2sin(x)-sin(2x))/(x-sin(x)),x,0)').toString()).toEqual('6');
|
|
87
|
+
expect(nerdamer('limit((3*sin(x)-sin(2*x))/(x-sin(x)),x,0)').toString()).toEqual('Infinity');
|
|
88
|
+
expect(nerdamer('limit(log(x),x, 0)').toString()).toEqual('Infinity');
|
|
89
|
+
*/
|
|
323
90
|
});
|
|
324
91
|
|
|
325
92
|
it('should integrate properly', function () {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
expected: 'a^(-1)*atan(a^(-1)*sqrt(3)^(-1)*x)*sqrt(3)^(-1)'
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
given: 'integrate(8*x^3/(6*x^2+3*a^2), x)',
|
|
418
|
-
expected: '8*((-1/24)*a^2*log(2*x^2+a^2)+(1/12)*x^2)'
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
given: 'integrate(10*q/(4*x^2+24*x+20), x)',
|
|
422
|
-
expected: '10*((-1/16)*log(5+x)+(1/16)*log(1+x))*q'
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
given: 'integrate(x/(x+a)^2, x)',
|
|
426
|
-
expected: '(a+x)^(-1)*a+log(a+x)'
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
given: 'integrate(sqrt(x-a), x)',
|
|
430
|
-
expected: '(2/3)*(-a+x)^(3/2)'
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
given: 'integrate(x^n*log(x), x)',
|
|
434
|
-
expected: '(1+n)^(-1)*log(x)*x^(1+n)-(1+n)^(-2)*x^(1+n)'
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
given: 'integrate(3*a*sec(x)^2, x)',
|
|
438
|
-
expected: '3*a*tan(x)'
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
given: 'integrate(a/(x^2+b*x+a*x+a*b),x)', //uglier for but still correct
|
|
442
|
-
expected: '(((-a^(-1)*b+1)^(-1)*a^(-1)*b+1)*a^(-1)*log(b+x)-(-a^(-1)*b+1)^(-1)*a^(-1)*log(a+x))*a'
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
given: 'integrate(log(a*x+b),x)',
|
|
446
|
-
expected: '((a*x+b)*log(a*x+b)-a*x-b)*a'
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
given: 'integrate(x*log(x),x)',
|
|
450
|
-
expected: '(-1/4)*x^2+(1/2)*log(x)*x^2'
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
given: 'integrate(log(a*x)/x,x)',
|
|
454
|
-
expected: '(1/2)*log(a*x)^2'
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
given: 'integrate(log(x)^2,x)',
|
|
458
|
-
expected: '-2*log(x)*x+2*x+log(x)^2*x'
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
given: 'integrate(t*log(x)^3,x)',
|
|
462
|
-
expected: '(-3*log(x)^2*x-6*x+6*log(x)*x+log(x)^3*x)*t'
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
given: 'integrate(e^x*sin(x),x)',
|
|
466
|
-
expected: '(1/2)*(-cos(x)*e^x+e^x*sin(x))'
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
given: 'integrate(e^x*sin(x),x)',
|
|
470
|
-
expected: '(1/2)*(-cos(x)*e^x+e^x*sin(x))'
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
given: 'integrate(e^(2*x)*sin(x),x)',
|
|
474
|
-
expected: '(4/5)*((-1/4)*cos(x)*e^(2*x)+(1/2)*e^(2*x)*sin(x))'
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
given: 'integrate(e^(2*x)*sin(x)*x,x)',
|
|
478
|
-
expected: '(-3/25)*e^(2*x)*sin(x)+(4/25)*cos(x)*e^(2*x)+(4/5)*((-1/4)*cos(x)*e^(2*x)+(1/2)*e^(2*x)*sin(x))*x'
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
given: 'integrate(x*log(x)^2,x)',
|
|
482
|
-
expected: '(-1/2)*log(x)*x^2+(1/2)*log(x)^2*x^2+(1/4)*x^2'
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
given: 'integrate(x^2*log(x)^2,x)',
|
|
486
|
-
expected: '(-2/9)*log(x)*x^3+(1/3)*log(x)^2*x^3+(2/27)*x^3'
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
given: 'integrate(x^2*e^(a*x),x)',
|
|
490
|
-
expected: '-2*(-a^(-2)*e^(a*x)+a^(-1)*e^(a*x)*x)*a^(-1)+a^(-1)*e^(a*x)*x^2'
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
given: 'integrate(8*e^(a*x^2),x)',
|
|
494
|
-
expected: '4*erf(sqrt(-a)*x)*sqrt(-a)^(-1)*sqrt(pi)'
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
given: 'integrate(5*x*e^(-8*a*x^2),x)',
|
|
498
|
-
expected: '(-5/16)*a^(-1)*e^(-8*a*x^2)'
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
given: 'integrate(x^2*sin(x),x)',
|
|
502
|
-
expected: '-cos(x)*x^2+2*cos(x)+2*sin(x)*x'
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
given: 'integrate(8*tan(b*x)^2,x)',
|
|
506
|
-
expected: '8*(-x+b^(-1)*tan(b*x))'
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
given: 'integrate(sec(a*x)^3,x)',
|
|
510
|
-
expected: '(1/2)*a^(-1)*log(sec(a*x)+tan(a*x))+(1/2)*a^(-1)*sec(a*x)*tan(a*x)'
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
given: 'integrate(sec(a*x)*tan(a*x),x)',
|
|
514
|
-
expected: 'a^(-1)*sec(a*x)'
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
given: 'integrate(3*a*cot(a*x)^4, x)',
|
|
518
|
-
expected: '3*((-1/3)*a^(-1)*cot(a*x)^3+a^(-1)*cot(a*x)+x)*a'
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
given: 'integrate(3*a*csc(a*x)^4, x)',
|
|
522
|
-
expected: '3*((-1/3)*a^(-1)*cot(a*x)*csc(a*x)^2+(-2/3)*a^(-1)*cot(a*x))*a'
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
given: 'integrate(1/8*a*2/(x^3+13*x^2+47*x+35),x)',
|
|
526
|
-
expected: '(1/4)*((-1/8)*log(5+x)+(1/12)*log(7+x)+(1/24)*log(1+x))*a'
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
given: 'integrate(a*2/(x^2+x),x)',
|
|
530
|
-
expected: '2*(-log(1+x)+log(x))*a'
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
given: 'integrate((x+7)/(x+1)^3,x)',
|
|
534
|
-
expected: '(-1/2)*(1+x)^(-1)+(-7/2)*(1+x)^(-2)+(-1/2)*(1+x)^(-2)*x'
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
given: 'integrate((3*x+2)/(x^2+x),x)',
|
|
538
|
-
expected: '2*log(x)+log(1+x)'
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
given: 'integrate([sin(x), x^2, x],x)',
|
|
542
|
-
expected: '[-cos(x),(1/3)*x^3,(1/2)*x^2]'
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
given: 'integrate(sinh(x),x)',
|
|
546
|
-
expected: 'cosh(x)'
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
given: 'integrate(cosh(x),x)',
|
|
550
|
-
expected: 'sinh(x)'
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
given: 'integrate(tanh(x),x)',
|
|
554
|
-
expected: 'log(cosh(x))'
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
given: 'integrate(sinh(x)*x,x)',
|
|
558
|
-
expected: '-sinh(x)+cosh(x)*x'
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
given: 'integrate((x^6+x^2-7)/(x^2+11), x)',
|
|
562
|
-
expected: '(-11/3)*x^3+(1/5)*x^5+122*x-1349*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)'
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
given: 'integrate(x^6/(x^2+11), x)',
|
|
566
|
-
expected: '(-11/3)*x^3+(1/5)*x^5+121*x-1331*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)'
|
|
567
|
-
},
|
|
568
|
-
{
|
|
569
|
-
given: 'integrate(x^2/(x^2+11))',
|
|
570
|
-
expected: '-11*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)+x'
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
given: 'integrate(tan(x)*csc(x), x)',
|
|
574
|
-
expected: 'log(sec(x)+tan(x))'
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
given: 'integrate(sinh(x)*e^x, x)',
|
|
578
|
-
expected: '(-1/2)*x+(1/4)*e^(2*x)'
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
given: 'integrate(sinh(x)*cos(x), x)',
|
|
582
|
-
expected: '(-1/4)*e^(-x)*sin(x)+(1/4)*cos(x)*e^(-x)+(1/4)*cos(x)*e^x+(1/4)*e^x*sin(x)'
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
given: 'integrate(cos(x^2), x)',
|
|
586
|
-
expected: 'integrate(cos(x^2),x)'
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
given: 'integrate(sqrt(a-x^2)*x^2, x)',
|
|
590
|
-
expected: '((-1/16)*cos(2*asin(sqrt(a)^(-1)*x))*sin(2*asin(sqrt(a)^(-1)*x))+(1/8)*asin(sqrt(a)^(-1)*x))*a^2'
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
given: 'integrate((1-x^2)^(3/2), x)',
|
|
594
|
-
expected: '(-3/16)*cos(2*asin(x))*sin(2*asin(x))+(-x^2+1)^(3/2)*x+(3/8)*asin(x)'
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
given: 'integrate((1-x^2)^(3/2)*x^2, x)',
|
|
598
|
-
expected: '(-1/32)*cos(2*asin(x))*sin(2*asin(x))+(-1/48)*cos(2*asin(x))^2*sin(2*asin(x))+(1/16)*asin(x)+(1/48)*sin(2*asin(x))'
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
given: 'integrate(cos(x)^2*sin(x)^4, x)',
|
|
602
|
-
expected: '(-1/32)*cos(2*x)*sin(2*x)+(-1/48)*sin(2*x)+(1/16)*x+(1/48)*cos(2*x)^2*sin(2*x)'
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
given: 'integrate(log(a*x+1)/x^2, x)',
|
|
606
|
-
expected: '(-log(1+a*x)+log(x))*a-log(1+a*x)*x^(-1)'
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
given: 'integrate(x^2*(1-x^2)^(5/2), x)',
|
|
610
|
-
expected: '(-1/128)*cos(2*asin(x))^3*sin(2*asin(x))+(-1/48)*cos(2*asin(x))^2*sin(2*asin(x))+(-3/256)*cos(2*asin(x))*sin(2*asin(x))+(1/48)*sin(2*asin(x))+(5/128)*asin(x)'
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
given: 'integrate(1/tan(a*x)^n, x)',
|
|
614
|
-
expected: 'integrate(tan(a*x)^(-n),x)'
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
given: 'integrate(sin(x)^2*cos(x)*tan(x), x)',
|
|
618
|
-
expected: '(-3/4)*cos(x)+(1/12)*cos(3*x)'
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
given: 'integrate(cos(x)^2/sin(x),x)',
|
|
622
|
-
expected: '-log(cot(x)+csc(x))+cos(x)'
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
given: 'integrate(cos(x)/x,x)',
|
|
626
|
-
expected: 'Ci(x)'
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
given: 'integrate(sin(x)/x,x)',
|
|
630
|
-
expected: 'Si(x)'
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
given: 'integrate(log(x)^3/x,x)',
|
|
634
|
-
expected: '(1/4)*log(x)^4'
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
given: 'integrate(tan(x)^2*sec(x), x)',
|
|
638
|
-
expected: '(-1/2)*log(sec(x)+tan(x))+(1/2)*sec(x)*tan(x)'
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
given: 'integrate(tan(x)/cos(x),x)',
|
|
642
|
-
expected: 'cos(x)^(-1)'
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
given: 'integrate(sin(x)^3/x,x)',
|
|
646
|
-
expected: '(-1/4)*Si(3*x)+(3/4)*Si(x)'
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
given: 'integrate(tan(x)/sec(x)*sin(x)/tan(x),x)',
|
|
650
|
-
expected: '(-1/2)*cos(x)^2'
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
given: 'integrate(log(x)^n/x,x)',
|
|
654
|
-
expected: '(1+n)^(-1)*log(x)^(1+n)'
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
given: 'integrate(1/(x^2+9)^3,x)',
|
|
658
|
-
expected: '(1/729)*((1/4)*cos(atan((1/3)*x))^3*sin(atan((1/3)*x))+(3/8)*atan((1/3)*x)+(3/8)*cos(atan((1/3)*x))*sin(atan((1/3)*x)))'
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
given: 'integrate(1/(a*x^2+b)^3,x)',
|
|
662
|
-
expected: '((1/4)*cos(atan(sqrt(a)^(-1)*sqrt(b)^(-1)*x))^3*sin(atan(sqrt(a)^(-1)*sqrt(b)^(-1)*x))+(3/8)*atan(sqrt(a)^(-1)*sqrt(b)^(-1)*x)+(3/8)*cos(atan(sqrt(a)^(-1)*sqrt(b)^(-1)*x))*sin(atan(sqrt(a)^(-1)*sqrt(b)^(-1)*x)))*b^(-3)'
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
given: 'integrate(asin(x)/sqrt(2-2x^2),x)',
|
|
666
|
-
expected: '(1/2)*asin(x)^2*sqrt(2)^(-1)'
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
given: 'integrate(atan(x)/(2+2*x^2),x)',
|
|
670
|
-
expected: '(1/4)*atan(x)^2'
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
given: 'integrate(1/(sqrt(1-1/x^2)*x^2), x)',
|
|
674
|
-
expected: 'asin(sqrt(-x^(-2)+1))'
|
|
675
|
-
},
|
|
676
|
-
{
|
|
677
|
-
given: 'integrate(1/(sqrt(1-1/x^2)*x), x)',
|
|
678
|
-
expected: '(-1/2)*log(1+sqrt(-x^(-2)+1))+(1/2)*log(-1+sqrt(-x^(-2)+1))'
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
given: 'integrate(exp(2*log(x)),x)',
|
|
682
|
-
expected: '(1/3)*x^3'
|
|
683
|
-
}
|
|
684
|
-
];
|
|
685
|
-
|
|
686
|
-
for (var i = 0; i < testCases.length; ++i) {
|
|
687
|
-
// when
|
|
688
|
-
var parsed = nerdamer(testCases[i].given);
|
|
689
|
-
|
|
690
|
-
// then
|
|
691
|
-
expect(parsed.toString()).toEqual(testCases[i].expected);
|
|
692
|
-
}
|
|
93
|
+
expect(nerdamer('integrate(sin(x), x)').toString()).toEqual('-cos(x)');
|
|
94
|
+
expect(nerdamer('integrate((22/7)^x,x)').toString()).toEqual('(log(1/7)+log(22))^(-1)*22^x*7^(-x)');
|
|
95
|
+
expect(nerdamer('integrate(cos(x), x)').toString()).toEqual('sin(x)');
|
|
96
|
+
expect(nerdamer('integrate(2*x^2+x, x)').toString()).toEqual('(1/2)*x^2+(2/3)*x^3');
|
|
97
|
+
expect(nerdamer('integrate(log(x), x)').toString()).toEqual('-x+log(x)*x');
|
|
98
|
+
expect(nerdamer('integrate(sqrt(x), x)').toString()).toEqual('(2/3)*x^(3/2)');
|
|
99
|
+
expect(nerdamer('integrate(asin(a*x), x)').toString()).toEqual('a^(-1)*sqrt(-a^2*x^2+1)+asin(a*x)*x');
|
|
100
|
+
expect(nerdamer('integrate(a/x, x)').toString()).toEqual('a*log(x)');
|
|
101
|
+
expect(nerdamer('integrate(x*e^x, x)').toString()).toEqual('-e^x+e^x*x');
|
|
102
|
+
expect(nerdamer('integrate(x^3*log(x), x)').toString()).toEqual('(-1/16)*x^4+(1/4)*log(x)*x^4');
|
|
103
|
+
expect(nerdamer('integrate(x^2*sin(x), x)').toString()).toEqual('-cos(x)*x^2+2*cos(x)+2*sin(x)*x');
|
|
104
|
+
expect(nerdamer('integrate(sin(x)*log(cos(x)), x)').toString()).toEqual('-cos(x)*log(cos(x))+cos(x)');
|
|
105
|
+
expect(nerdamer('integrate(x*asin(x), x)').toString()).toEqual('(-1/4)*asin(x)+(1/2)*asin(x)*x^2+(1/4)*cos(asin(x))*sin(asin(x))');
|
|
106
|
+
expect(nerdamer('integrate(q/((2-3*x^2)^(1/2)), x)').toString()).toEqual('asin(3*sqrt(6)^(-1)*x)*q*sqrt(3)^(-1)');
|
|
107
|
+
expect(nerdamer('integrate(1/(a^2+x^2), x)').toString()).toEqual('a^(-1)*atan(a^(-1)*x)');
|
|
108
|
+
expect(nerdamer('integrate(11/(a+5*r*x)^2,x)').toString()).toEqual('(-11/5)*(5*r*x+a)^(-1)*r^(-1)');
|
|
109
|
+
expect(nerdamer('integrate(cos(x)*sin(x), x)').toString()).toEqual('(-1/2)*cos(x)^2');
|
|
110
|
+
expect(nerdamer('integrate(x*cos(x)*sin(x), x)').toString()).toEqual('(-1/2)*cos(x)^2*x+(1/4)*cos(x)*sin(x)+(1/4)*x');
|
|
111
|
+
expect(nerdamer('integrate(t/(a*x+b), x)').toString()).toEqual('a^(-1)*log(a*x+b)*t');
|
|
112
|
+
expect(nerdamer('integrate(x*(x+a)^3, x)').toString()).toEqual('(1/2)*a^3*x^2+(1/5)*x^5+(3/4)*a*x^4+a^2*x^3');
|
|
113
|
+
expect(nerdamer('integrate(4*x/(x^2+a^2), x)').toString()).toEqual('2*log(a^2+x^2)');
|
|
114
|
+
expect(nerdamer('integrate(1/(x^2+3*a^2), x)').toString()).toEqual('a^(-1)*atan(a^(-1)*sqrt(3)^(-1)*x)*sqrt(3)^(-1)');
|
|
115
|
+
expect(nerdamer('integrate(8*x^3/(6*x^2+3*a^2), x)').toString()).toEqual('8*((-1/24)*a^2*log(2*x^2+a^2)+(1/12)*x^2)');
|
|
116
|
+
expect(nerdamer('integrate(10*q/(4*x^2+24*x+20), x)').toString()).toEqual('10*((-1/16)*log(5+x)+(1/16)*log(1+x))*q');
|
|
117
|
+
expect(nerdamer('integrate(x/(x+a)^2, x)').toString()).toEqual('(a+x)^(-1)*a+log(a+x)');
|
|
118
|
+
expect(nerdamer('integrate(sqrt(x-a), x)').toString()).toEqual('(2/3)*(-a+x)^(3/2)');
|
|
119
|
+
expect(nerdamer('integrate(x^n*log(x), x)').toString()).toEqual('(1+n)^(-1)*log(x)*x^(1+n)-(1+n)^(-2)*x^(1+n)');
|
|
120
|
+
expect(nerdamer('integrate(3*a*sec(x)^2, x)').toString()).toEqual('3*a*tan(x)');
|
|
121
|
+
expect(nerdamer('integrate(a/(x^2+b*x+a*x+a*b),x)').toString()).toEqual('(((-a^(-1)*b+1)^(-1)*a^(-1)*b+1)*a^(-1)*log(b+x)-(-a^(-1)*b+1)^(-1)*a^(-1)*log(a+x))*a');
|
|
122
|
+
expect(nerdamer('integrate(log(a*x+b),x)').toString()).toEqual('((a*x+b)*log(a*x+b)-a*x-b)*a');
|
|
123
|
+
expect(nerdamer('integrate(x*log(x),x)').toString()).toEqual('(-1/4)*x^2+(1/2)*log(x)*x^2');
|
|
124
|
+
expect(nerdamer('integrate(log(a*x)/x,x)').toString()).toEqual('(1/2)*log(a*x)^2');
|
|
125
|
+
expect(nerdamer('integrate(log(x)^2,x)').toString()).toEqual('-2*log(x)*x+2*x+log(x)^2*x');
|
|
126
|
+
expect(nerdamer('integrate(t*log(x)^3,x)').toString()).toEqual('(-3*log(x)^2*x-6*x+6*log(x)*x+log(x)^3*x)*t');
|
|
127
|
+
expect(nerdamer('integrate(e^x*sin(x),x)').toString()).toEqual('(1/2)*(-cos(x)*e^x+e^x*sin(x))');
|
|
128
|
+
expect(nerdamer('integrate(e^x*sin(x),x)').toString()).toEqual('(1/2)*(-cos(x)*e^x+e^x*sin(x))');
|
|
129
|
+
expect(nerdamer('integrate(e^(2*x)*sin(x),x)').toString()).toEqual('(4/5)*((-1/4)*cos(x)*e^(2*x)+(1/2)*e^(2*x)*sin(x))');
|
|
130
|
+
expect(nerdamer('integrate(e^(2*x)*sin(x)*x,x)').toString()).toEqual('(-3/25)*e^(2*x)*sin(x)+(4/25)*cos(x)*e^(2*x)+(4/5)*((-1/4)*cos(x)*e^(2*x)+(1/2)*e^(2*x)*sin(x))*x');
|
|
131
|
+
expect(nerdamer('integrate(x*log(x)^2,x)').toString()).toEqual('(-1/2)*log(x)*x^2+(1/2)*log(x)^2*x^2+(1/4)*x^2');
|
|
132
|
+
expect(nerdamer('integrate(x^2*log(x)^2,x)').toString()).toEqual('(-2/9)*log(x)*x^3+(1/3)*log(x)^2*x^3+(2/27)*x^3');
|
|
133
|
+
expect(nerdamer('integrate(x^2*e^(a*x),x)').toString()).toEqual('-2*(-a^(-2)*e^(a*x)+a^(-1)*e^(a*x)*x)*a^(-1)+a^(-1)*e^(a*x)*x^2');
|
|
134
|
+
expect(nerdamer('integrate(8*e^(a*x^2),x)').toString()).toEqual('4*erf(sqrt(-a)*x)*sqrt(-a)^(-1)*sqrt(pi)');
|
|
135
|
+
expect(nerdamer('integrate(5*x*e^(-8*a*x^2),x)').toString()).toEqual('(-5/16)*a^(-1)*e^(-8*a*x^2)');
|
|
136
|
+
expect(nerdamer('integrate(x^2*sin(x),x)').toString()).toEqual('-cos(x)*x^2+2*cos(x)+2*sin(x)*x');
|
|
137
|
+
expect(nerdamer('integrate(8*tan(b*x)^2,x)').toString()).toEqual('8*(-x+b^(-1)*tan(b*x))');
|
|
138
|
+
expect(nerdamer('integrate(sec(a*x)^3,x)').toString()).toEqual('(1/2)*a^(-1)*log(sec(a*x)+tan(a*x))+(1/2)*a^(-1)*sec(a*x)*tan(a*x)');
|
|
139
|
+
expect(nerdamer('integrate(sec(a*x)*tan(a*x),x)').toString()).toEqual('a^(-1)*sec(a*x)');
|
|
140
|
+
expect(nerdamer('integrate(3*a*cot(a*x)^4, x)').toString()).toEqual('3*((-1/3)*a^(-1)*cot(a*x)^3+a^(-1)*cot(a*x)+x)*a');
|
|
141
|
+
expect(nerdamer('integrate(3*a*csc(a*x)^4, x)').toString()).toEqual('3*((-1/3)*a^(-1)*cot(a*x)*csc(a*x)^2+(-2/3)*a^(-1)*cot(a*x))*a');
|
|
142
|
+
expect(nerdamer('integrate(1/8*a*2/(x^3+13*x^2+47*x+35),x)').toString()).toEqual('(1/4)*((-1/8)*log(5+x)+(1/12)*log(7+x)+(1/24)*log(1+x))*a');
|
|
143
|
+
expect(nerdamer('integrate(a*2/(x^2+x),x)').toString()).toEqual('2*(-log(1+x)+log(x))*a');
|
|
144
|
+
expect(nerdamer('integrate((x+7)/(x+1)^3,x)').toString()).toEqual('(-1/2)*(1+x)^(-1)+(-7/2)*(1+x)^(-2)+(-1/2)*(1+x)^(-2)*x');
|
|
145
|
+
expect(nerdamer('integrate((3*x+2)/(x^2+x),x)').toString()).toEqual('2*log(x)+log(1+x)');
|
|
146
|
+
expect(nerdamer('integrate([sin(x), x^2, x],x)').toString()).toEqual('[-cos(x),(1/3)*x^3,(1/2)*x^2]');
|
|
147
|
+
expect(nerdamer('integrate(sinh(x),x)').toString()).toEqual('cosh(x)');
|
|
148
|
+
expect(nerdamer('integrate(cosh(x),x)').toString()).toEqual('sinh(x)');
|
|
149
|
+
expect(nerdamer('integrate(tanh(x),x)').toString()).toEqual('log(cosh(x))');
|
|
150
|
+
expect(nerdamer('integrate(sinh(x)*x,x)').toString()).toEqual('-sinh(x)+cosh(x)*x');
|
|
151
|
+
expect(nerdamer('integrate((x^6+x^2-7)/(x^2+11), x)').toString()).toEqual('(-11/3)*x^3+(1/5)*x^5+122*x-1349*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)');
|
|
152
|
+
expect(nerdamer('integrate(x^6/(x^2+11), x)').toString()).toEqual('(-11/3)*x^3+(1/5)*x^5+121*x-1331*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)');
|
|
153
|
+
expect(nerdamer('integrate(x^2/(x^2+11))').toString()).toEqual('-11*atan(sqrt(11)^(-1)*x)*sqrt(11)^(-1)+x');
|
|
154
|
+
expect(nerdamer('integrate(tan(x)*csc(x), x)').toString()).toEqual('log(sec(x)+tan(x))');
|
|
155
|
+
expect(nerdamer('integrate(sinh(x)*e^x, x)').toString()).toEqual('(-1/2)*x+(1/4)*e^(2*x)');
|
|
156
|
+
expect(nerdamer('integrate(sinh(x)*cos(x), x)').toString()).toEqual('(-1/4)*e^(-x)*sin(x)+(1/4)*cos(x)*e^(-x)+(1/4)*cos(x)*e^x+(1/4)*e^x*sin(x)');
|
|
157
|
+
expect(nerdamer('integrate(cos(x^2), x)').toString()).toEqual('integrate(cos(x^2),x)');
|
|
158
|
+
expect(nerdamer('integrate(sqrt(a-x^2)*x^2, x)').toString()).toEqual('((-1/16)*cos(2*asin(sqrt(a)^(-1)*x))*sin(2*asin(sqrt(a)^(-1)*x))+(1/8)*asin(sqrt(a)^(-1)*x))*a^2');
|
|
159
|
+
expect(nerdamer('integrate((1-x^2)^(3/2), x)').toString()).toEqual('(-3/16)*cos(2*asin(x))*sin(2*asin(x))+(-x^2+1)^(3/2)*x+(3/8)*asin(x)');
|
|
160
|
+
expect(nerdamer('integrate((1-x^2)^(3/2)*x^2, x)').toString()).toEqual('(-1/32)*cos(2*asin(x))*sin(2*asin(x))+(-1/48)*cos(2*asin(x))^2*sin(2*asin(x))+(1/16)*asin(x)+(1/48)*sin(2*asin(x))');
|
|
161
|
+
expect(nerdamer('integrate(cos(x)^2*sin(x)^4, x)').toString()).toEqual('(-1/32)*cos(2*x)*sin(2*x)+(-1/48)*sin(2*x)+(1/16)*x+(1/48)*cos(2*x)^2*sin(2*x)');
|
|
162
|
+
expect(nerdamer('integrate(log(a*x+1)/x^2, x)').toString()).toEqual('(-log(1+a*x)+log(x))*a-log(1+a*x)*x^(-1)');
|
|
163
|
+
expect(nerdamer('integrate(x^2*(1-x^2)^(5/2), x)').toString()).toEqual('(-1/128)*cos(2*asin(x))^3*sin(2*asin(x))+(-1/48)*cos(2*asin(x))^2*sin(2*asin(x))+(-3/256)*cos(2*asin(x))*sin(2*asin(x))+(1/48)*sin(2*asin(x))+(5/128)*asin(x)');
|
|
164
|
+
expect(nerdamer('integrate(1/tan(a*x)^n, x)').toString()).toEqual('integrate(tan(a*x)^(-n),x)');
|
|
165
|
+
expect(nerdamer('integrate(sin(x)^2*cos(x)*tan(x), x)').toString()).toEqual('(-3/4)*cos(x)+(1/12)*cos(3*x)');
|
|
166
|
+
expect(nerdamer('integrate(cos(x)^2/sin(x),x)').toString()).toEqual('-log(cot(x)+csc(x))+cos(x)');
|
|
167
|
+
expect(nerdamer('integrate(cos(x)/x,x)').toString()).toEqual('Ci(x)');
|
|
168
|
+
expect(nerdamer('integrate(sin(x)/x,x)').toString()).toEqual('Si(x)');
|
|
169
|
+
expect(nerdamer('integrate(log(x)^3/x,x)').toString()).toEqual('(1/4)*log(x)^4');
|
|
170
|
+
expect(nerdamer('integrate(tan(x)^2*sec(x), x)').toString()).toEqual('(-1/2)*log(sec(x)+tan(x))+(1/2)*sec(x)*tan(x)');
|
|
171
|
+
expect(nerdamer('integrate(tan(x)/cos(x),x)').toString()).toEqual('cos(x)^(-1)');
|
|
172
|
+
expect(nerdamer('integrate(sin(x)^3/x,x)').toString()).toEqual('(-1/4)*Si(3*x)+(3/4)*Si(x)');
|
|
173
|
+
expect(nerdamer('integrate(tan(x)/sec(x)*sin(x)/tan(x),x)').toString()).toEqual('(-1/2)*cos(x)^2');
|
|
174
|
+
expect(nerdamer('integrate(log(x)^n/x,x)').toString()).toEqual('(1+n)^(-1)*log(x)^(1+n)');
|
|
175
|
+
expect(nerdamer('integrate(1/(x^2+9)^3,x)').toString()).toEqual('(1/729)*((1/4)*cos(atan((1/3)*x))^3*sin(atan((1/3)*x))+(3/8)*atan((1/3)*x)+(3/8)*cos(atan((1/3)*x))*sin(atan((1/3)*x)))');
|
|
176
|
+
expect(nerdamer('integrate(asin(x)/sqrt(2-2x^2),x)').toString()).toEqual('(1/2)*asin(x)^2*sqrt(2)^(-1)');
|
|
177
|
+
expect(nerdamer('integrate(atan(x)/(2+2*x^2),x)').toString()).toEqual('(1/4)*atan(x)^2');
|
|
178
|
+
expect(nerdamer('integrate(1/(sqrt(1-1/x^2)*x^2), x)').toString()).toEqual('asin(sqrt(-x^(-2)+1))');
|
|
179
|
+
expect(nerdamer('integrate(1/(sqrt(1-1/x^2)*x), x)').toString()).toEqual('(-1/2)*log(1+sqrt(-x^(-2)+1))+(1/2)*log(-1+sqrt(-x^(-2)+1))');
|
|
180
|
+
expect(nerdamer('integrate(exp(2*log(x)),x)').toString()).toEqual('(1/3)*x^3');
|
|
693
181
|
});
|
|
694
182
|
|
|
695
|
-
|
|
696
183
|
});
|