# Qbasicnews.com

Full Version: challenge finite difference
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
hey all a finite difference program would be great for anyone who is in highschool or even university who is doing finite differences and wants teh answer as quick as possible.

also a long search on google for finite difference program using Qbasic was a failure. i believe that if anyone on this forum makes a finite difference program will be the first people to ever make one and post it on the net.

so thats my challenge, make a finite difference program.

It has to calculate finite differences and put it into its equation
(ex. ax^3 + bx^2 + cx + d)

and then it needs to solve for each variable
(i.e: a, b, c, d)

at the beginning of the program it needs to ask the user something like this, "input the x-values" then say "input the y-values" then it needs to do its magic by itself without the user really having to do anything much after that.

i have already got it started but i just got an upgrade in my position at work and i have no time to comlete it. here is the begining of it:

CLS
CONST MaxValues = 8
DIM X(MaxValues) AS INTEGER
DIM Y(MaxValues) AS INTEGER
PRINT "Enter x-values. Just press Enter when finished"
DO
LINE INPUT "X = "; n\$: IF n\$ = "" THEN EXIT DO
Goof = 0
FOR i = 1 TO LEN(n\$)
IF INSTR("0123456789", MID\$(n\$, i, 1)) = 0 THEN
PRINT "Sorry, bad number": Goof = 1: EXIT FOR
END IF
NEXT i
IF Goof = 0 THEN HowMany = HowMany + 1: X(HowMany) = VAL(n\$)
LOOP
PRINT : PRINT "OK, now enter the Y-values"
FOR GetY = 1 TO HowMany
PRINT "X = "; X(GetY); " Y = ";
DO
Goof = 0
DO
LINE INPUT n\$
IF n\$ = "" THEN PRINT "You must enter a value"
LOOP WHILE n\$ = ""
FOR i = 1 TO LEN(n\$)
IF INSTR("0123456789", MID\$(n\$, i, 1)) = 0 THEN
PRINT "Sorry, bad number": Goof = 1: EXIT FOR
END IF
NEXT i
LOOP WHILE Goof = 1
Y(GetY) = VAL(n\$)
NEXT GetY
FOR i = 1 TO HowMany
PRINT "X ="; X(i), "Y ="; Y(i)
NEXT i
SYSTEM
yeah but it doesn't have a program that a noob can use, it needs to be a copy and pastable program, this one needs to be put together still.
The formula they state is exactly the same as the one you're looking for, right?
ok how do you make the y-values subtrat themselves and find the differences, until all the y-values are the same adn dot any further?
Honestly, I have no idea what they're talking about there. I meant implementing [8] and [9].
If that's what you want I can easily make something to do it.
ok yeah go for it, make something, do what you think i want, because i believe we are talking about teh same thing were just not understaning each other.

so i say go for it and do it
I'm doing it.. Almost done. Will be up tomorrow I think.
Hey Cooliebai when's your homework due?
This is a tricky problem no wonder it's worth extra marks. Any code you copy will not be believed that it was wrote by you. Plaguarism is an ugly word (and difficult to spell).
Pages: 1 2 3