Qbasicnews.com
August 25, 2019, 11:51:33 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: challenge finite difference  (Read 10373 times)
cooliebai
New Member

Posts: 4


« on: October 31, 2005, 11:16:18 PM »

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
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: November 01, 2005, 10:29:30 PM »

http://mathworld.wolfram.com/FiniteDifference.html
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
cooliebai
New Member

Posts: 4


« Reply #2 on: November 02, 2005, 10:34:18 PM »

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.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #3 on: November 03, 2005, 12:21:16 PM »

The formula they state is exactly the same as the one you're looking for, right?
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
cooliebai
New Member

Posts: 4


« Reply #4 on: November 04, 2005, 12:12:03 AM »

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?
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #5 on: November 04, 2005, 08:19:19 PM »

Honestly, I have no idea what they're talking about there. I meant implementing [8] and [9].
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #6 on: November 06, 2005, 11:40:42 PM »

If that's what you want I can easily make something to do it.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
cooliebai
New Member

Posts: 4


« Reply #7 on: November 08, 2005, 01:05:52 AM »

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
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #8 on: November 08, 2005, 03:30:11 AM »

I'm doing it.. Almost done. Will be up tomorrow I think.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Quibbler
New Member

Posts: 17


« Reply #9 on: November 08, 2005, 09:22:19 AM »

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).
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #10 on: November 08, 2005, 12:53:20 PM »

Quibbler, if you do indeed know this guy, you can bust him if he cheats...

I'm still working on the program; I've almost got it down but I gotta run.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Quibbler
New Member

Posts: 17


« Reply #11 on: November 08, 2005, 12:59:44 PM »

Have a look at  this Agamemnus

http://www.network54.com/Forum/13959/message/1130469017/Finite+Difference
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #12 on: November 08, 2005, 06:51:53 PM »

Heh,

How would his teacher expect him to do something so complicated? That's completely ridiculous. He doesn't even know what the heck it is in the first place, which I will explain when I finish the program later at home.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Quibbler
New Member

Posts: 17


« Reply #13 on: November 10, 2005, 09:41:20 AM »

Yes you're right teachers can be real bastards. Giving a problem of this difficulty to somebody who would struggle with a "hello world" program is just incomprehensible.
Not only is it a tricky computational problem, but the maths is very awkward. Working out the coeffs of n(n-1)(n-2)... is a project in itself.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #14 on: November 10, 2005, 03:45:04 PM »

Ok, I'm still working on it. Still some problem. Conceptually it's a bit difficult, but easy to implement.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!