Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input a equation #116

Open
kakshaycs opened this issue Nov 14, 2017 · 3 comments
Open

input a equation #116

kakshaycs opened this issue Nov 14, 2017 · 3 comments

Comments

@kakshaycs
Copy link

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
Copy link

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 = 4*x
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
Copy link

import math

def eqn(x):
a = math.log(x)
b = math.sin(x)
c = x**2
d = 4*x
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
Copy link

ghost commented Nov 27, 2020

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 = 4*x
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants