Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124799] Re: Mathematica question
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 7 Feb 2012 04:04:30 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 2/6/12 at 2:39 AM, hcohl001 at gmail.com (Howie) wrote:

>Let's say you've got an expression

>expr = {Sin[x] + x^2 - x^2*Cos[x], x^3 (1 + x^2) - x^3, x^4 - x^3}

>What does this mean?

>Table[expr[[j]] // FullSimplify[#, $assumptions] & /@ # & // Expand
>// @ # &, {j, 3}]

Until $assumptions is defined, it doesn't mean much. But perhaps
this is a typo and it should be the built-in symbol
$Assumptions. If so and $Assumptions has not been modified from
the default value the expression above has been made needlessly complex.

That is

Table[expr[[j]]//FullSimplify[#, $Assumptions]&, {j,3}]

is exactly equivalent to

Table[expr[[j]]//FullSimplify, {j,3]

which is exactly equivalent to

expr//FullSimplify

That is

In[5]:= (Table[
    expr[[j]] // FullSimplify[#, $Assumptions] & /@ # & //
     Expand //@ # &, {j, 3}]) == (expr // FullSimplify // Expand)

Out[5]= True

>I am new to Mathematica as far as these more complicated expressions
>are concerned.

>Can you explain symbol by symbol?

The # is a place holder in a pure function
The & is used to define a pure function.

So

=46ullSimplify[#, $assumptions] &

is a pure function that when used as

=46ullSimplify[#, $assumptions] &[expr]

or

=46ullSimplify[#, $assumptions] &@ expr

simply does a full simplification of expr

The /@ is short hand for Map, i.e.

=46ullSimplify[#, $assumptions] &/@expr is short hand for

Map[FullSimplify[#, $assumptions] &, expr]

But since FullSimplify does what it can on any expression, there
is no need to Map FullSimplify to each element of a list. That is,

Map[FullSimplify[#, $Assumptions] &, expr]

does the same as

=46ullSimpify[expr]

or

=46ullSimplify@expr (* pre-fix form *)

or

expr//FullSimplify (* post fix form *)

The same observations apply to Expand




  • Prev by Date: Re: Input cells destroy Grids?
  • Next by Date: Re: Mathematica question
  • Previous by thread: Re: Mathematica question
  • Next by thread: Re: Mathematica question