Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 3 years ago

keko gravatar image

Assign value to symbolic function?

I have a symbolic function g(x,y), which depends on the variables x and y. Using this, I define the function f(x,y) as: f(x,y)=g(x,y)+2x.

If I calculate the derivative of f(x,y) with respect to x: df(x,y)dx=dg(x,y)dx+2.

Now, I need to evaluate this at x=0, knowing that dg(x,y)dxx=0=10. This should give me: df(x,y)dxx=0=dg(x,y)dxx=0+2=12

The code I have written to achieve this is the following:

x = var('x')
y = var('y')
g = function('g')(x,y) #symbolic function
f = g + 2*x
der_f = diff(f,x); der_f

and this is what I get:

diff(g(x, y), x) + 2

as I expected. However, I don't know how to follow. In particular, I need to know how to:

1) assign dg(x,y)dxx=0=10,

2) evaluate df(x,y)dx at x=0, so that I obtain df(x,y)dxx=0=12.