Physics Program--Haven't Programmed in years 
Author Message
 Physics Program--Haven't Programmed in years

I need help finishing or readjusting a code using the Runge-Kutta
algorithim.

I have some code which i wrote with a text editor... When I Import the
code to Visual Basic--it gives errors.

So I used qbasic and it ran fine.

I need to make the program an exe  which I only know how to do with visual
basic.

Also, I need simple graphic output of 'vv' vs. 'tt'.  If anyone could help
on that I would appreciate it.

Here is my code for the Runge Kutta alg.
------------------------------------------
INPUT "x (suggested initial value-0)"; xx
INPUT "v (suggested initial value-0)"; vv
INPUT "t (suggested initial value-0)"; tt
INPUT "A (suggested value-2)"; A
INPUT "B (suggested value-2)"; B
INPUT "stepsize (suggested value-0.5)"; h
INPUT "number of steps (suggested value-20)"; nstep
h2 = h / 2: h6 = h / 6
For i = 1 To nstep
x = xx: v = vv: t = tt: GoSub 500: p1 = xp: q1 = vp
x = xx + h2 * p1: v = vv + h2 * q1: t = tt + h2: GoSub 500: p2 = xp: q2 =
vp
x = xx + h2 * p2: v = vv + h2 * q2: t = tt + h2: GoSub 500: p3 = xp: q3 =
vp
x = xx + h * p3: v = vv + h * q3: t = tt + h: GoSub 500: p4 = xp: q4 = vp
xx = xx + h6 * (p1 + 2 * (p2 + p3) + p4)
vv = vv + h6 * (q1 + 2 * (q2 + q3) + q4)
tt = tt + h
Print tt, xx, vv
Next
End
500 xp = v
 vp = A - B * v
 Return

This is where I am on the graphical output.
----------------------------------------
 ......
PSet (tt%, vv%)
----------------
I really have no idea on the graph part  :-(

--
Posted via CNET Help.com
http://www.*-*-*.com/



Sun, 19 May 2002 03:00:00 GMT  
 Physics Program--Haven't Programmed in years

Quote:
> I need help finishing or readjusting a code using the Runge-Kutta
> algorithim.

> I have some code which i wrote with a text editor... When I Import
the
> code to Visual Basic--it gives errors.

That's because VB does not use the INPUT command.  You must create a
form with textboxes to accept the input.  Also, you cannot use PSet
directly in VB.  You have to use the PSet method of a Form or
PictureBox.  What I would do is put 5 textboxes and a picturebox on a
Form, then accept your inputs from the textboxes and output to the
picture box using the PSet method.

jdm



Mon, 20 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Physics Programming...

2. (2nd Post) BASIC programming advice needed: PKWARE'S compression utilities front end application - PROGRAMMING PROJECT

3. Installer program/Program d'installation

4. Start programming for 11 year old

5. 10-year-old starting to program with QBasic 1.1

6. Haven't got a clue 2

7. I Haven't got a clue

8. I Haven't got a clue

9. An Api I haven't seen

10. VB5: Crystal Reports child-window haven't title in MDI-parent form

11. Hard question, haven't found anyone that can answer it yet

12. Corollary to the 'Great BASIC program'

 

 
Powered by phpBB® Forum Software