# Why does a function definition take so long time?

Posted 7 months ago
339 Views
|
0 Replies
|
0 Total Likes
|
 I defined a function, but it takes a long time to show its result. It will also take long time to use this function later. p1[x_, t_] := pinf + (A2 (-1 + E^(-t \[Theta]c)))/\[Theta]c + \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$0$$, $$t$$]$$\*FractionBox[\(A11\ \*SuperscriptBox[\(E$$, $$\(- \*FractionBox[ SuperscriptBox[\(A10$$, $$2$$], $$t1$$]\) + A3\ $$(\(-t1$$ + t)\) - t1*\ \[Theta]c\)]\), SqrtBox[$$t1$$]] \[DifferentialD]t1\)\) + \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$0$$, $$t$$]$$\((\(-A8$$ + A9 - A15\ \*SuperscriptBox[$$E$$, $$A3\ \((\(-t1$$ + t)\)\)] - A9\ \*SuperscriptBox[$$E$$, $$\((t1 - t)$$\ \[Theta]c\)] - A16\ \*SuperscriptBox[$$E$$, $$A3\ \((\(-t1$$ + t)\)\)]\ Erf[ \*SqrtBox[$$A5$$]\ \*SqrtBox[$$\(-t1$$ + t\)]])\)\ $$( \*FractionBox[ SuperscriptBox[\(E$$, $$- \*FractionBox[ SuperscriptBox[\(A12$$, $$2$$], $$t1$$]\)], $$\*SqrtBox[\(\[Pi]$$]\ \*SqrtBox[$$t1$$]\)] - \*SqrtBox[$$Dp$$]\ \*SuperscriptBox[$$E$$, $$\[Alpha]1\ \((2\ A12\ \*SqrtBox[\(Dp$$] + Dp\ t1*\ \[Alpha]1)\)\)]\ \[Alpha]1\ Erfc[ \*FractionBox[$$A12\ \*SqrtBox[\(Dp$$] + Dp\ t1*\ \[Alpha]1\), SqrtBox[$$Dp\ t1$$]]])\) \[DifferentialD]t1\)\) /. {A10 -> (-lh + x)/( 2 Sqrt[Dc] ), A12 -> (-lh + x)/(2 Sqrt[Dp ])} // Simplify // Normal ep1 = p1[x, t][[1]] ep2 = p1[x, t][[2]] eq3 = p1[x, t][[3]] eq5 = p1[x, t][[4]]