Mathematica question
Maths and statistics discussion, revision, exam and homework help.
| Announcements | Posted on | |
|---|---|---|
| Important: please read these guidelines before posting about exams on The Student Room | 28-04-2013 | |
-
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. -
Re: Mathematica question
i`ve 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 don`t really know if this is what you`re after, but it demonstates my thinking - again, my apologies if it`s not what you`re 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, it`s not like F[x_], say, where you can say F[2] or F'[2]
again - apologies if this isn`t what your looking for.Last edited by DrSheldonCooper; 04-08-2012 at 20:43. -
Re: Mathematica questionYep, this is what I'm after. I haven't read your other reply yet, so going to do that now!(Original post by DrSheldonCooper)
not really sure i`ve got your jist but, i`ll give it a go (forgive me if i`m 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?
-
Re: Mathematica question
there`s probably a shorter way - but i can`t 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//NormalLast edited by DrSheldonCooper; 04-08-2012 at 20:46. -
Re: Mathematica questionHi, 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.(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])
-
Re: Mathematica question
i`ve 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.