Re: Replacing expressions with smaller atoms

• To: mathgroup at smc.vnet.net
• Subject: [mg100471] Re: [mg100447] Replacing expressions with smaller atoms
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Fri, 5 Jun 2009 03:01:09 -0400 (EDT)
• References: <200906040733.DAA11881@smc.vnet.net>

```What you want could be difficult, since M can be expressed in terms of L
alone (in 4 ways):

Clear[M,L]
Factor /@ (M /.
Solve[{L == x^2 + x + 1, M == x + (x (x^2 + x + 1))^(1/2)}, M, x])

{1/2 (-1 - Sqrt[-3 + 4 L] - Sqrt[2] Sqrt[-L (1 + Sqrt[-3 + 4 L])]),
1/2 (-1 - Sqrt[-3 + 4 L] + Sqrt[2] Sqrt[-L (1 + Sqrt[-3 + 4 L])]),
1/2 (-1 + Sqrt[-3 + 4 L] - Sqrt[2] Sqrt[L (-1 + Sqrt[-3 + 4 L])]),
1/2 (-1 + Sqrt[-3 + 4 L] + Sqrt[2] Sqrt[L (-1 + Sqrt[-3 + 4 L])])}

But pattern matching saves the day:

m = x + (x (x^2 + x + 1))^(1/2);
ell = x^2 + x + 1;
m /. ell -> L

x + Sqrt[L x]

That required FullForm[ell] to be plainly visible in FullForm[m], so
things won't always be so simple.

Bobby

On Thu, 04 Jun 2009 02:33:09 -0500, Ben Forbes <bdforbes at gmail.com> wrote:

> If I define an atom eg L=x^2+x+1, is there a way to rewrite an
> expression with these atoms? For example:
>
> L=x^2+x+1
> M=x+(x(x^2+x+1))^(1/2)
>
> I would like some way to express this as x+(xL)^(1/2). Is this possible?
>

--
DrMajorBob at bigfoot.com

```

• Prev by Date: 1GB Kernel Memory Limit
• Next by Date: Re: what is my error?
• Previous by thread: Re: Replacing expressions with smaller atoms
• Next by thread: Re: Replacing expressions with smaller atoms