MathGroup Archive 2006

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

Search the Archive

Re: Subvalues and Parameters in Differentiation and Usage Messages

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67786] Re: Subvalues and Parameters in Differentiation and Usage Messages
  • From: "James Gilmore" <james.gilmore at yale.edu>
  • Date: Fri, 7 Jul 2006 07:13:28 -0400 (EDT)
  • Organization: Yale University
  • References: <e8isfq$sp7$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi David,

With regard to your command completion comment, at least from my 
perspective, separating parameters from variables, although useful in some 
instances, does not seem to be in the spirit of the standardized Mathematica 
functional language of the kernel. Anyone please correct me if I'm wrong, 
but I don't know of a Kernel function with that syntax f[n][x], they are 
all: f[n,x]. So I think we should at least try to follow the WRI lead and 
maintain the standardized notation for our function.

As for the derivatives, writing the arguments in the standardized notation 
removes any ambiguity.
In[39]:=
D[foo[p, x], x]
Out[39]=
Derivative[0, 1][foo][p, x]

In[40]:=
D[foo[x, x], x]
Out[40]=
Derivative[0, 1][foo][x, x] + Derivative[1, 0][foo][x, x]

Also, what exactly does the subscript x represent in D[Subscript[f, x][x], 
x]? Is it the x component of a function? If so a "x" string removes any 
ambiguity yet still looks the same.
In[45]:=
D[Subscript[f, "x"][x], x]
Out[45]=
Derivative[1][Subscript[f, "x"]][x]

Cheers

James Gilmore


"David Park" <djmp at earthlink.net> wrote in message 
news:e8isfq$sp7$1 at smc.vnet.net...
>I wonder if there is a good reason Mathematica's treatment of subvalues, 
>especially in differentiation?
>
> But first I have a complaint about how they are treated in usage messages. 
> Here is a usage message for a function.
>
> foo::usage = "foo[parm][x] is an example for MathGroup.";
>
> If I type 'foo' and then use command completion (Shift-Ctrl-K) I obtain
> foo[parm] and not foo[parm][x], which I would much prefer. It seems to me 
> that it would not be difficult to fix Mathematica to go through to the 
> last of the square brackets.
>
> Now if I differentiate a foo expression as follows I get
>
> D[foo[p][x], x]
> foo[p]'[x]
>
> Now suppose I put x in the place of p. The subvalue might just be an 
> identifier and not a true variable. Then I obtain
>
> D[foo[x][x], x]
> foo[x]'[x]+foo'[x][x]
>
> I like the first term but I don't like the second term. Does this actually 
> make mathematical sense? Is it the chain rule? Is it the Leibniz rule? 
> Would there be anything incorrect in stipulating that differentiation 
> would be applied ONLY to the arguments in the LAST set of argument 
> brackets? Am I missing examples where the above output is meaningful and 
> desired?
>
> This would also save a lot of trouble with expressions such as
>
> D[Subscript[f, x][x], x]
> Derivative[1][Subscript[f, x]][x] +
>  Derivative[0, 1][Subscript][f, x][x]
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
> 


From bbhole at gmail.com  Thu Jul  6 19:14:07 2006
	by smc.vnet.net (8.8.8+Sun/8.8.8) with ESMTP id TAA14310
	for <mathgroup at smc.vnet.net>; Thu, 6 Jul 2006 19:14:04 -0400 (EDT)
        for <mathgroup at smc.vnet.net>; Thu, 06 Jul 2006 16:09:44 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references;
        b=hbYC2oPIe8ML98X4G9fLX6/DREt03ljROgQ3pVQiygCp/DLD62Ca/76rrV8prwjJIFlOQCmHKGhuGTv+x6/WfnX4ok0jwqD8iXE2uXJb6BBsSdtld378++VlQHEuFTkt9VLKiJBDIz7v7q/z/vle8mGkZBdGcw03d815Fh1Tlak=
        Thu, 06 Jul 2006 16:09:44 -0700 (PDT)
From: "Bharat Bhole" <bbhole at gmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg67786] Re: [mg67733] Re: Plot Question
	boundary="----=_Part_9424_10443490.1152227384481"
References: <e8fuqk$qov$1 at smc.vnet.net> <200607061052.GAA28407 at smc.vnet.net>

------=_Part_9424_10443490.1152227384481

Thanks to everyone for your suggestions. They were definitely helpful for
the problem I had this time. However, it was not exactly what i was looking
for. But, in David Park's answer to some other question I asked him, I
learnt another solution which is what I was looking for. Perhaps for this
particular problem it is not required, but in general maybe useful. I
suppose most of you who answered my earlier query, already know it, but
because it maybe useful to someone else like me, I am posting the
alternative solution that I learnt. Your comments are welcome.

f[x_]:=x+8

cost = Plot[f[x],{x,1,8},
   PlotRange->{{0,9},{8,16}},
   AxesOrigin->{0,8}];

I want to treat this plot as a primitive, so that the plotrange and other
properties do not change when I combine it another graphics object. The
other object I want to combine it with is a Text object (forgive my
terminology), which names the x-axis.

This can be done by using

costfix=Graphics[Rectangle[{0,0},{10,20},cost]];
labelX=Graphics[Text["NameX-Axis",{5,-0.5}]];
Show[costfix,labelX,PlotRange->All]

Even if I have used PlotRange->All in the Show statement, this does not
extend the axes of the original plot.

Thanks again to all who replied.

Bharat.





On 7/6/06, bghiggins at ucdavis.edu <bghiggins at ucdavis.edu> wrote:
>
> Bharat,
>
> Why not use the properties of Frame and then modify those options as
> you see fit. For example,
>
>
> Plot[10Exp[0.04x], {x, 1, 8}, PlotRange -> {{0, 9}, {8, 16}},
> AxesOrigin -> {0, 8},
>    Frame -> True, Axes -> True,
>         FrameLabel -> {"\nTemp", "f(x)\n"}, FrameStyle ->
> {{RGBColor[1,
>   1, 1]}, {RGBColor[1, 1, 1]}}, FrameTicks -> {Automatic,
>   Automatic, None, None}]
>
> If you do not want to have the label on the y-axis rotated add the
> option RotateLabel->False
>
>
> Cheers,
>
> Brian
>
> Bharat Bhole wrote:
> > Hello All:
> >
> > I have a 2-D Plot in which I want to restrict the display of y-axis from
> > 8-16, and of x-axis from 0-9. I achieve this using
> >
> > plot=Plot[function[x],{x,1,8}, PlotRange ->{{0,9},{8,16}},
> > AxesOrigin->{0,8}].
> >
> > Then I want to label the x and y-axes and this is where I am having
> trouble.
> > I want the x-axis label to appear just below the x-axis (and not at the
> end
> > of the axis, as option AxesLabel gives). So I use the Text command and
> > define
> >
> > labelX = Text["name-xaxis", {5,7}]
> >
> > Then I use,
> >
> > Show[ plot , labelX ]
> >
> > This, however, does not show name-xaxis, which I suppose is because it
> is
> > out of PlotRange specified in Plot command. If I modify the PlotRange in
> the
> > Show[ ] command to say
> >
> > Show[plot,labelX, PlotRange->{{0,9},{6,16}}]
> >
> > then it shows the  name-xaxis, however, it also extends the y-axis line
> to
> > y=5. How can I both, get the name to display and at the same time have
> the
> > y-axis start at value 8.
> >
> > Thanks in advance for your help.
> >
> > Bharat.
>
>


-- 
----------------------------------------------------------
"No problem can withstand the assault
of sustained thinking."
                                              Voltaire
----------------------------------------------------------

------=_Part_9424_10443490.1152227384481

<div>Thanks to everyone for your suggestions. They were definitely helpful for the problem I had this time. However, it was not exactly what i was looking for. But, in David Park's answer to some other question I asked him, I learnt another solution which is what I was looking for. Perhaps for this particular problem it is not required, but in general maybe useful. I suppose most of you who answered my earlier query, already know it, but because it maybe useful to someone else like me,&nbsp;I am posting the alternative solution that I learnt. Your comments are welcome.
</div>
<div>&nbsp;</div>
<div>f[x_]:=x+8</div>
<div>&nbsp;</div>
<div>cost = Plot[f[x],{x,1,8},<br>
<div style="DIRECTION: ltr"><span class="q">&nbsp; &nbsp;PlotRange-&gt;{{0,9},{8,16}},<br></span></div>
<div style="DIRECTION: ltr">&nbsp;&nbsp;&nbsp;AxesOrigin-&gt;{0,8}];</div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">I want to treat this plot as a primitive, so that the plotrange and other properties do not change when I combine it another graphics object. The other object&nbsp;I want to combine it with is a Text object (forgive my terminology), which names the x-axis. 
</div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">This can be done by using</div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">costfix=Graphics[Rectangle[{0,0},{10,20},cost]];</div>
<div style="DIRECTION: ltr">labelX=Graphics[Text[&quot;NameX-Axis&quot;,{5,-0.5}]];</div>
<div style="DIRECTION: ltr">Show[costfix,labelX,PlotRange-&gt;All]</div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">Even if I have used PlotRange-&gt;All in the Show statement, this does not extend the axes of the original plot. </div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">Thanks again to all who replied.</div>
<div style="DIRECTION: ltr">&nbsp;</div>
<div style="DIRECTION: ltr">Bharat.</div>
<div style="DIRECTION: ltr"><br>&nbsp;</div><br><br>&nbsp;</div>
<div><span class="gmail_quote">On 7/6/06, <b class="gmail_sendername"><a href="mailto:bghiggins at ucdavis.edu">bghiggins at ucdavis.edu</a></b> &lt;<a href="mailto:bghiggins at ucdavis.edu">bghiggins at ucdavis.edu</a>&gt; wrote:</span>

<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Bharat,<br><br>Why not use the properties of Frame and then modify those options as<br>you see fit. For example,
<br><br><br>Plot[10Exp[0.04x], {x, 1, 8}, PlotRange -&gt; {{0, 9}, {8, 16}},<br>AxesOrigin -&gt; {0, 8},<br>&nbsp;&nbsp; Frame -&gt; True, Axes -&gt; True,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FrameLabel -&gt; {&quot;\nTemp&quot;, &quot;f(x)\n&quot;}, FrameStyle -&gt;
<br>{{RGBColor[1,<br>&nbsp;&nbsp;1, 1]}, {RGBColor[1, 1, 1]}}, FrameTicks -&gt; {Automatic,<br>&nbsp;&nbsp;Automatic, None, None}]<br><br>If you do not want to have the label on the y-axis rotated add the<br>option RotateLabel-&gt;False<br><br>
<br>Cheers,<br><br>Brian<br><br>Bharat Bhole wrote:<br>&gt; Hello All:<br>&gt;<br>&gt; I have a 2-D Plot in which I want to restrict the display of y-axis from<br>&gt; 8-16, and of x-axis from 0-9. I achieve this using<br>
&gt;<br>&gt; plot=Plot[function[x],{x,1,8}, PlotRange -&gt;{{0,9},{8,16}},<br>&gt; AxesOrigin-&gt;{0,8}].<br>&gt;<br>&gt; Then I want to label the x and y-axes and this is where I am having trouble.<br>&gt; I want the x-axis label to appear just below the x-axis (and not at the end
<br>&gt; of the axis, as option AxesLabel gives). So I use the Text command and<br>&gt; define<br>&gt;<br>&gt; labelX = Text[&quot;name-xaxis&quot;, {5,7}]<br>&gt;<br>&gt; Then I use,<br>&gt;<br>&gt; Show[ plot , labelX ]
<br>&gt;<br>&gt; This, however, does not show name-xaxis, which I suppose is because it is<br>&gt; out of PlotRange specified in Plot command. If I modify the PlotRange in the<br>&gt; Show[ ] command to say<br>&gt;<br>&gt; Show[plot,labelX, PlotRange-&gt;{{0,9},{6,16}}]
<br>&gt;<br>&gt; then it shows the&nbsp;&nbsp;name-xaxis, however, it also extends the y-axis line to<br>&gt; y=5. How can I both, get the name to display and at the same time have the<br>&gt; y-axis start at value 8.<br>&gt;<br>&gt; Thanks in advance for your help.
<br>&gt;<br>&gt; Bharat.<br><br></blockquote></div><br><br clear="all"><br>-- <br>----------------------------------------------------------<br>&quot;No problem can withstand the assault<br>of sustained thinking.&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Voltaire<br>---------------------------------------------------------- 

------=_Part_9424_10443490.1152227384481--


  • Prev by Date: Re: Speed challenge: Improve on integer frequencies from Count?
  • Next by Date: RE: Subvalues and Parameters in Differentiation and Usage Messages
  • Previous by thread: Subvalues and Parameters in Differentiation and Usage Messages
  • Next by thread: RE: Subvalues and Parameters in Differentiation and Usage Messages