Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4629
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | Sam Takoy <sam.takoy@yahoo.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Function of N variable |
| Date | Sun, 28 Aug 2011 08:09:50 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <j3ct4e$5mb$1@smc.vnet.net> (permalink) |
| References | <201108271217.IAA17765@smc.vnet.net> <857CDCC2-6748-4EAD-B709-5092D1E6CBB6@gmail.com> |
| Reply-To | Sam Takoy <sam.takoy@yahoo.com> |
| Lines | 53 |
| NNTP-Posting-Date | 28 Aug 2011 07:12:27 GMT |
| NNTP-Posting-Host | e9345af3.news.twtelecom.net |
| X-Trace | DXC=_9X^e`<?\^aX>nWiR\He8`C_A=>8kQj6mm^eQlV`f18gSNHYe;0_B=eEFiONJ7[Gofhg^K8T:URjk |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:4629 |
Show key headers only | View raw
E.G, the following?
Grad[f_][x__] := Switch[Length[{x}],
1, {Derivative[1][f][x]},
2, {Derivative[1, 0][f][x], Derivative[0, 1][f][x]},
3, {Derivative[1, 0, 0][f][x], Derivative[0, 1, 0][f][x],
Derivative[0, 0, 1][f][x]},
4, {Derivative[1, 0, 0, 0][f][x], Derivative[0, 1, 0, 0][f][x],
Derivative[0, 0, 1, 0][f][x], Derivative[0, 0, 0, 1][f][x]}]
f[x_, y_] = x^2 + y^2;
Grad[f][x, y]
Thanks!
________________________________
From: Ethan Dyer <ethansdyer@gmail.com>
To: Sam Takoy <sam.takoy@yahoo.com>
Cc: "mathgroup@smc.vnet.net" <mathgroup@smc.vnet.net>
Sent: Saturday, August 27, 2011 9:24 AM
Subject: Re: Function of N variable
Sam,
Mathematica allows one to define functions that take an arbitrary number of arguments using double underscore (BlankSequence) or triple underscore (BlankNullSequence)
For instance F[args__]:={args} takes in any number of arguments except zero.
A function defined with three underscores can take any number including zero.
Ethan
On Aug 27, 2011, at 8:17 AM, Sam Takoy <sam.takoy@yahoo.com> wrote:
> Hi,
>
> I have put together a few function for differential geometry in 3D.
> All my functions were of the kind F(z1_, z2_, z3_). Now I want to
> generalize to 4D, then 5D, etc. Is there a good way to represent a
> function of N variables? For example, I want to be able to say grad[F]
> [???] to obtain a list of N function (partial derivatives) of N
> variables. I understand these are vague questions, but I am only
> looking for some keywords.
>
> Many thanks in advance,
>
>
> Sam
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Function of N variable Sam Takoy <sam.takoy@yahoo.com> - 2011-08-28 08:09 +0000
csiph-web