Replacement?

• To: mathgroup at yoda.physics.unc.edu
• Subject: Replacement?
• From: francis at osiris.ucsd.edu (Francis)
• Date: Thu, 22 Apr 93 03:53:16 PDT

```
This may be a FAQ so apologies in advance.
Help. I don't know what I'm doing wrong here.
I simply want Mma to replace N q with Q everywhere mathematically
possible, so that N^2 q^2 would be replaced by Q^2,
N^3 q^2 by N Q^2 and so on.

I tried the below but it didn't work and I'm not sure where I went
wrong. My guess is that N q and N^2 q^2 "look" different to Mma
so it doesn't touch it. But of course, N N q q is replaced by Q^2.
Any help would be appreciated. Thanks in advance.

***

Mathematica 2.1 for SPARC
-- Athena graphics initialized --

In[1]:= Unprotect[Times]

Out[1]= {Times}

In[2]:= Unprotect[Power]

Out[2]= {Power}

In[3]:= N q = Q

Out[3]= Q

In[4]:= test = Simplify[N^2 q^2]

2  2
Out[4]= N  q

In[5]:= test2 = N^2 q^2 /. N q -> Q

2  2
Out[5]= N  q

In[6]:= test3 = Simplify[N^2 q^2]/.N q -> Q

2  2
Out[6]= N  q

In[7]:= test4 = Simplify[N^2 q^2 /. N q -> Q]

2  2
Out[7]= N  q

```

• Prev by Date: Re: Question about Display
• Next by Date: the size of frames
• Previous by thread: Plotting functions with different domain
• Next by thread: Re: Replacement?