Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10703 > unrolled thread
| Started by | drehstuhl2@googlemail.com |
|---|---|
| First post | 2012-06-30 09:21 +0000 |
| Last post | 2012-07-01 06:05 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Rearranging terms - user-defined drehstuhl2@googlemail.com - 2012-06-30 09:21 +0000
Re: Rearranging terms - user-defined "Nasser M. Abbasi" <nma@12000.org> - 2012-07-01 06:05 +0000
| From | drehstuhl2@googlemail.com |
|---|---|
| Date | 2012-06-30 09:21 +0000 |
| Subject | Rearranging terms - user-defined |
| Message-ID | <jsmgen$1mf$1@smc.vnet.net> |
Does anyone know how to tell mathematica the following: I have an expression like: a + bx -by and I want to factorise it like: a + b(x-y) BUT: I want Mathematica to show the difference (x-y) whenever possible (in the different calculations - not just place b outside the bracket). That's because equations are easier to discuss if they are written in a special way. Another example would be: using probabilities, I always want to write mathematica -(1-p) instead of -p+1 throughout the notebook. Sorry, for postig such a beginners question. I know there were similar questions, but it did't help. Thanks a lot!
[toc] | [next] | [standalone]
| From | "Nasser M. Abbasi" <nma@12000.org> |
|---|---|
| Date | 2012-07-01 06:05 +0000 |
| Message-ID | <jsopau$pu$1@smc.vnet.net> |
| In reply to | #10703 |
On 6/30/2012 4:21 AM, drehstuhl2@googlemail.com wrote: > Does anyone know how to tell mathematica the following: > > I have an expression like: a + bx -by > and I want to factorise it like: a + b(x-y) > How about just simplify or collect? In[5]:= Simplify[a+b x-b y] Out[5]= a+b (x-y) In[6]:= Collect[a+b x-b y,b] Out[6]= a+b (x-y) > BUT: I want Mathematica to show the difference (x-y) whenever possible >(in the different calculations - not just place b outside the bracket). >That's because equations are easier to discuss if they are written in a special way. > do not understand this one. > Another example would be: using probabilities, I always want to write >mathematica -(1-p) instead of -p+1 throughout the notebook. > I do not know how to do this, because Mathematica evaluator will always simplify -(1-p) to -p+1, other than using HoldForm, but then you can't use the result without releasing the Hold: In[17]:= expr/.Plus[1,Times[-1,x_]]->HoldForm[-(1-x)] Out[17]= -(1-p) May be there is a way. I do not know myself now. --Nasser
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web