Re: Re: Solve Minus Sign

• To: mathgroup at smc.vnet.net
• Subject: [mg106354] Re: [mg106306] Re: [mg106276] Solve Minus Sign
• From: Fabian Marcel <fabian.uriarte at gmail.com>
• Date: Sun, 10 Jan 2010 03:29:31 -0500 (EST)
• References: <31598130.1262849769674.JavaMail.root@n11>

```Thank you Andrzej, that was a nice little trick.

On Fri, Jan 8, 2010 at 6:26 AM, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
> Actually, in this particular case, one can do this in a simpler way:
>
> Collect[Solve[Rr/s == Rr + x, x], Rr]
>
> {{x -> (Rr*(1 - s))/s}}
>
> Andrzej Kozlowski
>
>
>
> On 8 Jan 2010, at 18:13, David Park wrote:
>
>> A pox on those minus signs!
>>
>> As far as I know, this requires doing surgery on expressions. Here are some
>> techniques.
>>
>> step1 = Solve[Rr/s == Rr + x, x][[1, 1]] // Factor
>>
>> x -> -((Rr (-1 + s))/s)
>>
>> The first method is to use Minus on the two different factors that contain
>> the minus signs.
>>
>> MapAt[Minus, step1, {{2, 1}, {2, 3}}]
>>
>> x -> (Rr (1 - s))/s
>>
>> A second method is to Simplify and then use Simplify again on a specific
>> part.
>>
>> Simplify[step1]
>> MapAt[Together, %, {{2, 2}}]
>>
>> x -> Rr (-1 + 1/s)
>> x -> (Rr (1 - s))/s
>>
>> With Presentations you can also operate on a specific subset of level parts,
>> in this case the two terms in the product.
>>
>> Needs["Presentations`Master`"]
>>
>> step1 // MapLevelParts[Expand, {2, {1, 3}}]
>>
>> x -> (Rr (1 - s))/s
>>
>> As far as I know, regular Mathematica doesn't have a way of operating
>> together on a subset of level parts in a sum or product.
>>
>> Another method with Presentations is to FactorOut a -1 from s-1 and
>> temporarily hold the result until the -1 can combine with the rest of the
>> expression.
>>
>> MapAt[FactorOut[-1, HoldForm], step1, {{2, 3}}] // ReleaseHold
>>
>> x -> (Rr (1 - s))/s
>>
>>
>> In general, the two main techniques for doing surgery on expressions are:
>>
>> 1) Operate on only selected portions of an expression using MapAt,
>> ReplacePart, or MapLevelParts.
>> 2) Shield portions of a expression using HoldForm, or CreateSubexpression in
>> Presentations, so Mathematica won't split them up when doing simplifications
>> on the larger expression.
>>
>>
>> David Park
>> djmpark at comcast.net
>> http://home.comcast.net/~djmpark/
>>
>>
>> From: Fabian [mailto:fabian.uriarte at gmail.com]
>>
>>
>> Dear Group-
>>
>>
>> In:
>> Factor[Solve[Rr/s == Rr + x, x]]
>>
>> Out:
>> {{x -> -((Rr (-1 + s))/s)}}
>>
>> We'd like Mathematica to provide answers with the minus sign
>> "multiplied through" (remove Factor[] doesn't solve the problem)
>>
>> Thank you in advance all.
>>
>>
>>
>
>

```

• Prev by Date: Re: Re: Re: algebraic numbers
• Next by Date: How to Modify Mathematica 7 Documentation Center Default Styles
• Previous by thread: Re: Re: Solve Minus Sign
• Next by thread: Integrate 'learns'?