re: Specifying rules
- To: mathgroup at yoda.physics.unc.edu
- Subject: re: Specifying rules
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Wed, 15 Jun 94 16:01:33 EDT
>Hello, I have a problem with complex numbers ! > >I want to tell Mma that a is real, such that >Im[a+I] will give 1, >but I do not get this result. > >I have tried > >a /: Im[a]=0 > > >Can anyone help me ? > >============================================================================== >Marnix Van Daele >Universiteit Gent >Vakgroep Toegepaste Wiskunde en Informatica >Krijgslaan 281 - Gebouw S9 >B9000 Gent (Belgium) > >tel. 32-(0)9-264.48.09 >fax. 32-(0)9-264.49.95 >============================================================================== > The standard package Algebra`ReIm` should do it: In[]:= <<Algebra`ReIm` In[]:= a /: Im[a] = 0 Out[]= 0 In[]:= Im[a + I] Out[]= 1 ************************************************************************** * Paul A. Rubin Phone: (517) 336-3509 * * Department of Management Fax: (517) 336-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE