Re: Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg74427] Re: Integrate*From*: "dimitris" <dimmechan at yahoo.com>*Date*: Wed, 21 Mar 2007 02:46:20 -0500 (EST)*References*: <etikok$j7r$1@smc.vnet.net><etnkbj$gmr$1@smc.vnet.net>

Hi again! > 1) These are really interesting examples of odd behaviour of our beloved > CAS (related to Integration) you have been digging up. You even found= undocumented features...! If you are refered to the setting which appeared in Integrate[Log[Sin[x]^2]*Tan[x],{x,0,Pi/2,Pi}] 0 yes, indeed, it is undocumentated BUT I have not discover it by my own! So, I must not take the acknowlogment! It's long time ago I encountered it! BTW, I copied from NIntegrate... NIntegrate[f, {x, a1, a2, ... , ak}] tests for singularities at each of the intermediate points ai. If there are no singularities, the result is equivalent to an integral from a1 to ak. You can use complex numbers ai to specify an integration contour in the complex plane. So even if someone hasn't encountered it anywhere, he could (using his imagination!) try to this setting to Integrate. > 2) Unfortunately, we cannot know in more detail why all this happens, bec= ause > we do not know how it really operates internally. And the devellopers= who know, obviously do not > want to answer??? Believe me but if you are not interested in Computer Algebra, you will not want to see the internals of Integrate! I will make use of two codes: One is adopted from M. Trott's Guidebook for Programming and the other is due to Chris Chiasson Copy/Paste the following in a notebook, select the cell and press Shift +Enter(you must be patient!) (* keep where messages are sent to *) old$Messages = $Messages; (* a bag for collecting the steps *) bag = {}; (* as a side effect, collect all steps *) $MessagePrePrint = AppendTo[bag, #]&; (* redirect messages *) $Messages = nowhere; On[]; (* do the integration *) Integrate[Exp[x^3], x]; Off[]; (* restore where messages are sent to *) $Messages = old$Messages; $MessagePrePrint = Short; Inside bag, we collected a lot of information about the more the thousands steps that were carried out. {Depth[bag], Length[bag], ByteCount[bag], LeafCount[bag], StringLength[ToString[FullForm[bag]]]} {22,10002,1758912,87595,968351} Take[bag, 100] Take[bag,-100] Developer`ClearCache[] Chris's code: Block[{$Output = {OpenWrite["C:\\msgStream.m"]}}, TracePrint[Integrate[Exp[x^3], x], 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] You must keep in your mind that Mathematica does not use the human way whan evaluating an integral! You have your mind and you can think of partial integration, smart substitutions and the stuff but CASs are not so...smart! That's why there is Risch Algorithm and other algorithms for symbolic integration. Let's see an example to understand it! The following integral is really challenging for Mathematica: f = HoldForm[Integrate[Sqrt[Sin[x]]/(Sqrt[Sin[x]] + Sqrt[Cos[x]]), {x, 0, Pi/2}]] Timing[f//ReleaseHold] {66.78099999999999*Second, Pi/4} A check confirms that it indeed the right answer! {N[Pi/4],f/.Integrate->NIntegrate//ReleaseHold} {0.785398,0.785398} However for a man this integral is rather trivial! Try the substitution x=Pi/2-y and we will finally have (by hand!) 2f=Pi/2 and so f=Pi/4 in less than 10 seconds! (so I count my time performance!!!) As regards your statement about the developers. Search in the archives and you will see that most about the Integrate questions are replied in current basis. When there is no reply, you must think that the developers are also employers with some consequenses in their (spare) time! Also sometimes there is no a clear answer or the developers do not know to answer or to state it better is very difficult to find quickly an answer! For example the integral Integrate[Log[Sin[x]^2]*Tan[x],{x,0,Pi}] which is platform dependent! Someone must see where the Integration code fails in this integral in Win version and not in Mac! Tough activity! > I would like to mention that I also sent in a service call to Wolfram r= esearch > thanks to a Premier Service contract my company pays for. But never got= an answer. Do you think that may be they can't find an answer or they must search hard in order to find an answer??? BTW, I try the integral Integrate[Sqrt[Sin[x]]/(Sqrt[Sin[x]] + Sqrt[Cos[x]]), {x, 0, Pi/2}] in another CAS and after five minutes I am still waiting for an answer! Regards Dimitris =CF/=C7 Michael Weyrauch =DD=E3=F1=E1=F8=E5: > Hello , > > sorry for not writing earlier in response to your comments... > > 1) These are really interesting examples of odd behaviour of our beloved > CAS (related to Integration) you have been digging up. You even found= undocumented features...! > > 2) Unfortunately, we cannot know in more detail why all this happens, bec= ause > we do not know how it really operates internally. And the devellopers= who know, obviously do not > want to answer??? > > 3) For now I am glad that I have your workaround for my problem. > > I would like to mention that I also sent in a service call to Wolfram= research > thanks to a Premier Service contract my company pays for. But never g= ot an answer. > > I perfectly understand that such a huge and difficult program as Math= ematica has problems > in some odd corners. And sometimes I really got great support and hel= p in surmounting my problems > by the support engineers or the devellopers, but here .... zero ...= I wonder, if anybody else had similar experience > recently ?? > > Regards Michael Weyrauch