Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: disable canceling

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106480] Re: [mg106465] disable canceling
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 14 Jan 2010 05:47:33 -0500 (EST)
  • References: <22549907.1263381381387.JavaMail.root@n11>

It would be useful to know what your objective is here. What do you mean by
"after evaluation get some expression"? Is this for didactic reasons?
Otherwise, what is gained by not canceling the factors?

In any case, you could use HoldForm on selected factors to prevent
canceling. But to do any real mathematics you will eventually have to use
ReleaseHold and at that point any matching factors will cancel.

g[s] = s HoldForm[s + 1]/((s + 1) (s + 2)) 
% // ReleaseHold 

(s (s+1))/((1+s) (2+s)) 
s/(2+s)

g[s] = HoldForm[s (s + 1)]/(s + 2); 
c[s] = 1/(s (s + 1)); 
l[s] = g[s] c[s] 
% // ReleaseHold 

s (s+1)/(s (1+s) (2+s))  
1/(2+s) 

Sometimes there might be meaningful math that can be done while part of an
expression is held and them when the Hold is released it will no longer
simplify as before. The Presentations package has a CreateSubexpression
command that holds a sub-expression with a Tooltip and a tag so one can more
easily control the evaluations. 

Presentations also has a MultiplyByOne command that multiplies the Numerator
and Denominator of an expression by the same factor, but allows operations
on the two parts so the factor does not automatically cancel. For example,
we could construct g[s] by:

Needs["Presentations`Master`"]

s/(s + 2); 
% // MultiplyByOne[s + 1, Identity, Expand]

(s + s^2)/((1 + s) (2 + s))

Here the final expression has nothing held. You might have defined it that
way in the first place.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Petr Martinec [mailto:petr.martinec at gmail.com] 

Hi all,
is here posibility to prevent canceling in Mathematica? I need it to
work with transfer and contreller functions (dynamic system theory). I
would like to input like this

g[s] = s (s + 1)/((s + 1) (s + 2));

and after evaluation get same expression. Another situation is:

input:

g[s] = s (s + 1)/(s + 2);
c[s] =1/(s(s + 1));
l[s] = g[s] c[s]

output:
l[s] = s(s + 1)/(s(s + 1)(s + 2))

It is possible to get this result?

thanks for your answers.




  • Prev by Date: Re: Re: Replace and ReplaceAll -- simple application
  • Next by Date: Re: default options, OptionsPattern[], and FilterRules[]
  • Previous by thread: Re: disable canceling
  • Next by thread: Re: Re: disable canceling