You are Here: Home

# Mathematica question Tweet

Maths and statistics discussion, revision, exam and homework help.

Announcements Posted on
1. Mathematica question
Let's say I have a function of some parameters where we can assume x, y and z are functions and can be written as a power series in h. How can i substitute this power series into my function in mathematica? I hope this is clear enough, if not let me know. Thanks.
EDIT: Also is there a way to remove second order terms and higher from the function?
Last edited by JBKProductions; 04-08-2012 at 19:37.
2. Re: Mathematica question
not really sure ive got your jist but, ill give it a go (forgive me if im wrong)

do you want to have expressions (power series of order one?) in h, for each of x, y, and z which are expressions in h?

and to sub these into F?
3. Re: Mathematica question
ive just messed around with these, where x,y, and z have thier own power series in h,

and a funstion is defined as functn= (EDIT: you can call it what you like!)

i dont really know if this is what youre after, but it demonstates my thinking - again, my apologies if its not what youre after!

x = Series[Exp[h], {h, 0, 1}] // Normal (output = 1+h)

y = Series[Sin[h], {h, 0, 2}] // Normal (output =h)

z = Series[Log[h], {h, 0, 3}] // Normal (output = Log[h])

so the function:

functn = Function[{u, v, w}, u^2 + v^4 + w][x, y, z] (this is just my example) (output h^4 + (1 + h)^2 + Log[h])

this is a pure function, though, the disadvantage being, its not like F[x_], say, where you can say F[2] or F'[2]

again - apologies if this isnt what your looking for.
Last edited by DrSheldonCooper; 04-08-2012 at 20:43.
4. Re: Mathematica question
(Original post by DrSheldonCooper)
not really sure ive got your jist but, ill give it a go (forgive me if im wrong)

do you want to have expressions (power series of order one?) in h, for each of x, y, and z which are expressions in h?

and to sub these into F?
Yep, this is what I'm after. I haven't read your other reply yet, so going to do that now!
5. Re: Mathematica question
theres probably a shorter way - but i cant think of it!

again - in the above definitions of x,y,z, first of all i dont use the??Normal, to be sure of what order the thing "would be" - then if it only has 2 orders in it you can leave the {h,0,1 or 2 or3} alone and use//Normal
Last edited by DrSheldonCooper; 04-08-2012 at 20:46.
6. Re: Mathematica question
(Original post by DrSheldonCooper)

functn = Function[{u, v, w}, u^2 + v^4 + w][x, y, z] (this is just my example) (output h^4 + (1 + h)^2 + Log[h])
Hi, just read it and this output is what you get at the end? Is there a way to remove second order terms and higher on this function you have? I want just functn to have only constant terms and h terms.
7. Re: Mathematica question
ive not used this at all, but if you go to the documentation centre, and type the word: drop, drop tells you how to get rid of certain elements of lists and expressions. Beyond that i`m not too sure - hope you find out!

(p.s. be sure to expand/simplify functn before you try drop)

good luck!
Last edited by DrSheldonCooper; 05-08-2012 at 14:00.