Re: Positive[a] = True ???

• Subject: [mg2618] Re: [mg2518] Positive[a] = True ???
• From: johan at kajsa.isy.liu.se (Johan Gunnarsson)
• Date: Thu, 30 Nov 1995 20:58:27 -0500
• Approved: usenet@wri.com
• Distribution: local
• Newsgroups: wri.mathgroup
• Organization: Wolfram Research, Inc.

```
If the symbol a is positive then why cannot Mathematica simplify
Sqrt[a^2] to a?

In[1]:= Positive[a]^=True;

In[2]:= Simplify[Sqrt[a^2]]

2
Out[2]= Sqrt[a ]

/Johan

In article <48ejb3\$fi5 at ralph.vnet.net> Allan Hayes <hay at haystack.demon.co.uk> writes:

> Frank Domokos <domokos at chaph.usc.edu>
> in [mg2518] Positive[a] = True ???
>
> IN>> Positive[a] = True;
> OUT>> Set::write: Tag Positive in Positive[a] is Protected.
>
> Frank,
>
> Most system functions, like Positive, are protected (have the
> attribute Protected) to avoid unintentional changes. You cannot make
> a definition for them ("tagged" by them) without unprotecting them
> (see later).
>
> Here are some ways round this for your example
>
>
>    a. by using UpSet (^=) instead of Set (=):
>
>       Positive[a]^= True;
>
>    or, more specifically,
>
>    b. by using TagSet:
>
>       a/:Positive[a] = True;
>
> Or
>
> 2. Unprotect Positive to allow definitions to be tagged by it:
>
>    Unprotect[Positive];
>
>    Positive[a] = True;
>
>  (eventually re-protecting Positive)
>
>
> Of course if a is protected or is an expression with a protected
> head then you will need to unprotect either Positive or a or the
>
> Allan Hayes
> hay at haystack.demon.co.uk

--

_____________________________________________________
|    	Division of Automatic Control
/|\   	Dept. of EE, Linkoping University
/|\   	Tel: 	+46 13 282913
/ | \  	Fax: 	+46 13 282622
()  |  ()	Email: 	johan at isy.liu.se

```

• Prev by Date: Peculiar behavior of Integrate
• Next by Date: Re: Bug in symbolic inversion of matrices
• Previous by thread: RE: Positive[a] = True ???
• Next by thread: [Q] how fast is each machine with Mathematica ?