Results 1 to 1 of 1

Thread: Software designers Qbasic + mathemeticians polynomial graphs

  1. #1
    That's me! blackmage_nuke's Avatar
    Join Date
    Aug 2005
    Location
    Yes
    Posts
    8,503
    Blog Entries
    3

    Default Software designers Qbasic + mathemeticians polynomial graphs

    So im writing this program for class that draws polynomial graphs using q basic. And i cant find the whats wrong with my program.
    It works with Parabolas and Cubics curves, but for some reason when it gets to polynomials of degree 4, it draws the graph but there are these weird lines that appear on the sides.

    This is the code

    Code:
    CLS
    SCREEN 1
    SCREEN 0
    
    INPUT "What is the highest power of x?", power
    FOR z% = 0 TO (power)
    PRINT "what is the pronumeral of x^"; z%
    INPUT pronum(z%)
    NEXT
    
    SCREEN 1
    LINE (160, 0)-(160, 200)
    LINE (0, 100)-(320, 100)
    FOR i% = -30 TO 30
    y = 0
    y2 = 0
    FOR z% = 0 TO (power)
    y = (pronum(z%) * (i%) ^ (z%)) + y
    y2 = (pronum(z%) * (i% + 1) ^ (z%)) + y2
    NEXT
    y = -y
    y2 = -y2
    posx = (i% * 6) + 160
    posy = y + 100
    posx2 = ((i% + 1) * 6) + 160
    posy2 = y2 + 100
    LINE ((posx), (posy))-((posx2), (posy2))
    NEXT
    Can anyone tell me how to get rid of those lines or atleast whats causing them?

    I could be wrong but I think it might be that the values get too high or something and the program cant handle it and just goes to a really high value or something, if thats the case can someone tell me the maximum value?

    Otherwise it could be some crazy maths concept ive never heard about

    edit: I just realised pronumeral should be co-eficcient so dont point that out to me
    Last edited by blackmage_nuke; 09-19-2007 at 01:14 PM.
    Kefka's coming, look intimidating!
    Have a nice day!!

Posting Permissions

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