Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Calculating graph plotting points

  • 02-11-2013 7:18pm
    #1
    Registered Users, Registered Users 2 Posts: 707 ✭✭✭


    Okay so I want to plot a few graphs.

    I'll keep the graph simple for the purpose of this discussion;

    f(x) = sin(x) x is from -2pi to 2pi in intervals of pi/4

    Now I would have no problem graphing this or calculating the co-ordinates using a calculator.

    I'm currently struggling to find some sort of programme to spit out the co-ordinates for me.

    I tried using the google docs version of excel but I was unable to enter the value pi. I could enter the numerical value for pi but it gets very messy when I have 20+ co-ordinates to find and I'm copy&pasting 3.14159265359 into every cell. When I do enter 'PI()' I get a "NAME" error.

    Anybody have any suggestions?


Comments

  • Registered Users, Registered Users 2 Posts: 5,633 ✭✭✭TheBody


    jeepers101 wrote: »
    Okay so I want to plot a few graphs.

    I'll keep the graph simple for the purpose of this discussion;

    f(x) = sin(x) x is from -2pi to 2pi in intervals of pi/4

    Now I would have no problem graphing this or calculating the co-ordinates using a calculator.

    I'm currently struggling to find some sort of programme to spit out the co-ordinates for me.

    I tried using the google docs version of excel but I was unable to enter the value pi. I could enter the numerical value for pi but it gets very messy when I have 20+ co-ordinates to find and I'm copy&pasting 3.14159265359 into every cell. When I do enter 'PI()' I get a "NAME" error.

    Anybody have any suggestions?

    Why do you need a programme to generate the coordinates when a calculator will do it for you? I mean there is a sine function on your calculator. If you want my opinion, sine (like cosine) is so common, it would do no harm to know it off by heart.

    A programme like geogebra (free to download) will graph it for you if that's all you want.


  • Registered Users, Registered Users 2 Posts: 5,633 ✭✭✭TheBody


    On second reading of your post, I see that you mean to draw graphs in general.

    I'm not very tech savvy, so perhaps there is a package that will do what you want. As I said in the post above, geogebra will draw the graph for you but I don't think that's exactly what you are looking for.

    I'm sure somebody will be able to answer your question.


  • Registered Users, Registered Users 2 Posts: 707 ✭✭✭jeepers101


    TheBody wrote: »
    On second reading of your post, I see that you mean to draw graphs in general.

    I'm not very tech savvy, so perhaps there is a package that will do what you want. As I said in the post above, geogebra will draw the graph for you but I don't think that's exactly what you are looking for.

    I'm sure somebody will be able to answer your question.

    Yes indeed the graphs I want to plot are a little trickier than the one above and the intervals are small enough to make the exercise extremely tedious.

    I downloaded geogebra, which is great for checking my graphs are the correct shape etc. but I can't get it to actually give me the co-ordinates.


  • Registered Users, Registered Users 2 Posts: 5,633 ✭✭✭TheBody


    I'm sure excel can probably do what you want. However, I know almost nothing about it. I'm a bit of an old school mathematician :P


  • Registered Users, Registered Users 2 Posts: 558 ✭✭✭wobbles-grogan


    If you want to learn how to code a little bit you can write a simple program to do this for you and spit all the output to a file.

    I suspect python would be pretty easy write it in.

    For example, your problem above, the code:
    import math;
    PI=3.14159;
    fullRange = 4*PI;
    incrementPerInterval = PI/4;
    for i in range(0, int(fullRange/incrementPerInterval)+1):
    x = (-2 * PI) + (i * incrementPerInterval)
    print "f(%s) = %s" % (x, math.sin(x) * x);

    Would print out:
    f(-6.28318) = -3.33459646355e-05
    f(-5.4977825) = -3.88753733999
    f(-4.712385) = -4.71238499996
    f(-3.9269875) = -2.77679028026
    f(-3.14159) = 8.3364911589e-06
    f(-2.3561925) = 1.66608301035
    f(-1.570795) = 1.570795
    f(-0.7853975) = 0.555359529753
    f(0.0) = 0.0
    f(0.7853975) = 0.555359529753
    f(1.570795) = 1.570795
    f(2.3561925) = 1.66608301035
    f(3.14159) = 8.33649116169e-06
    f(3.9269875) = -2.77679028026
    f(4.712385) = -4.71238499996
    f(5.4977825) = -3.88753733999
    f(6.28318) = -3.33459646355e-05

    I know, the code looks unpleasant, but I assure you its not so bad.
    I can explain it to you if you like?

    You could edit the above to print it out as comma seperated values. Then excel (or google equivalent) can read it and print the graph for you.
    Simples!

    Also, its entirely possible to do this totally inside excel, I just don't know how and am too lazy to work it out :)


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,344 ✭✭✭Thoie


    I just tried PI() in google spreadsheet, and it works fine. Did you forget the equals sign? Formulas (as in Excel) always start with =

    So in the cell you'd want to type =PI() and it will fill in pi to 14 decimal places.

    If I want 2pi I'd type in =2*PI()


  • Registered Users, Registered Users 2 Posts: 6,344 ✭✭✭Thoie


    Just did it in google spreadsheet, and it works fine. Here's what was entered


    Edit: There's also a "Smooth line chart" in google spreadsheet which would have been more appropriate (and less jerky) for this, but I can't be bothered doing another screenshot.


  • Registered Users, Registered Users 2 Posts: 707 ✭✭✭jeepers101


    If you want to learn how to code a little bit you can write a simple program to do this for you and spit all the output to a file.

    .
    .
    .


    Also, its entirely possible to do this totally inside excel, I just don't know how and am too lazy to work it out :)

    Wobbles, if I had the time that looks like interesting stuff. Unfortunately I'm under pressure to get this assignment done. I think I'll stick with excel for now.
    Thoie wrote: »
    Just did it in google spreadsheet, and it works fine. Here's what was entered


    Edit: There's also a "Smooth line chart" in google spreadsheet which would have been more appropriate (and less jerky) for this, but I can't be bothered doing another screenshot.

    Great stuff Thoie. Yes indeed I forgot the equals sign :o

    I spent three hours trying to figure that out. Should have posted sooner :)

    How did you manage to output that picture of the graph?


  • Registered Users, Registered Users 2 Posts: 6,344 ✭✭✭Thoie


    jeepers101 wrote: »

    How did you manage to output that picture of the graph?

    Are you using Excel itself, or Google Spreadsheet? The basic principle is the same for both (highlight what you want graphed, and pick insert chart), but if you need more precise instructions let me know which you're using.

    Also, you'll probably want to check out the "fill down"/"Copy down" features of spreadsheets as well - you'll use it for repeating the same formula/function down a list, so you don't have to type each line individually.


  • Registered Users, Registered Users 2 Posts: 707 ✭✭✭jeepers101


    Great stuff Thoie


  • Advertisement
Advertisement