Mathematica question

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

This thread is sponsored by:
Announcements Posted on
Important: please read these guidelines before posting about exams on The Student Room 28-04-2013
Sign in to Reply
  1. JBKProductions's Avatar
    • Overlord in Training
    • Posts: 2,106
    Mathematica question
    Let's say I have a function of some parameters  \mathcal{F}(x,y,z) = ... 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. DrSheldonCooper's Avatar
    • Full Member
    • Posts: 136
    Re: Mathematica question
    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?
  3. DrSheldonCooper's Avatar
    • Full Member
    • Posts: 136
    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.
  4. JBKProductions's Avatar
    • Overlord in Training
    • Posts: 2,106
    Re: Mathematica question
    (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?
    Yep, this is what I'm after. I haven't read your other reply yet, so going to do that now!
  5. DrSheldonCooper's Avatar
    • Full Member
    • Posts: 136
    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//Normal
    Last edited by DrSheldonCooper; 04-08-2012 at 20:46.
  6. JBKProductions's Avatar
    • Overlord in Training
    • Posts: 2,106
    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. DrSheldonCooper's Avatar
    • Full Member
    • Posts: 136
    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.
Sign in to Reply
Share this discussion:  
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.