(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 13.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 22466, 634] NotebookOptionsPosition[ 19301, 551] NotebookOutlinePosition[ 21066, 603] CellTagsIndexPosition[ 21023, 600] WindowTitle->NFourierCoefficient | Example Notebook WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Basic Examples", "\[NonBreakingSpace]", Cell["(3)", "ExampleCount"], "\[NonBreakingSpace]" }], "Subsection", TaggingRules->{}, CellID->1338793736], Cell["Calculate numerical approximation for a Fourier coefficient:", "Text", TaggingRules->{}, CellChangeTimes->{{3.765284626043072*^9, 3.765284628562324*^9}}, CellID->320560372], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ DynamicModuleBox[{Typeset`open = False}, FrameBox[ PaneSelectorBox[{False->GridBox[{ { PaneBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->0.6538461538461539 Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ RowBox[{ StyleBox["NFourierCoefficient", "ResourceFunctionLabel"], " "}], ShowAutoStyles->False, ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited, FontColor->GrayLevel[0.1]]} }, GridBoxSpacings->{"Columns" -> {{0.25}}}], Alignment->Left, BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False}, BaselinePosition->Baseline, FrameMargins->{{3, 0}, {0, 0}}], ItemBox[ PaneBox[ TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeCloser"], ImageSizeCache->{11., {1., 10.}}], False-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeOpener"], ImageSizeCache->{11., {1., 10.}}]}, Appearance->None, BaselinePosition->Baseline, ContentPadding->False, FrameMargins->0], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{1, 1}, {0, 0}}], Frame->{{ RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}], True-> GridBox[{ {GridBox[{ { PaneBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->0.6538461538461539 Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ RowBox[{ StyleBox["NFourierCoefficient", "ResourceFunctionLabel"], " "}], ShowAutoStyles->False, ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited, FontColor->GrayLevel[0.1]]} }, GridBoxSpacings->{"Columns" -> {{0.25}}}], Alignment->Left, BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False}, BaselinePosition->Baseline, FrameMargins->{{3, 0}, {0, 0}}], ItemBox[ PaneBox[ TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeCloser"]], False-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeOpener"]]}, Appearance->None, BaselinePosition->Baseline, ContentPadding->False, FrameMargins->0], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{1, 1}, {0, 0}}], Frame->{{ RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}]}, { StyleBox[ PaneBox[GridBox[{ { RowBox[{ TagBox["\<\"Version (latest): \"\>", "IconizedLabel"], " ", TagBox["\<\"1.0.0\"\>", "IconizedItem"]}]}, { TagBox[ TemplateBox[{ "\"Documentation \[RightGuillemet]\"", "https://resources.wolframcloud.com/FunctionRepository/\ resources/NFourierCoefficient"}, "HyperlinkURL"], "IconizedItem"]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Left}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{5, 4}, {0, 4}}], "DialogStyle", FontFamily->"Roboto", FontSize->11]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxDividers->{"Columns" -> {{None}}, "Rows" -> {False, { GrayLevel[0.8]}, False}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}]}, Dynamic[ Typeset`open], BaselinePosition->Baseline, ImageSize->Automatic], Background->RGBColor[ 0.9686274509803922, 0.9764705882352941, 0.984313725490196], BaselinePosition->Baseline, DefaultBaseStyle->{}, FrameMargins->{{0, 0}, {1, 0}}, FrameStyle->RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627], RoundingRadius->4]], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "NFourierCoefficient"}, TagBoxNote->"FunctionResourceBox"], ResourceFunction["NFourierCoefficient"], BoxID -> "NFourierCoefficient", Selectable->False], "[", RowBox[{ RowBox[{ RowBox[{"t", "^", "2"}], "+", RowBox[{"3", "t"}]}], ",", "t", ",", "5"}], "]"}]], "Input", TaggingRules->{}, CellLabel->"In[16]:=", CellID->60547135], Cell[BoxData[ RowBox[{ RowBox[{"-", "0.0799999999999998`"}], "-", RowBox[{"0.5999999999999995`", " ", "\[ImaginaryI]"}]}]], "Output", TaggingRules->{}, CellChangeTimes->{3.7609811040180902`*^9}, ImageSize->{86, 16}, ImageMargins->{{0, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, CellLabel->"Out[16]=", CellID->1670941360] }, Open ]], Cell["Compare with the answer from symbolic evaluation:", "Text", TaggingRules->{}, CellID->67562546], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"FourierCoefficient", "[", RowBox[{ RowBox[{ RowBox[{"t", "^", "2"}], "+", RowBox[{"3", "t"}]}], ",", "t", ",", "n"}], "]"}]], "Input", TaggingRules->{}, CellLabel->"In[19]:=", CellID->165513799], Cell[BoxData[ TagBox[GridBox[{ {"\[Piecewise]", GridBox[{ { FractionBox[ SuperscriptBox["\[Pi]", "2"], "3"], RowBox[{"n", "\[Equal]", "0"}]}, { FractionBox[ RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"-", "1"}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"2", "+", RowBox[{"3", " ", "\[ImaginaryI]", " ", "n"}]}], ")"}]}], SuperscriptBox["n", "2"]], TagBox["True", "PiecewiseDefault", AutoDelete->True]} }, AllowedDimensions->{2, Automatic}, Editable->True, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.84]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}, Selectable->True]} }, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.35]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "Piecewise", DeleteWithContents->True, Editable->False, SelectWithContents->True, Selectable->False, StripWrapperBoxes->True]], "Output", TaggingRules->{}, CellChangeTimes->{3.7609813366387463`*^9}, ImageSize->{108, 35}, ImageMargins->{{0, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, CellLabel->"Out[19]=", CellID->1558439594] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"%", "/.", RowBox[{"{", RowBox[{"n", "\[Rule]", " ", "5."}], "}"}]}]], "Input", TaggingRules->{}, CellLabel->"In[20]:=", CellID->151253485], Cell[BoxData[ RowBox[{ RowBox[{"-", "0.08`"}], "-", RowBox[{"0.6`", " ", "\[ImaginaryI]"}]}]], "Output", TaggingRules->{}, CellChangeTimes->{3.76098133727509*^9}, ImageSize->{86, 16}, ImageMargins->{{0, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, CellLabel->"Out[20]=", CellID->1983697546] }, Open ]], Cell["\<\ Repeat the computation, using a different definition of the Fourier transform:\ \>", "Text", TaggingRules->{}, CellChangeTimes->{{3.765284626043072*^9, 3.765284661391607*^9}}, CellID->204528965], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ DynamicModuleBox[{Typeset`open = False}, FrameBox[ PaneSelectorBox[{False->GridBox[{ { PaneBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->0.6538461538461539 Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ RowBox[{ StyleBox["NFourierCoefficient", "ResourceFunctionLabel"], " "}], ShowAutoStyles->False, ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited, FontColor->GrayLevel[0.1]]} }, GridBoxSpacings->{"Columns" -> {{0.25}}}], Alignment->Left, BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False}, BaselinePosition->Baseline, FrameMargins->{{3, 0}, {0, 0}}], ItemBox[ PaneBox[ TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeCloser"], ImageSizeCache->{11., {1., 10.}}], False-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeOpener"], ImageSizeCache->{11., {1., 10.}}]}, Appearance->None, BaselinePosition->Baseline, ContentPadding->False, FrameMargins->0], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{1, 1}, {0, 0}}], Frame->{{ RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}], True-> GridBox[{ {GridBox[{ { PaneBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->0.6538461538461539 Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ RowBox[{ StyleBox["NFourierCoefficient", "ResourceFunctionLabel"], " "}], ShowAutoStyles->False, ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited, FontColor->GrayLevel[0.1]]} }, GridBoxSpacings->{"Columns" -> {{0.25}}}], Alignment->Left, BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False}, BaselinePosition->Baseline, FrameMargins->{{3, 0}, {0, 0}}], ItemBox[ PaneBox[ TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeCloser"]], False-> DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "IconizeOpener"]]}, Appearance->None, BaselinePosition->Baseline, ContentPadding->False, FrameMargins->0], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{1, 1}, {0, 0}}], Frame->{{ RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}]}, { StyleBox[ PaneBox[GridBox[{ { RowBox[{ TagBox["\<\"Version (latest): \"\>", "IconizedLabel"], " ", TagBox["\<\"1.0.0\"\>", "IconizedItem"]}]}, { TagBox[ TemplateBox[{ "\"Documentation \[RightGuillemet]\"", "https://resources.wolframcloud.com/FunctionRepository/\ resources/NFourierCoefficient"}, "HyperlinkURL"], "IconizedItem"]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Left}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], Alignment->Left, BaselinePosition->Baseline, FrameMargins->{{5, 4}, {0, 4}}], "DialogStyle", FontFamily->"Roboto", FontSize->11]} }, BaselinePosition->{1, 1}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}}, GridBoxDividers->{"Columns" -> {{None}}, "Rows" -> {False, { GrayLevel[0.8]}, False}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}]}, Dynamic[ Typeset`open], BaselinePosition->Baseline, ImageSize->Automatic], Background->RGBColor[ 0.9686274509803922, 0.9764705882352941, 0.984313725490196], BaselinePosition->Baseline, DefaultBaseStyle->{}, FrameMargins->{{0, 0}, {1, 0}}, FrameStyle->RGBColor[ 0.8313725490196079, 0.8470588235294118, 0.8509803921568627], RoundingRadius->4]], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "NFourierCoefficient"}, TagBoxNote->"FunctionResourceBox"], ResourceFunction["NFourierCoefficient"], BoxID -> "NFourierCoefficient", Selectable->False], "[", RowBox[{ RowBox[{ RowBox[{"t", "^", "2"}], "+", RowBox[{"3", "t"}]}], ",", "t", ",", "5", ",", RowBox[{"FourierParameters", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"1", ",", RowBox[{ RowBox[{"-", "2"}], "\[Pi]"}]}], "}"}]}]}], "]"}]], "Input", TaggingRules->{}, CellLabel->"In[17]:=", CellID->107291147], Cell[BoxData[ RowBox[{ RowBox[{"-", "0.0020264236728467595`"}], "+", RowBox[{"0.09549296585513703`", " ", "\[ImaginaryI]"}]}]], "Output", TaggingRules->{}, CellChangeTimes->{3.7609811304777308`*^9}, ImageSize->{165, 16}, ImageMargins->{{0, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, CellLabel->"Out[17]=", CellID->1312829930] }, Open ]] }, Open ]] }, ClosingSaveDialog->False, WindowSize->Automatic, WindowMargins->Automatic, WindowTitle->"NFourierCoefficient | Example Notebook", Visible->False, FrontEndVersion->"13.0 for Mac OS X x86 (64-bit) (December 9, 2021)", StyleDefinitions->Notebook[{ Cell[ StyleData[ StyleDefinitions -> FrontEnd`FileName[{"Wolfram"}, "Reference.nb", CharacterEncoding -> "UTF-8"]]], Cell[ StyleData[All, "Working"], Editable -> True, DockedCells -> {}], Cell[ StyleData["Notebook"], Editable -> True, DockedCells -> {}, ScrollingOptions -> {"VerticalScrollRange" -> Automatic}], Cell[ StyleData[ "Section", StyleDefinitions -> StyleData["PrimaryExamplesSection"]], Editable -> True, ShowGroupOpener -> "Inline", WholeCellGroupOpener -> True], Cell[ StyleData["Subsection", StyleDefinitions -> StyleData["ExampleSection"]], Editable -> True, ShowGroupOpener -> "Inline", WholeCellGroupOpener -> True], Cell[ StyleData[ "Subsubsection", StyleDefinitions -> StyleData["ExampleSubsection"]], Editable -> True, ShowGroupOpener -> "Inline", WholeCellGroupOpener -> True], Cell[ StyleData[ "Subsubsubsection", StyleDefinitions -> StyleData["ExampleSubsubsection"]], Editable -> True, ShowGroupOpener -> "Inline", WholeCellGroupOpener -> True], Cell[ StyleData["Text", StyleDefinitions -> StyleData["ExampleText"]], Editable -> True]}, Visible -> False, FrontEndVersion -> "13.0 for Mac OS X x86 (64-bit) (December 9, 2021)", StyleDefinitions -> "PrivateStylesheetFormatting.nb"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[632, 23, 169, 7, 70, "Subsection",ExpressionUUID->"b6a3c8cc-cf35-496e-a1f6-285a5451c05f", CellID->1338793736], Cell[804, 32, 181, 3, 70, "Text",ExpressionUUID->"af14cc44-b7b6-4c43-be4b-d4124424b9e6", CellID->320560372], Cell[CellGroupData[{ Cell[1010, 39, 7259, 185, 70, "Input",ExpressionUUID->"e373d782-951c-4299-a292-edd6f50a6cdf", CellID->60547135], Cell[8272, 226, 334, 10, 70, "Output",ExpressionUUID->"21cbf058-94f8-416d-ad0e-28c38664d7e6", CellID->1670941360] }, Open ]], Cell[8621, 239, 103, 2, 70, "Text",ExpressionUUID->"0f209287-aa55-4ad0-89b9-0fd3bf802c18", CellID->67562546], Cell[CellGroupData[{ Cell[8749, 245, 236, 8, 70, "Input",ExpressionUUID->"ccb6e632-7838-4c65-9911-423292ca72aa", CellID->165513799], Cell[8988, 255, 1756, 55, 70, "Output",ExpressionUUID->"706b34e9-ba62-493d-af45-37e04c374ee6", CellID->1558439594] }, Open ]], Cell[CellGroupData[{ Cell[10781, 315, 172, 6, 70, "Input",ExpressionUUID->"e7a1eccc-d0b3-47ed-b0dc-c39f095518de", CellID->151253485], Cell[10956, 323, 302, 10, 70, "Output",ExpressionUUID->"f98d4bf1-7ffd-4e9b-af2c-308a97cb8807", CellID->1983697546] }, Open ]], Cell[11273, 336, 207, 5, 70, "Text",ExpressionUUID->"5739e867-ec71-4c4e-a323-12944960c733", CellID->204528965], Cell[CellGroupData[{ Cell[11505, 345, 7426, 190, 70, "Input",ExpressionUUID->"8dfbaf33-6d61-4bea-b2c5-21d9b7e8d203", CellID->107291147], Cell[18934, 537, 339, 10, 70, "Output",ExpressionUUID->"f7e01ada-ed9d-4527-8ee8-d861bd9e3deb", CellID->1312829930] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)