Re: Re: 1/Trig function - help
- To: mathgroup at smc.vnet.net
- Subject: [mg24280] Re: [mg24261] Re: [mg24248] 1/Trig function - help
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 7 Jul 2000 00:11:23 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Hartmut I noticed this too, after posting my first message. I considered sending a second one just to point this out but than I noticed that using HoldForm in this way may be a problem if one wanted to hold something else and then apply ReleaseHold globally. All your Held expressions would then evaluate. But of course this is a pretty unlikely situation, so this may well be the best general solution. Best regards Andrzej on 00.7.6 5:36 PM, Wolf Hartmut at hwolf at debis.com wrote: > Dear Andrzej, > > changing the output format is definitely the best way, I think. But then you > need not rename Sin to sin nor Cos to cos. It suffices to take the HoldForm > of the original functions. This then gives undisturbed calculus and a > seemless, clear appearance in print: > > > In[1]:= Unprotect[Csc, Sec]; > In[2]:= Format[Csc[x_]] := HoldForm[1/Sin[x]] > In[3]:= Format[Sec[x_]] := HoldForm[1/Cos[x]] > In[4]:= Protect[Csc, Sec]; > > In[5]:= D[Tan[x], x] > Out[5]= > 1 2 > (------) > Cos[x] > > In[6]:= % /. x -> 0 > Out[6]= 1 > > In[9]:= 1/Sin[y] > Out[9]= > 1 > ------ > Sin[y] > > In[10]:= % Cos[y] > Out[10]= Cot[y] > > >> -----Original Message----- >> From: Andrzej Kozlowski [SMTP:andrzej at tuins.ac.jp] To: mathgroup at smc.vnet.net >> Sent: Thursday, July 06, 2000 5:11 AM >> To: mathgroup at smc.vnet.net >> Subject: [mg24280] [mg24261] Re: [mg24248] 1/Trig function - help >> >> Here is one simple way which may perhaps be satisfactory: >> >> In[11]:= >> Unprotect[Csc, Sec]; >> In[12]:= >> Format[Csc[x_]] := 1/sin[x]; >> In[13]:= >> Format[Sec[x_]] := 1/cos[x]; >> In[14]:= >> Protect[Csc, Sec]; >> >> >> Now, for example: >> In[15]:= >> D[Tan[x], x] >> Out[15]= >> 1 2 >> (------) >> cos[x] >> >> You can still to comutations in the usual way: >> >> In[16]:= >> % /. x -> 0 >> Out[16]= >> 1 >> >> Andrzej >> -- >> Andrzej Kozlowski >> Toyama International University, JAPAN >> >> For Mathematica related links and resources try: >> <http://www.sstreams.com/Mathematica/> >> >> on 7/5/00 4:22 AM, zhl67 at my-deja.com at zhl67 at my-deja.com wrote: >> >>> Hello, >>> >>> For some reason I wish the trigonometric functions to the power of -1 >>> not automatically evaluated to some other trig functions. For instance, >>> I wish the out put of >>> >>> In[1]:= Sin[x]^(-1) >>> >>> remain unchanged or appears as >>> >>> 1 >>> Out[1]:=------- >>> Sin[x] >>> >>> but NOT Csc[x]. Is there any cost efficient way to do this? Adding >>> rules to Power function might do(I only wish this feature for certain >>> argumentx x), but it slows down the Power function at the same time. >>> >>> Liu Zhao >>> >>> >>> Sent via Deja.com http://www.deja.com/ >>> Before you buy. >>> >> > -- Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ http://sigma.tuins.ac.jp/