1
$\begingroup$

I have some difficult times to obtain the density function of

mytemp1[x_] :=(1.0248065725187662*^-51*(2.6767526314134802*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*
 Boole[x == -0.23543491335723254] + 2.6767526314134802*^50*
 Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*Boole[x > -0.23543491335723254] + 
1.7063501249740173*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*Boole[x > 0.372854069211365] + 
1.0370049886441548*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*Boole[x >= -1.1256841258094925] - 
1.1012805355466846*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*
 Boole[Inequality[-0.23543491335723254, Less, x, LessEqual, 0.372854069211365]] + 
4.785811934774179*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*
 Boole[-1.1256841258094925 < x < -0.23543491335723254] - 3.8125196967494504*^50*
 Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*
 Boole[Inequality[-0.23543491335723254, Less, x, LessEqual, 0.372854069211365]]*
 Erf[0.6397548845960749 - 0.00011639314699198901*Sqrt[7.5873653*^7 + 6.7402259*^7*x]] - 
5.853648834898374*^50*Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]*
 Boole[-1.1256841258094925 < x < -0.23543491335723254]*Erf[0.9428090415937657 - 0.0000789800278057105*Sqrt[7.5873653*^7 + 6.7402259*^7*x]] - 
1.1567549958229337*^51*Boole[x > 0.372854069211365]*
 Erf[6.862076490981416*^-27*Abs[1.373941317665092*^26 - 1.1509639670952538*^22*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]] + 
9.690248788879874*^46*Sqrt[7.5873653*^7 + 6.7402259*^7*x]*Boole[x > 0.372854069211365]*
 Erf[6.862076490981416*^-27*Abs[1.373941317665092*^26 - 1.1509639670952538*^22*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]]))/Abs[2.666666666699766 - 0.00022338925295887992*Sqrt[7.5873653*^7 + 6.7402259*^7*x]] - Piecewise[{{0.44454379593695487*Erfc[0.9428090415937657 + 0.0000789800278057105*Sqrt[7.5873653*^7 + 6.7402259*^7*x]], x > 0.3728540691229937}, {0.006247666477402043, x == 0.3728540691229937}, {0.10627295280972776, x == -1.1256841258094925}, {-5.280090347178013*^-26*(-1.1301437402263126*^25 + 1.1361278699382123*^25*
   Erf[0.9428090415937657 + 0.0000789800278057105*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]), -1.1256841258094925 < x < -0.23543491342534603}, {-1.0560180694356026*^-25*(-3.720166687592846*^24 + 3.6998374896882866*^24*
   Erf[0.6397548845960749 + 0.00011639314699198901*Sqrt[7.5873653*^7 + 6.7402259*^7*x]]), -0.23543491342534603 < x < 0.3728540691229937}, {0.013583062452533764, x == -0.23543491342534603}}, 0.]

I use the code

fx1[x_] = D[mytemp1[x], x]

when I evaluate it I get for example

fx1[4]

6.079153234720428*^-6 + 3.2335575968221936*^-52*(1.1087414761386247*^50 -4.5032354526767183*^49*Derivative[1][Abs][-1.6329043751585144*^26] - 1.5619432062485812*^50*Derivative[1][Abs][-3.1692850423505785]) +0.08635812743449818*Derivative[1][Abs][-3.1692850423505785]

Which is not a real number.

What am I doing wrong or what is missing in my way? I am not able to either plot or evaluate $fx1[x]$. I would appreciate your help.

$\endgroup$
  • $\begingroup$ It still doesnt help. I was aware of it and with only $_$ not $:$ , I was getting $fx1[9]=6.07915*10^-6 + 3.23356*10^-52 (1.10874*10^50 - 4.50324*10^49 Derivative[1][Abs][-1.6329*10^26] - 1.56194*10^50 Derivative[1][Abs][-3.16929]) + 0.0863581 Derivative[1][Abs][-3.16929]$ the output is not a real value. $\endgroup$ – Seyhmus Güngören Oct 26 '14 at 18:21
  • $\begingroup$ @rm-rf I edited the question. $\endgroup$ – Seyhmus Güngören Oct 26 '14 at 19:12
  • $\begingroup$ Ok, I was going to reopen it but kguler has already done it. Good luck! $\endgroup$ – rm -rf Oct 26 '14 at 19:19
  • $\begingroup$ @rm-rf and kGULER thank you both. $\endgroup$ – Seyhmus Güngören Oct 26 '14 at 19:27
3
$\begingroup$

You can ex-post replace Abs'[...] terms with Sign[...]:

fx0[x_] = D[mytemp1[x], x] /. (Abs' -> Sign);

fx0[#] & /@ Range[10]
(* {0.114698, 0.0894219, 0.0700865, 0.0547306, 0.0424906, 0.0327863, 0.0251506, 
    0.0191887, 0.0145676, 0.0110091} *)
Plot[fx0[x], {x, 0, 10}]

enter image description here

Or, use PiecewiseExpand that seems to prevent the Abs' issue (but it is much slower):

ClearAll[mytemp2, fx2];
mytemp2[x_] := PiecewiseExpand[mytemp1[x], Reals];

fx2[x_] = D[mytemp2[x], x]

enter image description here

fx2[#] & /@ Range[10]
(* {0.114698, 0.0894219, 0.0700865, 0.0547306, 0.0424906, 0.0327863, 0.0251506, 
    0.0191887, 0.0145676, 0.0110091} *)

Plot[fx2[x], {x, 0, 10}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you very much for the help. Really appreciated. $\endgroup$ – Seyhmus Güngören Oct 26 '14 at 23:57
  • $\begingroup$ @seyhmus, glad it solved your problem. Thank you for the Accept. $\endgroup$ – kglr Oct 27 '14 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.