Using Play command and polynomial tia sal2

Discussion in 'Mathematica' started by ratulloch, Mar 1, 2009.

  1. ratulloch

    ratulloch Guest

    Greetings All

    I know the play command uses sin, cos, etc. But I would like to use
    the Play command to listen to a polynomial. Example below of

    Plot[Piecewise[{{4*x^2 - 4*x, 0 <= x <= 1}, {-2*x^2 + 8*x - 6
    , 1 = x < 3}}], {x, 0, 3}]

    I replace the Plot command with Play
    Play[Piecewise[{{4*x^2 - 4*x, 0 <= x <= 1}, {-2*x^2 + 8*x - 6
    , 1 = x < 3}}], {x, 0, 3}]

    but mathematica 6 just comes back with errors and
    just says running..

    I think it's syntax but I haven't found an example of using the Play
    command and Piecewise. Should I be doing this another way?

    tia sal2
    ratulloch, Mar 1, 2009
    1. Advertisements

  2. ratulloch

    David Bailey Guest

    You had used = instead of == in one of the tests inside Piecewise.
    Curiously, this did not cause an error using Plot. Here is a corrected

    Play[Piecewise[{{4*x^2 - 4*x, 0 <= x <= 1}, {-2*x^2 + 8*x - 6,
    1 == x < 3}}], {x, 0, 3}]

    Note that = means assignment, and therefore 1=x doesn't make sense -
    which is what the message was trying to tell you - whereas == is a

    However, I am not sure I would pay to attend a concert in which the
    result was playing :)

    I think the result would sound more interesting if instead of playing
    f[x], you played Sin[2 Pi f[x] x] with f scaled into the range of (say)
    200-1000. The pitch of the resultant sound would represent the value of f.

    David Bailey
    David Bailey, Mar 2, 2009
    1. Advertisements

  3. ratulloch

    dh Guest


    your speaker cannot reproduce sound below some frequency. Your ear has a

    threshold too. Therefore, you must define (for the PC speaker) something

    that has at least say 100 "wiggles" a second.

    hope this helps, Daniel

    dh, Mar 3, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.