トピック
Link bqllpd

Summation and products in SB

How would you write a simple and staightforward program for continued summation and continued products? \sum_{i=m^n} f(i) and \prod_{i=m^n} f(i) What's the branching, looping and array structures? Much appreciated in advance.
1そうだね
プレイ済み
返信[1]
親投稿
C. Norris 06495a
Don't know about the first question, but for branching, there are goto, Gosub, and label commands. There are while, for, and Do Until loops. If branches don't need to take multiple lines or brackets. No loop uses brackets, instead, an end command. Arrays can have up to four dimensions, with the product of the dimensions being no greater than 100000(i think).
0そうだね
プレイ済み
返信[2]
親投稿
C. Norris 06495a
Values can be assigned to arrays using for loops and data under specific labels. You can read from a text file, but there is no internal tokeniseing, it has to be done manually.
0そうだね
プレイ済み
返信[3]
親投稿
C. Norris 06495a
Functions can also be written. You could probably write a function that did your first question. I hope all this helps. If you have questions, please ask them.
0そうだね
プレイ済み
返信[4]
親投稿
Oscar PwnageBlock
A simple way to do a summation or product is using a FOR loop. For example, you could write the sum from I=M to N of a function F like this... SUM=0 FOR I=M TO N INC SUM,F(I) NEXT ...where F is a user-defined function that returns a numerical value. A product would look pretty similar... PROD=1 FOR I=M TO N PROD=PROD*F(I) NEXT
1そうだね
プレイ済み