Discussions

SmileBASIC Community

Linkbqllpd

08/22/2016 1:03 AM ·Spoilers

Open Closed

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.

Advertisement

Comment

This post has no comments.

  • 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).

    Yeahs0
    Played
  • 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.

    Yeahs0
    Played
  • 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.

    Yeahs0
    Played
  • 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

    Yeahs1
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-EJ9-9E2D-9NB-LWD8

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: