zwerg4 - 1 year ago 183

LaTeX Question

You guys have an idea why latex plots the wrong function?

This is my function:

`\draw [scale=0.5,domain=-3:3,smooth,variable=\x] plot (\x,0.5*\x^4 - 3*\x^2+ 4) node[right] {$f(x)=0.5*x^4 - 3*x^2 + 4$};`

and this is the result:

Latex Graph

But is should look like this:

Right Graph

Thank you

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

In `tikz`

, parentheses are required to properly square negative numbers.

```
\draw [scale=0.5,domain=-3:3,smooth,variable=\x] plot (\x,{0.5*(\x)^4 - 3*(\x)^2+ 4}) node[right] {$f(x)=0.5*x^4 - 3*x^2 + 4$};
```

This should produce what you wanted.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**