MathGroup Archive 2007

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

Search the Archive

Re: record intermediate steps

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73649] Re: record intermediate steps
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Fri, 23 Feb 2007 04:50:36 -0500 (EST)
  • References: <200702161021.FAA09937@smc.vnet.net><erc1vu$mm5$1@smc.vnet.net>

Hello Chris.

I have a question regarding your code.

Consider for example the thread with title
Showing that ArcSinh[2]/ArcCsch[2] is 3
from here:
http://groups.google.gr/group/comp.soft-sys.math.mathematica/browse_thread/
thread/e3a54d0fff7b596f/040152a96625a9df?hl=el#040152a96625a9df

Dana DeLouis' answer was

equ = TrigToExp[ArcSinh[2]/ArcCsch[2]];
avoid = Count[{#1}, _ArcSinh | _ArcCsch | _Log,
     Infinity] & ;
FullSimplify[equ, ComplexityFunction -> avoid]
3

So let use your code in order to get a list of
symbols called from the System` context during the simplification
process.

Quit;

equ = TrigToExp[ArcSinh[2]/ArcCsch[2]];
avoid = Count[{#1}, _ArcSinh | _ArcCsch | _Log,
Infinity] & ;

lst1 = Block[{$Output = {OpenWrite["C:\\msgStream.m"]}},
TracePrint[FullSimplify[equ, ComplexityFunction -> avoid],
      TraceInternal -> True]; Close /@ $Output];
Thread[Union[Cases[ReadList["C:\\msgStream.m",
HoldComplete[Expression]],
    symb_Symbol /; AtomQ[Unevaluated[symb]] &&
Context[Unevaluated[symb]] === "System`" :> HoldComplete[symb], {0,
Infinity},
    Heads -> True]], HoldComplete]

Here we use FullSimplify with the default settings

Developer`ClearCache []

lst2 = Block[{$Output = {OpenWrite["C:\\msgStream.m"]}},
TracePrint[FullSimplify[equ], TraceInternal -> True];
     Close /@ $Output];
Thread[Union[Cases[ReadList["C:\\msgStream.m",
HoldComplete[Expression]],
    symb_Symbol /; AtomQ[Unevaluated[symb]] &&
Context[Unevaluated[symb]] === "System`" :> HoldComplete[symb], {0,
Infinity},
    Heads -> True]], HoldComplete]

How can someone "use" Complement, Union, Intersection in lst1, lst2 in
order to see e.g. symbols called
during both processes?

Best Regards
Dimitris


=CF/=C7 Chris Chiasson =DD=E3=F1=E1=F8=E5:
> Also, if you make two lists of results, one from FullSimplify and one
> from Simplify, you can eliminate some functions to try, assuming one
> of the function names can simplify the expression in one step. Don't
> forget Developer`ClearCache between the two runs to cull out more
> functions.
>
> DeleteCases[Sequence@@HoldComplete@@@list1,HoldPattern@@Alternatives@@@li=
st2]
>
> On 2/19/07, Chris Chiasson <chris at chiasson.name> wrote:
> > If the list of expressions returned by TracePrint TraceInteral->True
> > is relatively complete, here is a method that will return a list of
> > symbols called from the System` context during the simplification.
> >
> > This code could easily be modified to assign the list of expressions
> > encountered during the evaluation to a variable, from which the
> > aforementioned list of symbols could be cross referenced (to see how
> > they were called)
> >
> > Block[{$Output=List@OpenWrite["C:\\msgStream.m"]},
> > TracePrint[FullSimplify[Cos[2*Pi/7]*Cos[4*Pi/7]*Cos[8*Pi/7]],TraceInter=
nal->True];
> > Close/@$Output];
> >
> > Thread[Union@Cases[ReadList["C:\\msgStream.m",
> > HoldComplete[Expression]],symb_Symbol/;AtomQ@Unevaluated@symb&&
> > Context@Unevaluated@symb==="System`":>HoldComplete@symb,{0,Infini=
ty},Heads->True],
> > HoldComplete]
> >
> >
> > --
> > http://chris.chiasson.name/
> >
>
>
> --
> http://chris.chiasson.name/



  • Prev by Date: Re: GUIKit tool to select frames
  • Next by Date: FullSimplify question
  • Previous by thread: Re: record intermediate steps
  • Next by thread: Re: record intermediate steps