Ask Your Question

A function being an input

asked 2019-02-18 23:36:48 +0100

EnlightenedFunk gravatar image

I have the following code and I am trying to get an output, and I keep getting an error y is not defined. Could you please help?

 f = sage_eval(str(input("What is the function:" )), locals = {'y' == y})
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-19 01:31:11 +0100

tmonteil gravatar image

The parameter locals should be a dictionary not the set {False}:

sage: var('y')
sage: f = sage_eval(str(input("What is the function:" )), locals = {'y': y})
What is the function:cos(y)
sage: integral(f,y,0,16)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-02-18 23:36:48 +0100

Seen: 247 times

Last updated: Feb 19 '19