~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to doc/info/Simplification.texi

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2010-04-30 13:30:33 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20100430133033-wtewap0zdnmsix1y
Tags: upstream-5.21.1
ImportĀ upstreamĀ versionĀ 5.21.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
 
169
169
@end defvr
170
170
 
171
 
@c NEEDS WORK
 
171
@c -----------------------------------------------------------------------------
172
172
@deffn {Function} expand (@var{expr})
173
173
@deffnx {Function} expand (@var{expr}, @var{p}, @var{n})
174
174
Expand expression @var{expr}.
198
198
@code{(x+1)^n} expanded where @code{n} is greater than @code{expop} then executing
199
199
@code{expand ((x+1)^n)} will work only if @code{maxposex} is not less than @code{n}.
200
200
 
 
201
@code{expand(expr, 0, 0)} causes a resimplification of @code{expr}. @code{expr}
 
202
is not reevaluated. In distinction from @code{ev(expr, noeval)} a special 
 
203
representation (e. g. a CRE form) is removed. See also @code{ev}.
 
204
 
201
205
The @code{expand} flag used with @code{ev} causes expansion.
202
206
 
203
207
The file @file{simplification/facexp.mac}
213
217
Brief function descriptions are available in @file{simplification/facexp.usg}.
214
218
A demo is available by doing @code{demo("facexp")}.
215
219
 
 
220
Examples:
 
221
@c ===beg===
 
222
@c expr:(x+1)^2*(y+1)^3;
 
223
@c expand(expr);
 
224
@c expand(expr,2);
 
225
@c expr:(x+1)^-2*(y+1)^3;
 
226
@c expand(expr);
 
227
@c expand(expr,2,2);
 
228
@c ===end===
 
229
@example
 
230
(%i1) expr:(x+1)^2*(y+1)^3;
 
231
                                      2        3
 
232
(%o1)                          (x + 1)  (y + 1)
 
233
(%i2) expand(expr);
 
234
       2  3        3    3      2  2        2      2      2
 
235
(%o2) x  y  + 2 x y  + y  + 3 x  y  + 6 x y  + 3 y  + 3 x  y
 
236
                                                 2
 
237
                                + 6 x y + 3 y + x  + 2 x + 1
 
238
 
 
239
(%i3) expand(expr,2);
 
240
                      2        3              3          3
 
241
(%o3)                x  (y + 1)  + 2 x (y + 1)  + (y + 1)
 
242
 
 
243
(%i4) expr:(x+1)^-2*(y+1)^3;
 
244
                                          3
 
245
                                   (y + 1)
 
246
(%o4)                              --------
 
247
                                          2
 
248
                                   (x + 1)
 
249
(%i5) expand(expr);
 
250
                 3               2
 
251
                y             3 y            3 y             1
 
252
(%o5)      ------------ + ------------ + ------------ + ------------
 
253
            2              2              2              2
 
254
           x  + 2 x + 1   x  + 2 x + 1   x  + 2 x + 1   x  + 2 x + 1
 
255
 
 
256
(%i6) expand(expr,2,2);
 
257
                                          3
 
258
                                   (y + 1)
 
259
(%o6)                            ------------
 
260
                                  2
 
261
                                 x  + 2 x + 1
 
262
@end example
 
263
 
 
264
Resimplify an expression without expansion:
 
265
 
 
266
@c ===beg===
 
267
@c expr:(1+x)^2*sin(x);
 
268
@c exponentialize:true;
 
269
@c expand(expr,0,0);
 
270
@c ===end===
 
271
@example
 
272
(%i7) expr:(1+x)^2*sin(x);
 
273
                                       2
 
274
(%o7)                           (x + 1)  sin(x)
 
275
(%i8) exponentialize:true;
 
276
(%o8)                                true
 
277
(%i9) expand(expr,0,0);
 
278
                                   2    %i x     - %i x
 
279
                         %i (x + 1)  (%e     - %e      )
 
280
(%o9)                  - -------------------------------
 
281
                                        2
 
282
@end example
 
283
 
216
284
@opencatbox
217
285
@category{Expressions}
218
286
@closecatbox