First time here? Check out the FAQ!

Ask Your Question
0

help show(f) ^ SyntaxError: invalid syntax

asked 4 years ago

kmr2014 gravatar image

updated 4 years ago

slelievre gravatar image

I write the following code:

f(x) = (xcos(x) + sin(x))/(x+1) + (xsin(x)/((x+1)^2)
show(f)

Whenever I try to plot a graph, the following error appears:

File "<ipython-input-1-9a8367ab3956>", line 2
    show(f)
           ^
SyntaxError: invalid syntax
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

slelievre gravatar image

The expression for f(x) is missing a closing parenthesis.

The next error might be a NameError concerning xcos.

Multiplication should be explicit: write x*cos(x) and x*sin(x) instead of xcos(x) and xsin(x).

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 4 years ago

Seen: 438 times

Last updated: Aug 24 '20