+ 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, ...

26th Dec 2017, 10:23 PM
Markus R
Markus R - avatar
6 RĂ©ponses
+ 8
this my initial code for sin/ cos /tan https://code.sololearn.com/c8iZREZeV903/?ref=app
27th Dec 2017, 12:03 AM
Mohammad Dakdouk
Mohammad Dakdouk - avatar
+ 2
https://code.sololearn.com/cl65x6dj8sO3/?ref=app
27th Dec 2017, 7:08 AM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 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 ...
27th Dec 2017, 8:05 AM
Markus R
Markus R - avatar
+ 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 ...
28th Dec 2017, 8:14 AM
Markus R
Markus R - avatar
+ 1
Markus, with eval :) ? I update my answer
27th Dec 2017, 12:15 PM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 1
Exactly ... eval is the magic command ...
27th Dec 2017, 2:27 PM
Markus R
Markus R - avatar