I want to utilize two functions in one package and use the package in a cdf file. I thought it was going to be a straight forward but apparently it is not. In the code I want to compare result of a numerical and symbolic integral. It is a simple code allows me learn the things I need to learn with the help I am getting in here.
I would appreciate it if anybody can point out my mistake
Manipulate[
DynamicModule[{f = Sin[x], xR = 1, xL = 0,
Res = 0.4596976941318603`16, NRes = 0.4596976941318603`16},
Column[{Row[{"Lower Limit ", InputField[Dynamic[xL], Number]},
Spacer[5]],
Row[{"Upper Limit ", InputField[Dynamic[xR], Number]}, Spacer[5]],
Row[{"Function ", InputField[Dynamic[f]]}, Spacer[20]],
Button[Style["Calculate", Green, Bold],
Dynamic[Res = TFPackageSourceCode2`WD1Int[f, xR, xL, np, nw];]],
Dynamic[NRes = TFPackageSourceCode2`ND1Int[f, xR, xL, nw];],
Row[{"Result", InputField[Dynamic[Res], Enabled -> False]},
Spacer[51]],
Row[{"Symbolic", InputField[Dynamic[NRes], Enabled -> False]},
Spacer[35]]
}]], {{np, 16, "NumberFormat"},
ControlPlacement -> Bottom}, {{nw, 16, "WorkingPrecision"},
ControlPlacement -> Bottom},
Initialization :> (Get[
FileNameJoin[{NotebookDirectory[EvaluationNotebook[]],
"TFPackageSourceCode2.wl"}]];)]
and the package is
BeginPackage["TFPackageSourceCode2`"];
WD1Int::usage="";
ND1Int::usage="";
Clear[Global`x];
Begin["`Private`"];
WD1Int[f_,xR_,xL_,np_,nw_]:=Module[{xLcheck,xRcheck},xLcheck=NumberQ[xL];
xRcheck=NumberQ[xR];
If[xLcheck==True&&xRcheck==True,ResultTF=SetPrecision[NIntegrate[f,{Global`x,xL,xR},WorkingPrecision->Re[IntegerPart[nw]]],Re[IntegerPart[np]]],"Enter numeric inputs for Lower and Upper Limits"]];
SetAttributes[WD1Int,{ReadProtected,Protected,Locked}];
End[];
ND1Int[f_,xR_,xL_,nw_]:=Module[{xLcheck,xRcheck},xLcheck=NumberQ[xL];
xRcheck=NumberQ[xR];
If[xLcheck==True&&xRcheck==True,NResultTF=SetAccuracy[Integrate[f,{Global`x,xL,xR},Re[IntegerPart[nw]]],"Enter numeric inputs for Lower and Upper Limits"]];
SetAttributes[ND1Int,{ReadProtected,Protected,Locked}];
End[];
EndPackage[];
Thank you for the help.