Ask Your Question
0

help show(f) ^ SyntaxError: invalid syntax

asked 2020-08-23 20:31:15 +0200

updated 2020-08-24 02:59:44 +0200

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-24 03:02:30 +0200

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 20:31:15 +0200

Seen: 336 times

Last updated: Aug 24 '20