MathGroup Archive 2005

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

Search the Archive

Re: Built-In fuctions redefined---How?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62632] Re: [mg62589] Built-In fuctions redefined---How?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 30 Nov 2005 00:06:11 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

One approach that only affects the output.

$Post=(#/.
          {Sin[x_Symbol]/;StringLength[ToString[x]]==1:>
              ToExpression["s"<>ToString[x]],
            Cos[x_Symbol]/;StringLength[ToString[x]]==1:>
              ToExpression["c"<>ToString[x]]}&);

expr=Sin[x]^2+Cos[x]^2+Cos[y]-Sin[z]

cx^2 + sx^2 + cy - sz

expr//Simplify

cy - sz + 1


Bob Hanlon

> 
> From: Virgil Stokes <virgil.stokes at it.uu.se>
To: mathgroup at smc.vnet.net
> Date: 2005/11/29 Tue AM 04:44:26 EST
> Subject: [mg62632] [mg62589] Built-In fuctions redefined---How?
> 
> How can I introduce the following definitions:
> 
>     cx for Cos[x]
>   sx for Sin[x]
>  
> where, the argument x, will always be a single symbol, and then still be 
> able to use the trigonometric identities associated with Sin, Cos; e.g.,
> 
>   cx^2 + sx^2 = 1
> 
> Note, this is not  c x (3 symbol expression); but,  cx (2 symbol 
> expression).
> Why? Because I have some rather large matrices with many elements that 
> contain expressions in Cos and Sin terms that make printing and 
> displaying messy and using the MatrixForm can give truncation in the 
> printed output.
> 
> --V. Stokes
> 
> 
>   
> 
> 


  • Prev by Date: Re: 3D plot question
  • Next by Date: Re: 3D plot question
  • Previous by thread: Built-In fuctions redefined---How?
  • Next by thread: Re: Built-In fuctions redefined---How?