MathGroup Archive 2006

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

Search the Archive

Re: General--Exponential simplifications by default


Thanks and basically I agree. However, a funny side effect is the
following:

Denominator[Exp[x] /. x -> -2 ]
gives
E^2

but

Denominator[FullForm[Exp[x]] /. x -> -2 ]
gives
1

In other words, wrapping the FullForm around an expression changes its
"meaning".
This contradicts the statement that
>>FullForm acts as a "wrapper", which affects printing, but not evaluation.<<
Or am I missing something?



Andrzej Kozlowski wrote:
> I do not consider any of these examples "a contradiction". What needs
> to be understood is the difference between certain Mathematica
> expressions before and after they are evaluated. In the case of your
> examples consider:
>
>
> Numerator[Unevaluated[Exp[-x]]]
>
> E^(-x)
>
> vs
>
> Numerator[Exp[-x]]
>
> 1
>
>
> Numerator[Unevaluated[1/Sqrt[2]]]
>
> 1
>
> vs
>
> Numerator[1/Sqrt[2]]
>
> Sqrt[2]
>
> The cause of the apparent problem is that Numerator does not hold its
> argument, so whiteout Unevaluated you are getting the numerator of
> the whatever your expression evaluates to, not of your actual input.
> TO get the latter you simply need to use Unevaluated.  This is no
> different from:
>
>
> Numerator[3/6]
>
> 1
>
> Numerator[Unevaluated[3/6]]
>
> 3
>
> If this is not a contradiction than neither are the other examples.
> Understanding the process of evaluation is perhaps the most important
> thing when using functional languages (not just Mathematica, the same
> sort of things occur, perhaps in an even more striking way,  in
> languages like Lisp ).
>
> Andrzej Kozlowski
>
>
>
> On 27 Aug 2006, at 07:24, p-valko at tamu.edu wrote:
>
> > Daniel,
> > Could you tell me why the contradiction?:
> >
> > In[14]:=Exp[-x]//InputForm
> > Out[14]//InputForm=E^(-x)
> >
> > In[15]:=Numerator[Exp[-x]]//InputForm
> > Out[15]//InputForm=1
> >
> > Mathematica automatically turns it into Power[E, Times[-1, x]], but
> > the user
> > beleives that the exponent is in the numerator.
> > What you see is not what you get!
> >
> >
> > My favorite contradiction is the following:
> >
> > In[24]:=Numerator[1/Sqrt[2]]//InputForm
> > Out[24]//InputForm=Sqrt[2]
> >
> > In[25]:=Denominator[1/Sqrt[2]]//InputForm
> > Out[25]//InputForm=2
> >
> > I think "Numerator" and "Denominator" should not be allowed to do
> > whatever they want. Too much liberty here...
> >
> > Peter
> >
> >
> > Daniel Lichtblau wrote:
> >> guillaume_evin at yahoo.fr wrote:
> >>> Hi !
> >>>
> >>> I want to avoid simplifications when Mathematica integrates
> >>> expressions with exponential terms. For example, I have :
> >>>
> >>> In[8]=      Espcond[y_] = Integrate[x*Densx[x, y], {x, 0,
> >>> Infinity}, Assumptions -> alpha > 0]
> >>> Out[8]=      E^(-2eta y)(-theta + E^(eta y)(2+theta))/(2alpha)
> >>>
> >>> I do not want to have a factorization by E^(-2eta y). More
> >>> precisely I would like to have the following result:
> >>> Out[8]=      (-theta E^(-2eta y)+ E^(-eta y)(2+theta))/(2alpha)
> >>>
> >>> I guess there is a way to tackle this problem with
> >>> "ComplexityFunction" and "Simplify", but I tried different things
> >>> such as "ComplexityFunction -> (Count[{#1}, Exp_, &#8734;] &)" in
> >>> the "Simplify" function but no change appears.
> >>>
> >>> Is someone could give me some tricks on how tu use the
> >>> "ComplexityFunction" ?
> >>>
> >>> Thank you in advance.
> >>>
> >>> Guillaume
> >>>
> >>> Link to the forum page for this post:
> >>> http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?
> >>> pageName=Special:Forum_ViewTopic&pid=12974#p12974
> >>> Posted through http://www.mathematica-users.org [[postId=12974]]
> >>
> >>
> >> Could Collect with respect to powers of the exponential.
> >>
> >> In[59]:= ee = E^(-2eta*y)*(-theta + E^(eta*y)(2+theta))/(2*alpha);
> >>
> >> In[60]:= InputForm[Collect[ee, Exp[eta*y]]]
> >> Out[60]//InputForm=
> >> -theta/(2*alpha*E^(2*eta*y)) + (2 + theta)/(2*alpha*E^(eta*y))
> >>
> >> Daniel Lichtblau
> >> Wolfram Research
> >


  • Prev by Date: Re: Re: Numerical evaluation is Mathematica bottleneck?!
  • Next by Date: a biased rant about exporting expressions
  • Previous by thread: Re: Re: General--Exponential simplifications by default
  • Next by thread: Re: Re: General--Exponential simplifications by default