Ask Your Question
0

help show(f) ^ SyntaxError: invalid syntax

asked 2020-08-23 13:31:15 -0600

updated 2020-08-23 19:59:44 -0600

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
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-08-23 20:02:30 -0600

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).

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

Stats

Asked: 2020-08-23 13:31:15 -0600

Seen: 43 times

Last updated: Aug 23