Using Apple Basic for math

11 posts / 0 new
Last post
wdm57's picture
Offline
Last seen: 18 years 11 months ago
Joined: Mar 8 2005 - 16:33
Posts: 9
Using Apple Basic for math

I was fooling around on Apple Basic today and I noticed that if you type print and a simple equation, such as 2+2=4 and it can tell you if it is right. For example if you type print 3+2=5, it replies "1" because it is correct. If you type print 2+2=5, it replies "0" because the equation is incorrect. Does anyone know if Basic can be used for complex Algbraic equations with variables?

Offline
Last seen: 8 months 3 weeks ago
Joined: Dec 19 2003 - 18:53
Posts: 906
Immediate execution mode & program instructions

What you are doing is known as immediate execution mode.
I'm not sure if you can use the higher functions in that mode, but you should test it and find out.

Yes, (AppleSoft) BASIC can handle complex algebraic functions, including the use of variables. Trigonometric functions too.

You need the Apple issued Basic programming books. They will help you a lot.

Mutant_Pie

wdm57's picture
Offline
Last seen: 18 years 11 months ago
Joined: Mar 8 2005 - 16:33
Posts: 9
Do you know where I can find

Do you know where I can find these books/info online about using BASIC for math?

Thanks

Jon
Jon's picture
Offline
Last seen: 12 years 10 months ago
Joined: Dec 20 2003 - 10:38
Posts: 2804
I believe that if you enter a

I believe that if you enter a command w/o a line number, it will be executed. IF you have a line number it will be stored, and won't run until you do "RUN" it.

Offline
Last seen: 3 years 7 months ago
Joined: Mar 9 2005 - 03:00
Posts: 79
I've uploaded a 200 page appl

I've uploaded a 200 page applesoft programming book but it has not been put online yet.

Offline
Last seen: 8 months 3 weeks ago
Joined: Dec 19 2003 - 18:53
Posts: 906
Google, Ebay, The Apple Webring

Time for you to search the universe, Grasshopper. Start with Google, Ebay, and the Apple II Webring.

Here is an Ebay auction that would fulfill an initial need (though you might do better with a later Apple published manual).

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=14906&item=5173883188&rd=1

Mutant_Pie

wdm57's picture
Offline
Last seen: 18 years 11 months ago
Joined: Mar 8 2005 - 16:33
Posts: 9
I know how to use variables w

I know how to use variables with the input command, but i don't know how to make the computer input the varible instead of me, such as typing in 5+x=7 and making BASIC solve for x. Does your book say anything about that?

Offline
Last seen: 8 months 3 weeks ago
Joined: Dec 19 2003 - 18:53
Posts: 906
Setting variables. . .

Here are some acceptable forms for your problem;

10 LET X=7-5

or

10 X=7-5

In both of those examples, you are setting the value for the variable "X". Of course, the real power of variables is their interaction, testing and then reporting on that interaction. For example;

10 TEXT: HOME
15 Y=7: Z=5: X=Y-Z
20 X=X+2: PRINT Secret IF X=20 THEN END
25 GOTO 20

The above program, when typed in, then RUN in Applesoft Basic, assigns the value for two variables Y, Z, then sets X equal to the difference between Y and Z (the value 2), then increase X by 2, prints it, tests if equals 20, if not then it continues. The result should be a count up from 4 (Y-Z+2) in increments of 2 until it reaches 20, then the program ends.

In BASIC, "+" adds, "-" subtracts, "*" multiplies, and "\" divides. Have fun.

Mutant_Pie

wdm57's picture
Offline
Last seen: 18 years 11 months ago
Joined: Mar 8 2005 - 16:33
Posts: 9
Thanks, this has helped some.

Thanks, this has helped some. I noticed something wierd. If you type "graph" into basic, some colors flash across the screen and disappear. Can you graph on basic?

Offline
Last seen: 8 months 3 weeks ago
Joined: Dec 19 2003 - 18:53
Posts: 906
GR=display LO-RES graphics

The Applesoft BASIC interpreter is not perfect. It will recognize the first letters of an entry that comprise a recognized command. GR is the command to display the LORES (low resolution) graphics screen. APH were probably read as an error. The colors you saw were random bits of data stored in the memory section that is displayed as the LORES screen. When the GR command is given, it first displays what is there, then clears it to black.

If you want a program to display a graph, you have to write it.

Mutant_Pie

wdm57's picture
Offline
Last seen: 18 years 11 months ago
Joined: Mar 8 2005 - 16:33
Posts: 9
Cool! Thanks

Cool! Thanks

Log in or register to post comments