[R] How to provide a result from D(f(x), "x") to a curve(f'(x)) ???
David Winsemius
dwinsemius at comcast.net
Wed Feb 17 20:00:38 CET 2010
On Feb 17, 2010, at 1:48 PM, Gabor Grothendieck wrote:
> Try this:
>
> do.call(curve, list(D(expression(x^3), "x")))
This also worked, after noting that str() told me the D() object had a
"language" attribute, but given that it was not the chosen method by
Gabor, it may have some deficiency about which I am unaware:
curve( eval(D(expression(x^3), "x") ) )
His do.call method does result in a more intuitive labeling of the y-
axis.
--
David.
>
> On Wed, Feb 17, 2010 at 1:31 PM, Walmes Marques Zeviani
> <walmeszeviani at hotmail.com> wrote:
>>
>> Hi all,
>>
>> I want to provide the result from D() to curve(), because I want to
>> plot the k-th derivative of some functions. Actually, I copy from
>> console the result given by D() and paste inside curve(). With a
>> lot of functions and high degree differentiation this process is
>> tedious. Can I provide directly??
>>
>> # what I actually have done (very simple function)
>> D(expression(x^3), "x") # copy this result
>> curve(3 * x^2) # paste inside
>>
>> # my failed attempts
>> curve(as.expression(D(expression(x^3), "x")))
>> curve(as.character(as.expression(D(expression(x^3), "x"))))
>> curve(noquote(as.character(as.expression(D(expression(x^3), "x")))))
>>
>> Thanks in advance.
>> Walmes Zeviani, Brasil.
>> ________________________________________________________________
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list