I will have to recode in Mathematica).
Any of your further help is much appreciated!
Best regards,
-Chee
From: Jerome Asselin
Sent: Friday, April 29, 2011 12:25 AM
To: Chee Chen
Cc: R -Help
Subject: Re: [R] How to define specially nested functions
On Thu, 2011-04-28 at 23:08 -0400, Chee
On Thu, Apr 28, 2011 at 11:08:23PM -0400, Chee Chen wrote:
> Dear All,
> I would like to define a function: f(x,y,z) with three arguments x,y,z, such
> that: given values for x,y, f(x,y,z) is still a function of z and that I am
> still allowed to find the root in terms of z when x,y are given.
>
Here's one possibility:
funmaker = function(x,y,z)function(z)x + y + (x^2 - z)
uniroot(funmaker(1,3,z),c(0,10))$root
[1] 5
uniroot(funmaker(5,2,z),c(30,40))$root
[1] 32
(The third argument to the function doesn't really do anything.)
- Phil Spector
On Thu, 2011-04-28 at 23:08 -0400, Chee Chen wrote:
> Dear All,
> I would like to define a function: f(x,y,z) with three arguments x,y,z, such
> that: given values for x,y, f(x,y,z) is still a function of z and that I am
> still allowed to find the root in terms of z when x,y are given.
> For ex
Dear All,
I would like to define a function: f(x,y,z) with three arguments x,y,z, such
that: given values for x,y, f(x,y,z) is still a function of z and that I am
still allowed to find the root in terms of z when x,y are given.
For example: f(x,y,z) = x+y + (x^2-z), given x=1,y=3, f(1,3,z)= 1+
5 matches
Mail list logo