MathGroup Archive 2002

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

Search the Archive

RE: arguments of the function

  • To: mathgroup at
  • Subject: [mg35427] RE: [mg35402] arguments of the function
  • From: "David Park" <djmp at>
  • Date: Fri, 12 Jul 2002 04:28:41 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

It is a little difficult to understand what you really want. Is it just the
particular expression

expr1 = a1* Cos[Sin[u[t + 2]]]/Tan[u[t + 1]] - Cot[u[t + 3]] + a2

that you want to make the substitutions in? Why don't you want Sin[u[t + 2]]
to be considered as an argument? Or a1, which is an argument of Times, or
a2, which is an argument of Plus? What is the purpose of making the
substitution? Is it just to obtain a shorter display?

If you are only seeking arguments that fit the pattern u[_] (or if they can
be described by a more general pattern) then you could use the following

GenSubstitutionRules[expr_] :=
  Module[{work, xsyms, i},
    work = Union[Cases[expr, u[_], Infinity]];
    xsyms = Table[Symbol["x" <> ToString[i]], {i, Length[work]}];
    Thread[work -> xsyms]

subrules = GenSubstitutionRules[expr1]
expr1 /. subrules
{u[1 + t] -> x1, u[2 + t] -> x2, u[3 + t] -> x3}
a2 + a1 Cos[Sin[x2]] Cot[x1] - Cot[x3]

In using Mathematica to solve real problems, you will very often have to
write some of your own routines. Mathematica couldn't possibly have a
specific routine for every task.

David Park
djmp at

> From: fee eerr [mailto:eleri111 at]
To: mathgroup at
> Hi.
> I am using Mathematica 4.0
> I can't find a function that would find arguments of the function.
> For example I have an equation:
> y[t+3]=a1* Cos[Sin[u[t+2]]]/Tan[u[t+1]]-Cot[u[t+3]]+a2
> and I would like to get those argumets u[t+3], u[t+2], u[t+1]
> and give them new values
> for example:
> x1=u[t+3]
> x2=u[t+2]
> x3=u[t+1]
> and then print that equation with new values:
> y[t+3]=a1* Cos[Sin[x2]]/Tan[x3]-Cot[x1]+a2
> Can you tell me how to do that?
> Thank you.

  • Prev by Date: Re: Why isn't Cancel more or less automatic?
  • Next by Date: RE: White border in plots
  • Previous by thread: Re: arguments of the function
  • Next by thread: White border in plots