Re: how to define a constant like Pi in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg63947] Re: [mg63936] how to define a constant like Pi in Mathematica
- From: Zhengji Li <zhengji.li at gmail.com>
- Date: Tue, 24 Jan 2006 01:30:32 -0500 (EST)
- References: <200601230911.EAA04902@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This works: c; SetAttributes[c, {ReadProtected, Constant}]; (* ReadProtected does the magic*) N[c] = 1.2345; c /: Re[c] = 1.2345; c /: Im[c] = 0; Then, Integrate[Exp[-c x ^2], {x, -Infinity, Infinity}] --> Sqrt[Pi/c] Sqrt[Pi/c] // N --> 1.59525 On 1/23/06, John Smith <doesnotexist at dread13.news.tele.dk> wrote: > I would like to define a constant in mathematica for example c=1.2345 in > such a way that it behaves exactly like Pi or E. > That is when I type c then I get the output c and not 1.2345. > If I do integration[Exp[-c*x^2],{x,-oo,oo}] then I should get sqrt[Pi/c] and > not If[c<0...] > > > -- Li Zhengji ------------------------------------------------------------- If all you have is a hammer, everything is a nail. -------------------------------------------------------------
- References:
- how to define a constant like Pi in Mathematica
- From: "John Smith" <doesnotexist@dread13.news.tele.dk>
- how to define a constant like Pi in Mathematica