SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    function of y: Keith Wood's SVG Jquery

    Hello,

    I've been using Keith Wood's fantastic SVG Jquery plug in for a math application and it suits almost all of my needs to plot mathematical functions. One thing that I need, which I'm not sure if it can do, however, is to create functions of y instead of functions of x; in particular within the plotting mechanism, I'd like to be able plot "x=3" or "x=5" (vertical lines). Any help would be appreciated.

    Thanks!

    -Eric

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    You can use Wolfram|Alpha: Computational Knowledge Engine for that.

    If you have for example: y = x^3-1
    you can put in "inverse x^3-1" to get the appropriate formula, which is the third root of (x + 1) which is (x + 1)^(1/3)

    So, switching the variables, we have:

    y = x^3 - 1
    and
    x = (y + 1)^(1/3)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Paul,

    Thanks for the quick reply! I'm actually not trying to figure out how to compute the inverse of a function (with this much, I'm set!). What I'd like to do is to be able to sketch functions of y as opposed to functions of x.

    For example, x=y^2 isn't a function of x since each x is associated with two different y values: (1,1) and (1,-1). In addition, I'd love to be able to sketch an equation such as x=4, which is a vertical line (again...sorry if I don't know how much of a math background you have!) but again, not a function of x since each x has an infinite number of y's associated with it.

    Basically, without actually knowing how javascript produces its functions, my guess is that it "plugs in" lots of x's so that the graph looks smooth, moving across the x axis. What I'm hoping to do is to be able to move across the y axis instead to spit out an appropriate graph.

    Anyway, I appreciate that this is a bit of a "mathy specific" question so if there's isn't an "easy" solution out there, I'd very much understand. However, any other thoughts would be appreciated.

    -Eric

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kreut View Post
    What I'd like to do is to be able to sketch functions of y as opposed to functions of x.

    For example, x=y^2 isn't a function of x since each x is associated with two different y values: (1,1) and (1,-1). In addition, I'd love to be able to sketch an equation such as x=4, which is a vertical line (again...sorry if I don't know how much of a math background you have!) but again, not a function of x since each x has an infinite number of y's associated with it.
    That sounds like something that Mathematica is capable of doing, which also supports SVG for the web.

    You might find though that only the really big players are capable of performing the types of inverse functions that you require.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Paul,

    You're absolute correct in this regard! But, the "cool" thing that I'm hoping to do is have the students explore different types of "non-functions"; in other words, I give them x=(input box)y^2 and by typing in different numbers and some javascript magic it will produce the graph for them on the fly. I've been successful at integrating this with Keith's program for functions of x but not for functions of y. Anyway, I don't want to take up too much of your time on this but if you had an extra minute and checked out this link, then maybe it would be clearer what I was hoping to do with "non-functions" by seeing how I was able to integrate with actual functions of x.

    Thanks for giving this problem some thought.

    -Eric

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    That reminds me of something I saw recently.

    Khan Academy started with video tutorials, but they now provide web-based learning of a wide range of math-based topics.
    For example, inverse functions where you can also turn on a scratchpad to write your workings and notes.

    Here's some info about how they benefit students and teachers too. I know that many schools in the US are using them, and there's even a TED presentation with Bill Gates about them. So, are resources such as that worth considering?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I checked out a bunch of the links and they definitely give me some ideas and some things to think about. Thanks so much.

    -Eric

    PS Love the TED talks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •