Re: How to explain functions' linearity to Mathematica 5 ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg51087] Re: How to explain functions' linearity to Mathematica 5 ?*From*: pein <petsie at arcor.de>*Date*: Mon, 4 Oct 2004 06:17:53 -0400 (EDT)*References*: <cjojiq$aro$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Stepan Yakovenko schrieb: > Hello ! > > It would be great if someone will help me to find out a solution for a > small problem. > I have got an abstract function N0[i,j,r], where i and j are integers > and r is some formulae. > N0 has a feature: N0[i,j,r+s]=N0[i,j,r]+N0[i,j,s] and N0[i,j, a s]=a > N0[i,j,s]. I have got > a long expression like this: N0[1,2, > I*N0[4,1,r]+97*N0[4,3,5*N0[2,1,r]]]. I want it to get expanded > like this I*N0[1,2,N0[4,1,r]+5*97*N0[1,2,N0[4,3,N0[2,1,r]]]] with > Mathematica 5. How can I do it ? > > Thanx in advance. > > In[1]:= N0[i_, j_, x_ + y_] := N0[i, j, x] + N0[i, j, y]; N0[i_, j_, a_*x_] := a N0[i, j, x]; N0[1, 2, I*N0[4, 1, r] + 97*N0[4, 3, 5*N0[2, 1, r]]] Out[3]= I*N0[1, 2, N0[4, 1, r]] + 485*N0[1, 2, N0[4, 3, N0[2, 1, r]]] -- Peter Pein, Berlin