## I have a small program that looks like this;

scalar x, f, df;

x = 0;

f = exp((x)); abort$( f ne 1) ‘should get 1’;

df = exp.grad(x); abort$( df ne 1) ‘should get 1’;

## display df;

This executes well for the given exponential function ---->e^x .

Now I want to change function to find gradient is as------> x^2+2x.

how can i do this.

\

Hi,

I have liitle success in finding gradient of x^2+2x in parts;

I have done for x^2 using power(x,2);df1=power.grad(x,2);

but I cant do for 2x,how gams product to put IN above form

please help

Aby

On Oct 7, 7:42 am, ABY wrote:

I have a small program that looks like this;

---------------------------------------------------------------------------Â—

scalar x, f, df;

x = 0;

f = exp((x)); abort$( f ne 1) ‘should get 1’;

df = exp.grad(x); abort$( df ne 1) ‘should get 1’;

display df;

---------------------------------------------------------------------------Â-------

This executes well for the given exponential function ---->e^x .

Now I want to change function to find gradient is as------> x^2+2x.

how can i do this.

\