Fw: symbolic recombination
- To: mathgroup at smc.vnet.net
- Subject: [mg33288] Fw: symbolic recombination
- From: "Mark Morrissey" <mmorriss at ou.edu>
- Date: Wed, 13 Mar 2002 03:15:07 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Well, I just answered my own question. I hate it when I do that. It turned
out to be very simple. The following is the code. I'm learning.
In[1]:=
\!\(sum[x_] := \
Plus[y__[w_, t]] \[Rule]
HoldForm[Sum[y[i, t], \ {i, 1, n}]]\/Length[x] /. \
n \[Rule] 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\)\%4 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
----- Original Message -----
From: "Mark Morrissey" <mmorriss at ou.edu>
To: mathgroup at smc.vnet.net
Subject: [mg33288] symbolic recombination
> 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
>
>