Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.math.mathematica > #16864

Re: Better way to test the number of arguments?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newspeer1.nac.net!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Pavel Grinfeld <pgeipi10@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Better way to test the number of arguments?
Date Mon, 28 Apr 2014 01:45:23 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <ljkbrj$1u9$1@smc.vnet.net> (permalink)
References <20140427064225.DB5346A1C@smc.vnet.net>
Lines 67
Organization Time-Warner Telecom
NNTP-Posting-Date 28 Apr 2014 01:51:34 GMT
NNTP-Posting-Host 298ebe53.news.twtelecom.net
X-Trace DXC=JUE<7?;k36^Jfb:@jQ1\c[C_A=>8kQj6];[h;PUXBgbTfTF>IWQi=<\EFiONJ7[GoV<a2eT72dV8P
X-Complaints-To abuse@twtelecom.net
Xref csiph.com comp.soft-sys.math.mathematica:16864

Show key headers only | View raw


Thank you, Bob.
There's one difference in the output. If "f" is a vector(or tensor)-valued
function, I would like the new dimension to be first. For example if f is a
4x5 matrix and a function 1+7 variables, I would like the output to be
7x4x5.

How does one accomplish that?

Thanks again,

Pavel


On Sun, Apr 27, 2014 at 9:04 AM, Bob Hanlon <hanlonr357@gmail.com> wrote:

> CORRECTION
>
> I left off there blank on the function:
>
> ddSaPartial[f_][args__]  := D[f[args],  {Rest@{args}}]
>
>
> 2014-04-27 8:56 GMT-04:00 Bob Hanlon <hanlonr357@gmail.com>:
>
> ddSaPartial[f][args__]  := D[f[args],  {Rest@{args}}]
>>
>>
>>
>> Bob Hanlon
>>
>>
>> 2014-04-27 2:42 GMT-04:00 <pgeipi10@gmail.com>:
>>
>> Hi,
>>>
>>> I have the following code that produces the gradient of a function (with
>>> respect to all but the first variable). There is probably a better way that
>>> avoids the Switch.
>>>
>>> Thank you,
>>>
>>> Pavel
>>>
>>> ddSaPartial[func_][t_, s__] := Switch[Length[{s}],
>>>   1, {Derivative[0, 1][func][t, s]},
>>>   2, {Derivative[0, 1, 0][func][t, s],
>>>    Derivative[0, 0, 1][func][t, s]},
>>>   3, {Derivative[0, 1, 0, 0][func][t, s],
>>>    Derivative[0, 0, 1, 0][func][t, s],
>>>    Derivative[0, 0, 0, 1][func][t, s]},
>>>   4, {Derivative[0, 1, 0, 0, 0][func][t, s],
>>>    Derivative[0, 0, 1, 0, 0][func][t, s],
>>>    Derivative[0, 0, 0, 1, 0][func][t, s],
>>>    Derivative[0, 0, 0, 0, 1][func][t, s]},
>>>   5, {Derivative[0, 1, 0, 0, 0, 0][func][t, s],
>>>    Derivative[0, 0, 1, 0, 0, 0][func][t, s],
>>>    Derivative[0, 0, 0, 1, 0, 0][func][t, s],
>>>    Derivative[0, 0, 0, 0, 1, 0][func][t, s],
>>>    Derivative[0, 0, 0, 0, 0, 1][func][t, s]}
>>>
>>>
>>>
>>>
>>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: Better way to test the number of arguments? Pavel Grinfeld <pgeipi10@gmail.com> - 2014-04-28 01:45 +0000

csiph-web