Re: Entering constant placeholders

*To*: mathgroup at smc.vnet.net*Subject*: [mg32340] Re: [mg32328] Entering constant placeholders*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Wed, 16 Jan 2002 03:29:46 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

The first strange thing about your question is why you thought you can use SetAttributes with an arbitrary number of parameters since Mathematica's help says nothing that would support this assumption. The second is that you do not need to tell Mathematica that a,b,c are constants to do what you want to do: all you need to do is to learn a bit of Mathematica syntax. Thus: In[1]:= D[(a*x^3+b*x^2+c*x+d),x] Out[1]= c + 2*b*x + 3*a*x^2 That's all. There are indeed situations when you need to tell mathematica that a,b,c (for example) are constants. One way is when you want (for a good reason!) to use the total derivative Dt: In[2]:= Dt[(a*x^3+b*x^2+c*x+d),x] Out[2]= c + 2*b*x + 3*a*x^2 + x^3*Dt[a, x] + x^2*Dt[b, x] + x*Dt[c, x] + Dt[d, x] In[3]:= SetAttributes[{a,b,c,d},Constant] In[4]:= Dt[(a*x^3+b*x^2+c*x+d),x] Out[4]= c + 2*b*x + 3*a*x^2 Of course if this is all you want to do you do not have a good reason to use Dt instead of D! Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Tuesday, January 15, 2002, at 04:30 PM, progman wrote: > I can't seem to make this work. When I enter the following, I get these > errors: > > SetAttributes[a,b,c, Constant] > > Syntax::tsntxi: "SetAttributes a,constant" is incomplete; more input is > needed. > > d(ax^3 + bx^2 + cx + d)/dx > > The answer should be 3ax^2+2bx+c . I can't figure out how to tell > mathematica that a,b, & c are constants. > > > > Thanks > > > > > > >