# Question:derivative of an implicit function

## Question:derivative of an implicit function

Maple 2017

Dear all,

Following the comments I am editing this post:

I have a function F of variables (r1,r2,theta1,theta2,r,theta,a). r1, r2,theta1,theta2 are function of r,  theta and a. I want to take derivative of F with respect to a. r and theta are independent of a . I expressed everything in terms of 'a' as a function of 'a' at first. Then I use diff(F, a). I see there is an error in the final expression G .There is a restriction that theta1 should lie between -Pi to Pi and theta2 between 0 to 2*Pi. I speculate this is the source of error. Work sheet is attached. Reason: value of G: integration in 0 to pi/4 gives some  value but for 0 to pi it evaluates to zero and so is the case with 0 to 2*Pi. As "G "physically represents energy it must be a positive value.

 > restart;
 > theta1 := unapply(arctan(r*sin(theta)/(r*cos(theta)-a)), a);
 (1)
 >
 > ## theta1 -->[-Pi,Pi] and theta2-->[0,2*Pi]
 >
 > theta2 := unapply(arctan(r*sin(theta)/(r*cos(theta)+a)), a);
 (2)
 >
 > r1:=unapply(sqrt((r*cos(theta)-a)^2+r^2*(sin(theta))^2),a);r2:=unapply(sqrt((r*cos(theta)+a)^2+r^2*(sin(theta))^2),a);
 (3)
 > sigma12:=0;sigma22:=sigma;
 (4)
 >
 > ## I have to use a constraint that
 > assume(theta1(a) < Pi, theta1(a) > -Pi, theta2(a) > 0, theta2(a) < 2*Pi, a>0,r>0)
 > u1:=(1+nu)*sigma22*sqrt(r1(a)*r2(a))*(4*(1-2*nu)*cos((theta1(a)+(theta2(a)))/2)-4*r*(1-nu)*cos(theta)/sqrt(r1(a)*r2(a))-2*r^2/(r1(a)*r2(a))*(cos((theta1(a)+(theta2(a)))/2)-cos(2*theta-theta1(a)/2-(theta2(a))/2)))/(4*E)+(1+nu)*sigma12*sqrt(r1(a)*r2(a))*(2*(1-2*nu)*sin((theta1(a)+(theta2(a)))/2)-2*r*(1-nu)*sin(theta)/sqrt(r1(a)*r2(a))+1*r^2/(r1(a)*r2(a))*sin(theta)*cos(theta-theta1(a)/2-(theta2(a))/2))/(E);
 >
 (5)
 >
 > u2:=(1+nu)*sigma*sqrt(r1(a)*r2(a))*(8*(1-nu)*sin((theta1(a)+(theta2(a)))/2)-4*r*(nu)*sin(theta)/sqrt(r1(a)*r2(a))-2*r^2/(r1(a)*r2(a))*(sin((theta1(a)+(theta2(a)))/2)+sin(2*theta-theta1(a)/2-(theta2(a))/2)))/(4*E)+(1+nu)*sigma12*sqrt(r1(a)*r2(a))*((1-2*nu)*cos((theta1(a)+theta2(a))/2)+2*r*(1-nu)*cos(theta)/sqrt(r1(a)*r2(a))-1*r^2/(r1(a)*r2(a))*sin(theta)*sin(theta-theta1(a)/2-theta2(a)/2))/(E);
 >
 (6)
 >
 > ## get u_r and u_theta as u[1] and u[2]
 > u[1] := u1*cos(theta)+u2*sin(theta);
 (7)
 > u[2] := -sin(theta)*u1+cos(theta)*u2;
 (8)
 > Diff_ur := simplify(diff(u[1], a));
 (9)
 >
 >
 > Diff_ut := simplify(diff(u[2], a));
 (10)
 >
 > # find the limiting case
 > Att := limit(Diff_ut*r*sin(2*theta), r = infinity);
 (11)
 > Arr := limit(Diff_ur*r*(1-cos(2*theta)), r = infinity);
 (12)
 > G := (1/8)*(int(Arr+Att, theta = 0 .. Pi/2))*sigma*4;
 (13)
 > simplify(G)
 (14)
 >