MathGroup Archive 2006

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

Search the Archive

Re: partials of Sum[x[i]^2, {i,1,n}] (e.g.)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69554] Re: partials of Sum[x[i]^2, {i,1,n}] (e.g.)
  • From: dimmechan at yahoo.com
  • Date: Fri, 15 Sep 2006 06:45:56 -0400 (EDT)
  • References: <eebfke$4d8$1@smc.vnet.net>

***Mathematica as far as I know can work with limits in symbolic form.

***You can define the function you are interested as follows:

In[63]:=
f[lst:{x_,y___}]:=Sum[(lst[[i]])^2,{i,1,Length[lst]}]

***where

In[70]:=
?___
Out[70]=
___ (three _ characters) or BlankNullSequence[ ] is a pattern object
that can \
stand for any sequence of zero or more Mathematica expressions. ___h or
\
BlankNullSequence[h] can stand for any sequence of expressions, all of
which \
have head h. More...

***Then e.g.

In[65]:=
D[f[{Cos[x],Sin[x],Tan[x],Exp[y]}],Sin[x]]
Out[65]=
2 Sin[x]

In[66]:=
D[f[{Cos[x],Sin[x],Tan[x],Exp[y]}],y]
Out[66]=
2*E^(2*y)

***In fact you do not need here the limits. Indeed

In[82]:=
f[lst:{x_,y___}]:=Apply[Plus,lst^2]

***where

In[80]:=
?Apply
Out[80]=
Apply[f, expr] or f @@ expr replaces the head of expr by f. Apply[f,
expr, \
levelspec] replaces heads in parts of expr specified by levelspec.
More...

***Then e.g.

In[84]:=
D[f[{Cos[x],Sin[x],Tan[x]}],Tan[x]]
Out[84]=
2*Tan[x]


Dimitris Anagnostou

Î?/Î? kj έγÏ?αÏ?ε:
> In symbolic manipulations, one often needs to leave some of the
> limits of an expression in symbolic form.  E.g. the n in:
>
>   f[x[1],...,x[n]] = Sum[x[i]^2, {i, 1, n}],
>
> (where I've used Mathematica notation loosely).
>
> Then one often finds derivations like
>
>   D[f[x[1],...,x[n]], x[k]] = 2 x[k], for all k in { 1,..., n }
>
> Is it possible to do something like this in Mathematica?
>
> More generally, can Mathematica fully understand expressions with
> symbolic limits?
>
> Basically, I have a slightly hairier expression that I want to take
> the partials of, set them all equal to zero to produce a system of
> n equations.  If that weren't enough, I'd like to solve this system
> of n equations using Mathematica.  This kind of manipulation is
> far more difficult, as far as symbolic math goes, than anything
> I've seen Mathematica do yet, because it requires Mathematica to
> understand the notion of an array with a "symbolic cardinality",
> but I thought I'd ask.
>
> Thanks!
>
> kj
> --
> NOTE: In my address everything before the first period is backwards;
> and the last period, and everything after it, should be discarded.


  • Prev by Date: Re: Batch evaluation of multiple notebooks?
  • Next by Date: Re: How to tell Mathematica to stop conditional testing in an If statment if one condition is niether True or False? McCarthy evaluation rules? 'and then' test?
  • Previous by thread: Re: partials of Sum[x[i]^2, {i,1,n}] (e.g.)
  • Next by thread: Re: three parallel methods for one sequence : Hermite like recurance->4th method