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

• To: mathgroup at smc.vnet.net
• Subject: [mg62624] Re: Built-In fuctions redefined---How?
• From: Peter Pein <petsie at dordos.net>
• Date: Tue, 29 Nov 2005 06:43:40 -0500 (EST)
• References: <dmh92m\$8rj\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Virgil Stokes schrieb:
> 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
>
>
>

Hi!

Use Format:

In:=
Unprotect[Cos, Sin];
Format[Cos[x_] := "c" <> ToString[x]];
Format[Sin[x_] := "s" <> ToString[x]];

In:=
Expand[(Cos[x] + Sin[t])^3]
Out= "cx"^3 + 3*"cx"^2*"st" + 3*"cx"*"st"^2 + "st"^3

In:= TrigExpand[% /. t -> x]
Out= 1 + 2*"cx"*"sx"

Peter

```

• Prev by Date: Re: function of a function
• Next by Date: Re: Built-In fuctions redefined---How?
• Previous by thread: Re: Built-In fuctions redefined---How?
• Next by thread: Re: Built-In fuctions redefined---How?