# Revision history [back]

First you should avoid using y for two different things. When y = function('y')(x) gets evaluated and not y = var('y'), then you get the error you describe:

sage: y = function('y')(x)
sage: a=1
sage: b=0
sage: c=0
sage: d=1
sage: A = ((a*x+b*y)/(c*x+d*y))
sage: A
x/y(x)
sage: A.subs(x=1)
1/y(1)
sage: float(A.subs(x=1))
Traceback (most recent call last):
...
TypeError: unable to simplify to float approximation


The problem is really that Plot2 is empty. Why? You are trying to plot a function that is defined implicitely:

sage: h
1/2*y(x)^2 == 1/2*x^2
sage: h.subs(x=10)
1/2*y(10)^2 == 50


Either, you define the function y(x) explicitely and you can use plot or you can try implicit_plot. But in both cases, I do no know whether you may use y=function('y')(x).

First you should avoid using y for two different things. When y = function('y')(x) gets evaluated and not y = var('y'), then you get the error you describe:

sage: y = function('y')(x)
sage: a=1
sage: b=0
sage: c=0
sage: d=1
sage: A = ((a*x+b*y)/(c*x+d*y))
sage: A
x/y(x)
sage: A.subs(x=1)
1/y(1)
sage: float(A.subs(x=1))
Traceback (most recent call last):
...
TypeError: unable to simplify to float approximation


The problem is really that Plot2 is empty. Why? You are trying to plot a function that is defined implicitely:

sage: h
1/2*y(x)^2 == 1/2*x^2
sage: h.subs(x=10)
1/2*y(10)^2 == 50


Either, you define the function y(x) explicitely and you can use plot or you can try implicit_plot. (look at the examples online). But in both cases, I do no know whether you may use y=function('y')(x).