vector pattern?
- To: mathgroup at smc.vnet.net
- Subject: [mg20258] vector pattern?
- From: Susan Hovde <hovde at al.noaa.gov>
- Date: Sun, 10 Oct 1999 00:04:08 -0400
- Organization: NOAA Aeronomy Lab
- Sender: owner-wri-mathgroup at wolfram.com
I'd like to define a pattern for a 2D vector v such that v = {x,y} and v[t] = {x[t],y[t]}. I tried v[t___] := If[Count[{t},s_]==0,{x,y},{x[t],y[t]}] and this gets me _almost_ what I want. I get v[t] = {x[t], y[t]} and v[] = {x,y}, but when I ask for v, I just get v back. I then tried adding v := {x,y} but then when I ask for v[t] I get {x,y}[t] instead of {x[t],y[t]}. (I also tried v := v[] with the same result.) I have tried various Hold functions to try to get v not to be evluated too early, to no avail. Can someone help me out? Susan Hovde NOAA Aeronomy Lab Boulder, Colorado hovde at al.noaa.gov