MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: problem with replace all and functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98722] Re: problem with replace all and functions
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 17 Apr 2009 04:26:32 -0400 (EDT)
  • References: <gs6pi2$h54$1@smc.vnet.net>

Hi,

it can't work.
Because when you

Subscript[punto, i_][t_]:=
Evaluate[{Subscript[x, i][t],Subscript[y, i][t]}/.sol3[[1]]]

Evaluate[] it, "i" is a symbol and not 1,2,3, ..
so the replacement can't find a pattern and will do nothing
You need

Subscript[punto, i_Integer][t_] :=
  Subscript[punto, i][
    t] = {Subscript[y, i][t], Subscript[y, i + 1][t]} /. sol3[[1]]

Regards
   Jens

wiso wrote:
> I've a lot of rules created by NDSolve:
> 
> {{Subscript[x, 1][t]->InterpolatingFunction[{{0.`,213.43887344465708`}}, 
> "<>"][t],
> Subscript[y, 1][t]->InterpolatingFunction[{{0.`,213.43887344465708`}}, "<>"]
> [t],
> Subscript[x, 2][t]->InterpolatingFunction[{{0.`,213.43887344465708`}}, "<>"]
> [t],
> Subscript[y, 2][t]->InterpolatingFunction[{{0.`,213.43887344465708`}}, "<>"]
> [t],
> ...
> 
> }}
> 
> I have defined:
> 
> Subscript[punto, 1][t_]:= 
> Evaluate[{Subscript[x, 1][t],Subscript[y, 1][t]}/.sol3[[1]]]
> 
> Subscript[punto, 2][t_]:=
> Evaluate[{Subscript[x, 2][t],Subscript[y, 2][t]}/.sol3[[1]]]
> 
> Subscript[punto, 3][t_]:=
> Evaluate[{Subscript[x, 3][t],Subscript[y, 3][t]}/.sol3[[1]]]
> 
> 
> it works, but it's not very good, I've want something like this:
> 
> Subscript[punto, i_][t_]:=
> Evaluate[{Subscript[x, i][t],Subscript[y, i][t]}/.sol3[[1]]]
> 
> but it doesn't work
> 
> 


  • Prev by Date: Re: Finding all n-partitions of a set
  • Next by Date: Re: Strange Output!!!Please help me thank you.
  • Previous by thread: problem with replace all and functions
  • Next by thread: Re: Contour Plots of Lists