Re: Solve Minus Sign
- To: mathgroup at smc.vnet.net
- Subject: [mg106306] Re: [mg106276] Solve Minus Sign
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 8 Jan 2010 04:13:26 -0500 (EST)
- References: <31598130.1262849769674.JavaMail.root@n11>
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- How can one get rid of the minus sign in: 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.
- Follow-Ups:
- Re: Re: Solve Minus Sign
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Solve Minus Sign