Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 calculus grade 12 homework doer
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Sun Sep 07, 2003 8:00 pm   Post subject: calculus grade 12 homework doer

well i got grade 12 calculus this year so i created this little quick grapher to do my work... i thought u might like to use it also... so feel free to cheat your way out of homework Very Happy

code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%You can change these to change yer graph scaling
const xscale := 20
const yscale := 20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

var x1, y1 := -500
var x, y : real := -20
colorback (16)
cls
drawline (0, 200, 640, 200, 12)
drawline (320, 0, 320, 400, 12)
for i : 0 .. 640 by xscale
    drawline (i, 199, i, 201, 8)
end for
for i : 0 .. 400 by yscale
    drawline (319, i, 321, i, 8)
end for
procedure drawsdot (x, y, c : real)
    drawdot (round (x * xscale) + 320, round (y * yscale) + 200, round (c))
end drawsdot
color (white)
loop
    exit when x > 20
    x += .001
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%This is where u put your formula%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %y := x ** 2
    %y := 2 * (x ** 2) + (4 * x) + 3 % y=2x^2+4x+3
    y := .05 * (x ** 3)
    %y := 2 * x
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    drawsdot (x, y, 15)
end loop
x := 320
y := 200
color (15)
loop
    if hasch then
        drawdot (round (x) - 1, round (y), 16)
        drawdot (round (x) + 1, round (y), 16)
        drawdot (round (x), round (y) + 1, 16)
        drawdot (round (x), round (y) - 1, 16)
        case getchar of
            label "a" :
                x -= xscale
            label "d" :
                x += xscale
            label "s" :
                y -= yscale
            label "w" :
                y += yscale
            label :
        end case
        drawdot (round (x) - 1, round (y), 8)
        drawdot (round (x) + 1, round (y), 8)
        drawdot (round (x), round (y) + 1, 8)
        drawdot (round (x), round (y) - 1, 8)
        locate (1, 1)
        put (x - 320) / xscale, "/", (y - 200) / yscale
    end if
end loop


[mod:11f4ddc542="Dan"]
Gave you some bits for a nice progame that is a good exaple about grafing stuff in progaming languaes.
[/mod:11f4ddc542]
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sun Sep 07, 2003 9:34 pm   Post subject: (No subject)

nice, looks good too. probly whould be ushlfull for thous with out grafing caluators.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Kingnoz




PostPosted: Mon Sep 08, 2003 5:46 pm   Post subject: (No subject)

good work on the program, i will have to save that until next year Very Happy
PaddyLong




PostPosted: Mon Sep 08, 2003 6:41 pm   Post subject: (No subject)

man grade 12 calculus sucked soo bad... probably because the teacher spent pretty much the entire class answering stupid people's questions Rolling Eyes although I some how managed to get an 80 in it even though I didn't do half the questions on the last few tests (if the question seemed like it was going to be a lot of work I just didn't do it)

here's a program I wrote in grade 9 or 10 to do work for me ... it just outputs the three forms of quadratics based on the "a" value and the vertex coords

code:

procedure input (var x, y, a : real)
    put "what is the x value of the vertex?"
    get x
    put "what is the y value of the vertex?"
    get y
    put "what is the value for a?"
    get a
end input
procedure output (h, k, a : real)
    var b : real := - 2 * a * h
    var c : real := a * h ** 2 + k
    var b24ac : real := b ** 2 + ( - 4 * a * c)
    var zero1, zero2 : real
    put "general form: " ..
    if 2 * a * h > 0 then
        if a * h ** 2 + k > 0 then
            put a, "x", chr (253), " - ", b * - 1, "x + ", c
        elsif a * h ** 2 < 0 then
            put a, "x", chr (253), " - ", b * - 1, "x - ", c * - 1
        end if
    elsif 2 * a * h <= 0 then
        if a * h ** 2 + k >= 0 then
            put a, "x", chr (253), " + ", b, "x + ", c
        elsif a * h ** 2 < 0 then
            put a, "x", chr (253), " + ", b, "x - ", c * - 1
        end if
    end if
    put "vertex form: " ..
    if h >= 0 then
        if k >= 0 then
            put a, "(x - ", h, ")", chr (253), " + ", k
        elsif k < 0 then
            put a, "(x - ", h, ")", chr (253), " - ", k * - 1
        end if
    elsif h < 0 then
        if k >= 0 then
            put a, "(x + ", h * - 1, ")", chr (253), " + ", k
        elsif k < 0 then
            put a, "(x + ", h * - 1, ")", chr (253), " - ", k * - 1
        end if
    end if
    put "factored form: " ..
    if b24ac * - 1 >= 0 then
        zero1 := (b * - 1 + sqrt (b24ac * - 1)) / 2 * a
        zero2 := (b * - 1 - sqrt (b24ac * - 1)) / 2 * a
    elsif b24ac >= 0 then
        zero1 := (b * - 1 + sqrt (b24ac)) / 2 * a
        zero2 := (b * - 1 - sqrt (b24ac)) / 2 * a
    else
        put "no real zeros"
    end if
    if zero1 >= 0 then
        if zero2 >= 0 then
            put "(x + ", zero1, ")(x + ", zero2, ")"
        elsif zero2 < 0 then
            put "(x + ", zero1, ")(x - ", zero2 * - 1, ")"
        end if
    elsif zero1 < 0 then
        if zero2 >= 0 then
            put "(x - ", zero1 * - 1, ")(x + ", zero2, ")"
        elsif zero2 < 0 then
            put "(x - ", zero1 * - 1, ")(x - ", zero2 * - 1, ")"
        end if
    end if
end output
var x, y, a : real
input (x, y, a)
output (x, y, a)
Homer_simpson




PostPosted: Mon Sep 08, 2003 8:22 pm   Post subject: (No subject)

whooohoo bits =Þ
and yeah calculus has been easy so far i guess because we haven't gotten so far yet :S right now we at polynomial divisions
rizzix




PostPosted: Tue Sep 09, 2003 2:57 pm   Post subject: (No subject)

same here.
Papageorgeo




PostPosted: Tue Sep 09, 2003 3:08 pm   Post subject: (No subject)

Calculus only gets harder from where you are. I took it last year and it wasn't my best mark...
PaddyLong




PostPosted: Tue Sep 09, 2003 5:08 pm   Post subject: (No subject)

algeo > calculus Very Happy

bleh.... o well, my math course in first year college seems like it's pretty much a big review of grade 12 algeo and calculus so it should be pretty easy 8)
Sponsor
Sponsor
Sponsor
sponsor
templest




PostPosted: Wed Oct 01, 2003 8:35 pm   Post subject: (No subject)

hahaha... Seems like all of us have made a program to do our homework at one point or another. I just made one a couple days ago to find the value of "x" using the quadratic formula by inputing the "a", "b", and "c" value. Made it do it backwards to to find the formula from the two co-ordinates. I have a feeling your program will come in handy. Twisted Evil Twisted Evil Twisted Evil
Tony




PostPosted: Wed Oct 01, 2003 10:26 pm   Post subject: (No subject)

templest wrote:
I just made one a couple days ago to find the value of "x" using the quadratic formula by inputing the "a", "b", and "c" value.


heh, I've made one last year too - on my TI-83+ calculator. Suddenly math 11 HW became oh-so-easy.

My teacher didnt appretiate my programming skillz though.

Rolling Eyes I wish I could just program solutions for all those damn calculus problems. It's soo annoying how they have those essay programs repeat over and over and over. Sometimes they just chance x+1 to x-1 and tell to do same question over again Mad
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: