I'm new to BBC BASIC (downloaded it a few days ago) but I did a bit of BASIC programming in the '80s when I was a teacher. This included Timetable Clash Matrix programs, generating class lists and student and teacher timetables and so on. It's a delight to come back to BASIC after so many years and I have a few projects in mind.
My question relates to whether it is possible to have the User enter a mathematical expression which the program then picks up and uses as a function.
For example, I've written a program that replicates Newton's method for approximating a point on a curve given an initial point and the derivative of the curve. But it requires me to enter the derivative into the code for the program. Obviously, it would be nicer to have the User input the DE so I don't have to change the code each time.
Is there a way of doing this?
Cheers.
INPUT Maths expressions by Users: possible?
-
- Posts: 64
- Joined: Tue 03 Apr 2018, 12:07
- Location: Belgium
Re: INPUT Maths expressions by Users: possible?
Did you check the manual for EVAL ?
Edja
Regards,EVAL
A function which applies the interpreter's expression evaluation program to the characters held in the argument string.
X=EVAL("X^Q+Y^P")
X=EVAL"A$+B$"
X$=EVAL(A$)
In effect, you pass the string to BBC BASIC's evaluation program and say 'work this out'.
Edja
-
- Posts: 2
- Joined: Thu 27 Feb 2025, 09:25
Re: INPUT Maths expressions by Users: possible?
Thanks, Edja, I'll follow that up.
Cheers.
Cheers.