Plot (sin(x)*sin(x)) /x.

##### Title

##### Question

Hi , in this question we have only one parameter. By using one parameter how can we plot the given statement. and the '/x' is after the plot argument statement. so how will it works? can you explain

Python-3.4.3 Using-plot-command-interactively 07-08 min 50-60 sec

__Answers:__

The given statement is the function that is supposed to be plotted, y = f(x) so the equation provided is itself the y parameter.

Please paste the complete traceback along with the command that you used

<ipython-input-55-85e7860a2ace> in <module>

----> 1 plot(sin(x)*sin(x))/x

TypeError: unsupported operand type(s) for /: 'Line2D' and 'float'

Thank you for responding.

The function should be inside the plot command like so plot(<function>)

Example 1. plot( sin(x) )

Example 2 plot( sin(x)/x )

If you observe your command pasted above, you are closing the plot( ) close bracket and then dividing the command by x like so;

plot( <function> ) / x ----> Gives you error

plot( <function> / x ) -----> will run successfully

Login to add comment

25-05-19, 12:42 p.m.esthervsLogin to add comment