Ask Your Question

Replace a variable with a function

asked 2014-07-10 14:42:14 +0200

tetraeder gravatar image

updated 2014-07-11 22:04:49 +0200

kcrisman gravatar image

Hello i hope anyone can help me with the following problem.

i have the following code

T_w,y,T_m,k_f,rho_f,U_0,h_mstar,R, alpha, delta, Phi = var('T_w y T_m k_f rho_f U_0 h_mstar R alpha delta Phi')




now i would like to differentiate integralTu with respect to x (diff(integralTu,x)), but delta must be a function of x (i first defined it as a variable because of the integration).

edit retag flag offensive close merge delete


@tetraeder, @kcrisman: add tags?

slelievre gravatar imageslelievre ( 2014-07-11 12:50:45 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-07-10 15:42:17 +0200

kcrisman gravatar image

You are right that Maxima doesn't want delta to be a function, since it's a limit of integration. That was slightly surprising to me.

Anyway, it turns out you can fix this post-hoc.

sage: integralTu.subs(delta=function('delta',x))
1/10*(2*U_0*h_mstar*rho_f*cos(Phi)*delta(x)^4 + 7*T_m*k_f*delta(x)^3 + 3*T_w*k_f*delta(x)^3)*R*U_0*sin(Phi)/(k_f*delta(x)^3)

That might seem a little hackish, but is just fine.

sage: IT = integralTu.subs(delta=function('delta',x))
sage: diff(IT,x)
1/10*(8*U_0*h_mstar*rho_f*cos(Phi)*delta(x)^3*D[0](delta)(x) + 21*T_m*k_f*delta(x)^2*D[0](delta)(x) + 9*T_w*k_f*delta(x)^2*D[0](delta)(x))*R*U_0*sin(Phi)/(k_f*delta(x)^3) - 3/10*(2*U_0*h_mstar*rho_f*cos(Phi)*delta(x)^4 + 7*T_m*k_f*delta(x)^3 + 3*T_w*k_f*delta(x)^3)*R*U_0*sin(Phi)*D[0](delta)(x)/(k_f*delta(x)^4)

By the way, I've updated your question because you needed one more variable defined.

edit flag offensive delete link more


Thanks, it works!

tetraeder gravatar imagetetraeder ( 2014-07-10 15:53:46 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-07-10 14:42:14 +0200

Seen: 255 times

Last updated: Jul 10 '14