Re: simplifying algebraic expressions with Null
- To: mathgroup at smc.vnet.net
- Subject: [mg125133] Re: simplifying algebraic expressions with Null
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Thu, 23 Feb 2012 05:47:47 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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 at iee.lu<mailto:alexei.boulbitch at iee.lu>