Re: Log(ln) Function + 2 Parameters + Greater
- To: mathgroup at smc.vnet.net
- Subject: [mg89314] Re: Log(ln) Function + 2 Parameters + Greater
- From: "David Park" <djmpark at comcast.net>
- Date: Thu, 5 Jun 2008 00:43:56 -0400 (EDT)
- References: <g22tp5$ikl$1@smc.vnet.net> <g237c4$q2n$1@smc.vnet.net> <g25ntv$hug$1@smc.vnet.net>
If one considers a to be a 'parameter' and x to be the true 'variable' then the advantage of that form is that it is easy to write derivatives with respect to the variable. f[a_][x_] := x (a + Log[x])^2 Just write the dereivative as: f[a]'[x] (This definition is stored under SubValues[f].) But with the other form: Clear[f] f[a_, x_] := x (a + Log[x])^2 You have to write the derivative as one of the two following form: D[f[a, x], x] Derivative[0, 1][f][a, x] -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Jerry" <Jer75811 at yahoo.com> wrote in message news:g25ntv$hug$1 at smc.vnet.net... > Sir, I have never seen a function definition in the form you > give: > f[a_][x_] := x (a + Log[x])^2 > > After a bit of playing with it, I don't see the difference > between this and > > f[a_,x_] := x (a + Log[x])^2 > > I really don't know how to search in help for this f[a_][x_] > form. Can you tell me if there is any essential difference? > > Thank you. > > > David Park wrote: >> First, define your f function with a as a parameter. >> >> f[a_][x_] := x (a + Log[x])^2 >> >> Mathematica can't make a plot unless it knows values for a. Of course, it >> won't plot any results for x < 0 and I'm not certain if you actually >> meant x >> > 0 rather than a > 0. In any case, you can use any real domain for a. >> Here >> is a plot for a specific value of a. >> >> Plot[f[2][x], {x, -5, 5}, >> AxesLabel -> {x, f}] >> >> You can look at an extended a domain by using Plot3D. >> >> Plot3D[f[a][x], {a, -5, 5}, {x, 0, 5}, >> PlotRange -> All, >> AxesLabel -> {a, x, f}] >> >> Another approach is to use a Manipulate statement with a controlled by a >> slider. >> >> Manipulate[ >> Plot[f[a][x], {x, 0, 5}, >> PlotRange -> {0, 250}, >> AxesLabel -> {x, f}], >> Style[Row[{HoldForm[f["a"][x]] == f["a"][x]}], 16], >> Delimiter, >> {a, -5, 5, Appearance -> "Labeled"}] >> >> >> >