MathGroup Archive 1995

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

Search the Archive

Re: Programming Options for Power Expand

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg826] Re: Programming Options for Power Expand
  • From: Count Dracula <lk3a at kelvin.seas.virginia.edu>
  • Date: Mon, 24 Apr 1995 02:50:12 -0400
  • Organization: University of Virginia

In Message-ID <3mveno$r0s at news0.cybernetics.net> Jack Goldberg 
<jackgold at math.lsa.umich.edu> writes:


>                             InverseTrig->True acts like 
>  an option but it strikes me that it is in fact a second argument
>  to PowerExpand.  


Options can be added to functions as indicated in the PowerExpand
example below. The code incorporating the handling of the options
will of course be different for each case. The example below
handles a single option.


Unprotect[PowerExpand];

Options[PowerExpand] = Join[Options[PowerExpand], {InverseTrig -> False}];
 
PowerExpand[expr_, options__Rule] :=
 FixedPoint[ PowerExpand[# //. 
  If[InverseTrig /. {options} /. Options[PowerExpand], ArcRules, {}, {}]] &, expr];

Protect[PowerExpand];

ArcRules = { ArcTan[ Tan[x_] ] :> x, ArcTan[ Cot[x_] ] :> Pi/2 - x, 
             1 - Cos[x_]^2 :> Sin[x]^2, ArcSin[ Sin[x_] ] :> x };

ex1 := 1 + Log[ArcTan[Tan[Exp[x]]]];
ex2 := 1 + ArcTan[Log[Exp[Tan[x]]]];
ex3 := 1 + ArcSin[Sqrt[1-Cos[x]^2]];


Examples of Mma output after reading in the preceding file of
commands:

In[2]:= PowerExpand[ex1, InverseTrig -> True]

Out[2]= 1 + x

In[3]:= PowerExpand[ex1, InverseTrig -> False]
                            x
Out[3]= 1 + Log[ArcTan[Tan[E ]]]

In[4]:= PowerExpand[ex1]

                            x
Out[4]= 1 + Log[ArcTan[Tan[E ]]]

In[5]:= PowerExpand[ex1, InverseTrig -> Goose]

                            x
Out[5]= 1 + Log[ArcTan[Tan[E ]]]

In[6]:= PowerExpand[ex2, InverseTrig -> True]

Out[6]= 1 + x


In[7]:= PowerExpand[ex3, InverseTrig -> True]

Out[7]= 1 + x


-- 
 ___________________________________________________________________________________
 Levent Kitis           lk3a at cars.mech.virginia.edu    lk3a at kelvin.seas.virginia.edu
 University of Virginia  Department of Mechanical, Aerospace and Nuclear Engineering  
 ___________________________________________________________________________________


  • Prev by Date: Re: Submatrix with greatest determinant?
  • Next by Date: Re: CHAOS & MATH
  • Previous by thread: Re: Programming Options for Power Expand
  • Next by thread: Re: Programming Options for Power Expand