|
Post by nordstjernen on Jan 30, 2023 1:33:00 GMT
Hi -I'm new to programming and wanted to learn BASIC using ST Basic on my old Atari. I then understood calculations in ST BASIC are buggy and could build QB64 v. 2.1.1 on an old Linux laptop and found out QB64 is almost 100% compatible with programs listed in "Some common BASIC programs, Atari edition" by Lon Poole, Mary Borchers, Steven Cook". Here is 5 small "routines" copied from the book: 1. a Chi-Square Test 2. a solver of quadratic equations ( 3. a converter of angles given in radians to degrees, minutes, and second) ( 4. a program that approximates the definite integral of a function using the trapezoidal rule ) 5. a program that performs four operations (scalar product, cross product, subtraction, addition) on two vectors in three-dimensional space I'm impressed of the GUI and the BASIC compiler and find it fun to be able to "build" own standalone executables. So a big thank you to the QB64 community EDIT: only 3 attachments, I see. Will upload 3 and 4 later
Attachments:chisq.bas (3.72 KB)
quadsolv.bas (1.27 KB)
vectprd.bas (1.55 KB)
|
|
|
Post by nordstjernen on Jan 30, 2023 16:00:31 GMT
Here are the two missing files (se above). Also attached is "Student's t-test" (Student is the name of the inventor). The listing of his test in the book had typos, but I believe it now should be OK. Attachments:rad2deg.bas (1.5 KB)
students.bas (3.63 KB)
trapzslv.bas (1.82 KB)
|
|
|
Post by bplus on Jan 30, 2023 17:38:06 GMT
Built in functions now for Radians to Degrees and Degrees to Radians Checkout: _R2D() and _D2R() PLUS! _PI() see QB64 Wiki Line numbers, how quaint
|
|
|
Post by nordstjernen on Feb 1, 2023 19:14:36 GMT
bplus - thank you for reply! I've checked the wiki and see "Radians to Degrees and Degrees to Radians" belong to extended keywords of QB64 The QB64 editor is nice where at my level I probably not will be in need for the more advanced features. Here 3 more listings from the book matrix1.bas: Matrix Addition, Subtraction, Scalar Multiplication matrix2.bas: Matrix Multiplication intgauss.bas: Integration: Gaussian Quadrature Attachments:matrix1.bas (4.03 KB)
matrix2.bas (3.2 KB)
intgauss.bas (2.55 KB)
|
|
|
Post by bplus on Feb 1, 2023 22:16:37 GMT
Well math is never going to get old, you might have start of nice math library Thumbs up icon here!
|
|
|
Post by nordstjernen on Feb 4, 2023 18:33:44 GMT
Here is yet another one of Lon Pooles listings, from her "Practical Basic Programs" (McGraw Hill 1980). It will calculate and print a lot of statistical information from supplied data. Toshihiro Horie's beautyful simpsn2.bas ( from his homepage ) will approximate the integal of a differential equation by using Simpsons method. A more humble method of integration by Simpsons method is listed on p. 115 in "Basic exercises for the Atari" by J.M. Lamoitier. Lamoitier's listing won't work for me but perhaps someone could take a look and help to make it print to the console? 1. Lon Poole's "stats.bas" 2. Toshihiro Horie's "simpsn2.bas" 3. Lamoitier's "simplamt.bas" Attachments:simpsn2.bas (4.62 KB)
simplamt.bas (1.94 KB)
stats.bas (11.87 KB)
|
|
|
Post by nordstjernen on Feb 5, 2023 11:55:34 GMT
Here is "simsgian.bas", Steve Giannoni's implementation of Simpsons method ( - just floating on the web - Steves homepage unfortunately has disappeared ). The formula for the arch outside McDonald's burger restaurants is that of a parabola: y= - x^2 + 8x - 11 To approximate the area under the curve for the interval -2 to 2 using the trapezoid rule enter the formula as F= -X^2 +8*X -11 in line 210 in Lon's "trapzslv.bas". Setting the number of intervals to 10 the area will be -49.44. If approximating using Simpsons rule with Steve's "simsgian.bas" the formula must be entered as y# = -x#^2 + 8*x# -11 in line 39. After 10 reiterations the area is calculated to -49.333 Estimating using Gauss' method with Lon's "intgauss.bas" the formula must be entered as F= -Z^2 +8*Z -11 in line 350. With intervals set to 10 the result is -49.333 These old guys would'we been loving it
Attachments:simsgian.bas (1.19 KB)
|
|