Re: Rule Writing for x and 1/x

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg813] Re: Rule Writing for x and 1/x
• From: danl (Daniel Lichtblau)
• Date: Mon, 24 Apr 1995 01:08:06 -0400
• Organization: Wolfram Research, Inc.

```In article <3mnk14\$dse at news0.cybernetics.net> REECE_D
<REECE+_D%A1%Electromagnetic_Sciences at mcimail.com> writes:
>    Is there a way to write a single rule in MMA which will turn J/s into
W
> and s/J into 1/W?
>
>    {J/s->W} only works for case#1.
>
>
>

You might try AlgebraicRules followed by Map/ReplaceAll. Example:

In[14]:= algrules = AlgebraicRules[j==s*w, {j, s, w}]
Out[14]= {j -> s w}

In[18]:= j/s + s/j + 3*s^2/j^2 - k*j^3/s^3;

In[19]:= Map[(#/. algrules)&, %]

3
AlgebraicRules::newv: -(j  k) involves variables not among {j, s, w}.

3    1          3
Out[19]= -- + - + w - k w
2   w
w

In[20]:= %18 /. algrules

AlgebraicRules::newv:
5       3  2      4      5
-(j  k) + j  s  + j s  + 3 s  involves variables not among {j, s, w}.

5    5      5  3      5  5
3 s  + s  w + s  w  - k s  w
Out[20]= -----------------------------
5  2
s  w

(* fails because it first applies Together when the input is
non-polynomial in the relevant variables *)

Daniel Lichtblau, WRI

```

• Prev by Date: ODE solver
• Next by Date: Re: Student version in high schools
• Previous by thread: Re: Rule Writing for x and 1/x
• Next by thread: Re: Rule Writing for x and 1/x