Edit: Don't miss the bonus question in post #11.
Back to high school quiz.
In your code should be a sub with the following signature:
The user implements this function. The user enters (directly in the code) any math function they like.
The quiz is to draw the math function.
Some examples (the red graph will be explained soon):
The recommended signature of the drawing sub should be:
As you have probably guessed the red graph is the function derivative.
Note that the only "user" input is the implementation of the Func sub.
6 (out of 10) points - Correctly draw the function.
10 points - Correctly draw the function and its derivative.
You can implement it in B4J or B4A.
Back to high school quiz.
In your code should be a sub with the following signature:
B4X:
Sub Func(x As Double) As Double
The user implements this function. The user enters (directly in the code) any math function they like.
The quiz is to draw the math function.
Some examples (the red graph will be explained soon):
B4X:
Sub Func(x As Double) As Double
Return x
End Sub

B4X:
Return x * x

B4X:
Return Sin(x) * Cos(x)

B4X:
Return Logarithm (x, cE)

B4X:
Return Abs(x)

The recommended signature of the drawing sub should be:
B4X:
Sub Draw(MinX As Double, MaxX As Double, MinY As Double, MaxY As Double)
As you have probably guessed the red graph is the function derivative.
Note that the only "user" input is the implementation of the Func sub.
6 (out of 10) points - Correctly draw the function.
10 points - Correctly draw the function and its derivative.
You can implement it in B4J or B4A.
Last edited: