symbolic recombination
- To: mathgroup at smc.vnet.net
- Subject: [mg33287] symbolic recombination
- From: "Mark Morrissey" <mmorriss at ou.edu>
- Date: Wed, 13 Mar 2002 03:15:04 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Folks - Below is the mathematica code to try to recombine a sum of s = u + r[1,t] + r[2,t] + r[3,t] + r[4,t] into the symbolic form of u + Sum[r[i,t],{i,1,Length[s]}]. Only it doesn't work the way I coded it. I tried 'ReleaseHold[Length[x]]', but it didn't work either. I trying to find or build generic code for sum recombination. Any ideas?? In[1]:= \!\(sum[x_] := \ Plus[y__[w_, t]] \[Rule] HoldForm[Sum[y[i, t], \ {i, 1, Length[x]}]]\/Length[x]\) In[2]:= \!\(R\&_\_t = \(\[Sum]\+\(i = 1\)\%4\((r[i, t] + \[Mu])\)\)\/4 /. \ R[i, t] \[Rule] r[i, t]\ + \ \[Mu]\ // \ Expand\) Out[2]= \!\(\[Mu] + 1\/4\ r[1, t] + 1\/4\ r[2, t] + 1\/4\ r[3, t] + 1\/4\ r[4, t]\) In[3]:= \!\(R\&_\_t /. sum[Rest[%]]\) Out[3]= \!\(\* RowBox[{"\[Mu]", "+", RowBox[{\(1\/4\), " ", TagBox[\(\[Sum]\+\(i = 1\)\%\(Length[1\/4\ r[1, t] + 1\/4\ r[2, t] + \ 1\/4\ r[3, t] + 1\/4\ r[4, t]]\)r[i, t]\), HoldForm]}]}]\) Thanks - Mark Mark Morrissey Associate Professor of Meteorology Associate State Climatologist for Research University of Oklahoma 710 Asp Ave, Suite 8 Norman, OK 73069 405 447-8412