Graph an equation!

Please note that this question is different from this question. This one asks for graphical output, while the other one asks for ascii art.

Objective

Help! Timmy's graphing calculator broke! His calculator cannot graph anymore. However, he has found a way to add new programs and functions to his calculator. Your job is to write a program/function that graphs equations.

Rules

• Your program/function should take in a string in the form of "y = random equation involving x" and graph it on the coordinate grid.
• Timmy's calculator doesn't have that much memory, so please try to make your code as short as possible.
• The operations needed are addition (+), subtraction (-), multiplication (*), division (/), exponentiation(^) and grouping(())
• Your program/function should be able to graph from x=-5 to x=5, and from y=-5 to y=5.
• Color, axis labels, the grid, numbers, scale, and animation are optional.
• The minimum size of the image should be 50x50 pixels.

Test Cases

Input

y = x ^ 2

Input

y = 4 * x + 3

Output

Standard loopholes apply.

You may change the operators, but it adds +10% to your byte count.

• What is the minimum size of the image to be output? Mar 20, 2016 at 13:13
• 50x50 pixels minimum. Mar 20, 2016 at 13:22
• Desmos, 0 bytes? It has been defined as a programming language. Mar 20, 2016 at 13:50
• What does this mean: "Your program/function should be able to graph from x=-5 to x=5, and from y=-5 to y=5"? What should the boundaries be if y = 0.01*x? And what about y = 1000*x? Snould all boundaries be [-5, 5][-5, 5] regardless of what the function is? Mar 20, 2016 at 13:55
• I think you should ban plotting builtins. Those will lead to answers with just one function call. Mar 20, 2016 at 14:12

Matlab, 35 bytes

ezplot(input(''));axis([-5 5 -5 5])


Input is a string like 'y=2*x^2'.

• Maybe you should clarify that the string needs to include the quotation marks Mar 21, 2016 at 21:56

Mathematica, 89 77 bytes

Plot[ToExpression[#~StringDrop~4],{x,-5,5},PlotRange->{-5,5},AspectRatio->1]&


Most of it is just formatting to make it look similar to the examples. Please inform me if something isn't required. Includes axis markers, which aren't explicitly disallowed.

• The question says you do not need the axis markers. But if it reduces the byte count you can probably use them. Mar 20, 2016 at 14:54

RPL/2 15*1.1 = 16.5

STEQ .5 *S DRAW


Timmy must key in the equation in capitals, e.g.'Y = X ^ 3', hence the 10% penalty.

The .5 is just luck: the default box is -10…10 × -10…10 with RPL/2.

MATL, 40 * 1.1 = 44

K0h)5:p'(-5:.1:5)'XHYXUHUw2\$XG-5,5hth1ZG


This works in current version (15.0.0) of the language. EDIT (June 15, 2017): You can try it at MATL Online!

.*, ./ and .^ are for multiplication, division and power (that is, add a dot in front).

The following shows an example result running on Matlab.