Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simple question on functions...

0 views
Skip to first unread message

monkeyboy

unread,
Oct 20, 2009, 9:51:07 PM10/20/09
to
Hello,

when using Maple to do simple calculus I usually have to explicitly
state the dependence of each variable in the expression....for example

c*(1-cos(x[1](t)))+x[2](t)^2/2

is there a way to declare generic functions of a dependent variable
say

x1 = x1(t) or x2 = x2(x,y,z)

and avoid having to do it repeatedly in an expression? so the above
would be...c*(1-cos(x1))+x2^2/2, but still have the dependence on "t"

Thank you

Ray Vickson

unread,
Oct 21, 2009, 2:46:31 AM10/21/09
to

In Maple 9.5:

f:=c*(1-cos(x1))+x2^2/2;
2
x2
f := c (1 - cos(x1)) + ---
2

> g:=subs({x1=x[1](t),x2=x[2](t)},f);

2
g := c (1 - cos(x[1](t))) + 1/2 x[2](t)

R.G. Vickson

monkeyboy

unread,
Oct 21, 2009, 7:39:16 PM10/21/09
to

Is there any other way besides subs? I thought there might be a way to
declare a generic function of several variables without have to give
the specifics...

A. van der Meer

unread,
Oct 22, 2009, 4:33:09 AM10/22/09
to
monkeyboy wrote:

use alias

alias(x1=x[1](t),x2=x[2](t)):
f := t -> c*(1-cos(x1))+x2^2/2;

Adri

0 new messages