+ 4
(Challenge) Value Table Calculator
Write a program that take the following inputs expression: (example: “sin(x)”) independent variable: (example: “x”) var min: example: “-10” var max: example: “+10” step: example: “0.1” and generate a table, based on the inputs, printing the value of the stepped independent variable and the expression. Reasonable simple in python, ...
6 Answers
+ 8
this my initial code for sin/ cos /tan
https://code.sololearn.com/c8iZREZeV903/?ref=app
+ 2
https://code.sololearn.com/cl65x6dj8sO3/?ref=app
+ 2
Good initial work! Try to be more generic and to support all mathematical expressions that your programming language understands ...
For example also more complex things like 2*x + sin(x) + (x*cos(x)). In python this can be done without writing a complex parser ...
+ 2
https://code.sololearn.com/cy9ZcWkI3wZP/?ref=app
Here’s an attempt in python that allows additionally expressions for the min / max and step values ...
+ 1
Markus, with eval :) ? I update my answer
+ 1
Exactly ... eval is the magic command ...