Re: Series and passing a function a changing number of
- To: mathgroup at smc.vnet.net
- Subject: [mg106831] Re: [mg106758] Series and passing a function a changing number of
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 24 Jan 2010 05:43:31 -0500 (EST)
- Reply-to: hanlonr at cox.net
f[x_] = Exp[x + 2 y^x];
varList = Cases[f[x],
_Symbol?(! NumericQ[#] &), Infinity] // Union
{x,y}
startPoint = 0;
ord = 2;
args = {#, startPoint, ord} & /@ varList;
Or you could use Thread
args == Thread[{varList, startPoint, ord}]
True
Convert the args list to a sequence for use in Series
Series[f[x], Sequence @@ args] // Normal
x^2*(3*E^2*Log[y]^2 + 2*E^2*Log[y] + E^2/2) +
x*(2*E^2*Log[y] + E^2) + E^2
% // FullSimplify
(1/2)*E^2*(2*x*Log[y]*(3*x*Log[y] + 2*x + 2) + x*(x + 2) +
2)
Bob Hanlon
---- Ignacio Plazeta <Ignacio.Plazeta at speednet.es> wrote:
=============
Dear Friends
-- 1 -----------------------------------------------
This command works fine:
Series[ Exp[ x + 2 y^x ] , {x, 0, 2} , {y, 0, 2} ]
this one doesn't:
Series[ Exp[ x + 2 y^x ] , {{x, 0, 2}, {y, 0, 2}} ]
It returns:
"Series specification is not a list with three elements ..."
-- 2 -----------------------------------------------
I'm trying to set up this kind of function:
myTaylorExpander[ function_ , varList , startPoint_ , ord_ ]
where varList length is changing; because of the above mentioned
behavior of Series function I can't simply try something like:
numVar = Length[ varList ];
args = Table[
{ varList[[k]] , startPoint , ord}
, { k, 1 , numVar }
]
Series[ f , args ] // Normal
-- 3 -----------------------------------------------
Is there a way to get out of this by a trick to pass a functions
a changing number of variable ? Anything else fitting is welcomed too.
Warmest Regards.
Ignacio Plazeta
( Spain )