Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8708
| From | Alexei Boulbitch <Alexei.Boulbitch@iee.lu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: simplifying algebraic expressions with Null |
| Date | 2012-02-23 10:49 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ji55jf$78u$1@smc.vnet.net> (permalink) |
Hi,
how to simplify an algebraic expression such that if a Null expression
is present then the whole algebraic expression gets simplified to
Null?
I'm using Null to represent missing data values. So after some
calculations on data with missing values (Null) I get expressions
involving Null. I'd like to simplify it to Null.
Example:
x=List[List[1,2],List[Plus[2,Null],3],List[4,5]];
Simplify x such that Plus[2,Null] gets replaced with Null, yielding,
lets say, y:
y=x // SpecialSimplification
List[List[1,2],List[Null,3],List[4,5]]
Obviously I'd want this to work on arrays, matrices, etc.. i.e.
applying the simplification up to the algebraic expression and not
further. I mean, I'd not want this to happen:
x=List[List[1,2],List[Plus[2,Null],3],List[4,5]];
y=x // SpecialSimplification
List[List[1,2],Null,List[4,5]]
or
x=List[List[1,2],List[Plus[2,Null],3],List[4,5]];
y=x // SpecialSimplification
Null
In other words, I'd like to be able to set the Null expression as the
absorbing element for any algebraic expression.
Thanks.
Hi, Ramiro,
What about this:
x=List[List[1,2],List[Subtract[2,Null],3],List[4,5]]
{{1,2},{2-Null,3},{4,5}}
x/.{a_+Null,b_}->Null/.{a_-Null,b_}->Null
{{1,2},Null,{4,5}}
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44
e-mail: alexei.boulbitch@iee.lu<mailto:alexei.boulbitch@iee.lu>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: simplifying algebraic expressions with Null Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-02-23 10:49 +0000
csiph-web