karan / Projects

:page_with_curl: A list of practical projects that anyone can solve in any programming language.
https://twitter.com/karangoel
MIT License
44.57k stars 10.52k forks source link

input a equation #116

Open kakshaycs opened 6 years ago

kakshaycs commented 6 years ago

how to read a equation (input window) and make a function that compute the regarding value of equation on a certain point example:- f(x)=x^2+4x^3sin(x)+log(x) read this equation and calculate the value of equation on a particular point(x).

AllenWalker16 commented 4 years ago

import math

x = int(input("enter the value of x: ")) def eqn(x): a = math.log(x) b = math.sin(x) c = x*2 d = 4x y = c + d * 3 b + a return y

pass the desired value of x into the parentheses in the expression below

dt = eqn() print(dt)

AllenWalker16 commented 4 years ago

import math

def eqn(x): a = math.log(x) b = math.sin(x) c = x*2 d = 4x y = c + d * 3 b + a return y

pass the desired value of x into the parentheses in the expression below

dt = eqn() print(dt)

ghost commented 3 years ago

example:- f(x)=x^2+4x^3sin(x)+log(x)

import math

def equation(x): var_1 = math.sin(x) var_2 = math.log(x) var_3 =x*2 var_4 = 4x y = 0

y =  var_3 +var_4**3*var_1+var_2+y
return  y

print(equation(12)) # by using this it will not print a null value