G12-NAOE9104-非线性动力学-HAM代码

m20230317摄动求解.nb

(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     22344,        772]
NotebookOptionsPosition[     19560,        670]
NotebookOutlinePosition[     19903,        685]
CellTagsIndexPosition[     19860,        682]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[
 RowBox[{
  RowBox[{"(*", "\:6444\:52a8\:65b9\:6cd5\:6c42\:89e31", "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"\:63a7\:5236\:65b9\:7a0b", " ", 
         RowBox[{"V", "'"}], 
         RowBox[{"(", "t", ")"}]}], "+", 
        RowBox[{"V", 
         RowBox[{
          RowBox[{"(", "t", ")"}], "^", "2"}]}]}], "=", "1"}], ",", " ", 
      RowBox[{"t", "\[GreaterEqual]", "0"}], ",", " ", "V90"}], ")"}], "=", 
    "0"}], "*)"}], "\[IndentingNewLine]", 
  RowBox[{"(*", "\:5047\:8bbe\:65f6\:95f4t\:4e3a\:5c0f\:53c2\:6570", "*)"}], 
  "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"V", "[", "t_", "]"}], "=", 
     RowBox[{"a0", "+", 
      RowBox[{"a1", "*", "t"}], "+", 
      RowBox[{"a2", "*", 
       RowBox[{"t", "^", "2"}]}], "+", 
      RowBox[{"a3", "*", 
       RowBox[{"t", "^", "3"}]}]}]}], " ", ";"}], "\[IndentingNewLine]", 
   RowBox[{"eq1", "=", 
    RowBox[{
     RowBox[{"D", "[", 
      RowBox[{
       RowBox[{"V", "[", "t", "]"}], ",", "t"}], "]"}], "+", 
     RowBox[{
      RowBox[{"V", "[", "t", "]"}], "^", "2"}], "-", "1"}]}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{{3.8879165881542664`*^9, 3.8879166453552375`*^9}, {
   3.887916705789909*^9, 3.887916715456401*^9}, {3.8879168387143836`*^9, 
   3.8879171249355755`*^9}, 3.887917658286487*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", "1"}], "+", "a1", "+", 
  RowBox[{"2", " ", "a2", " ", "t"}], "+", 
  RowBox[{"3", " ", "a3", " ", 
   SuperscriptBox["t", "2"]}], "+", 
  SuperscriptBox[
   RowBox[{"(", 
    RowBox[{"a0", "+", 
     RowBox[{"a1", " ", "t"}], "+", 
     RowBox[{"a2", " ", 
      SuperscriptBox["t", "2"]}], "+", 
     RowBox[{"a3", " ", 
      SuperscriptBox["t", "3"]}]}], ")"}], "2"]}]], "Output",
 CellChangeTimes->{{3.8879171211759424`*^9, 3.8879171259391828`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"eq2", "=", 
  RowBox[{"eq1", "//", "Expand"}]}]], "Input",
 CellChangeTimes->{{3.8879171335849524`*^9, 3.887917137492957*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", "1"}], "+", 
  SuperscriptBox["a0", "2"], "+", "a1", "+", 
  RowBox[{"2", " ", "a0", " ", "a1", " ", "t"}], "+", 
  RowBox[{"2", " ", "a2", " ", "t"}], "+", 
  RowBox[{
   SuperscriptBox["a1", "2"], " ", 
   SuperscriptBox["t", "2"]}], "+", 
  RowBox[{"2", " ", "a0", " ", "a2", " ", 
   SuperscriptBox["t", "2"]}], "+", 
  RowBox[{"3", " ", "a3", " ", 
   SuperscriptBox["t", "2"]}], "+", 
  RowBox[{"2", " ", "a1", " ", "a2", " ", 
   SuperscriptBox["t", "3"]}], "+", 
  RowBox[{"2", " ", "a0", " ", "a3", " ", 
   SuperscriptBox["t", "3"]}], "+", 
  RowBox[{
   SuperscriptBox["a2", "2"], " ", 
   SuperscriptBox["t", "4"]}], "+", 
  RowBox[{"2", " ", "a1", " ", "a3", " ", 
   SuperscriptBox["t", "4"]}], "+", 
  RowBox[{"2", " ", "a2", " ", "a3", " ", 
   SuperscriptBox["t", "5"]}], "+", 
  RowBox[{
   SuperscriptBox["a3", "2"], " ", 
   SuperscriptBox["t", "6"]}]}]], "Output",
 CellChangeTimes->{3.8879171381517763`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
    "\:5e38\:6570\:9879", " ", 
     "\:7531\:8fb9\:754c\:6761\:4ef6\:53ef\:77e5a0"}], "=", "0"}], "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"a0", "=", "0"}], "\[IndentingNewLine]", 
   RowBox[{"Coeff0", "=", 
    RowBox[{
     RowBox[{"-", "1"}], "+", 
     SuperscriptBox["a0", "2"], "+", "a1"}]}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{{3.8879172832241898`*^9, 3.8879173670465775`*^9}, {
  3.8879174106756973`*^9, 3.887917414451993*^9}}],

Cell[BoxData["0"], "Output",
 CellChangeTimes->{{3.887917369523075*^9, 3.887917376936103*^9}, 
   3.8879174158446712`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", "1"}], "+", "a1"}]], "Output",
 CellChangeTimes->{{3.887917369523075*^9, 3.887917376936103*^9}, 
   3.8879174158446712`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"Coeff0", "\[Equal]", "0"}], ",", "a1"}], "]"}]], "Input",
 CellChangeTimes->{{3.887917369523075*^9, 3.887917398290406*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{"a1", "\[Rule]", "1"}], "}"}], "}"}]], "Output",
 CellChangeTimes->{{3.8879173930173516`*^9, 3.8879174184361963`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coeff1", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", "t"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.8879172141983013`*^9, 3.887917247853876*^9}, {
  3.887917491583814*^9, 3.8879174934345255`*^9}}],

Cell[BoxData[
 RowBox[{"2", " ", "a2"}]], "Output",
 CellChangeTimes->{
  3.887917248629033*^9, 3.8879174250210915`*^9, {3.887917466369867*^9, 
   3.887917495186999*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"Coeff1", "\[Equal]", "0"}], ",", "a2"}], "]"}]], "Input",
 CellChangeTimes->{{3.8879175077510943`*^9, 3.8879175097726502`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{"a2", "\[Rule]", "0"}], "}"}], "}"}]], "Output",
 CellChangeTimes->{3.8879175102738934`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coeff2", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", 
    RowBox[{"t", "^", "2"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.8879175218231554`*^9, 3.887917529671337*^9}}],

Cell[BoxData[
 RowBox[{
  SuperscriptBox["a1", "2"], "+", 
  RowBox[{"3", " ", "a3"}]}]], "Output",
 CellChangeTimes->{3.8879175302181854`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"Coeff2", "\[Equal]", "0"}], ",", "a3"}], "]"}]], "Input",
 CellChangeTimes->{{3.8879175444608164`*^9, 3.887917547282689*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{"a3", "\[Rule]", 
    RowBox[{"-", 
     FractionBox[
      SuperscriptBox["a1", "2"], "3"]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{3.887917547972303*^9}]
}, Open  ]],

Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
   RowBox[{"V", "[", "t", "]"}], "=", 
   RowBox[{"1", "-", 
    RowBox[{
     RowBox[{"1", "/", "3"}], "*", 
     RowBox[{"t", "^", "3"}]}]}]}], "*)"}]], "Input",
 CellChangeTimes->{{3.887917567462616*^9, 3.887917594105048*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", "\:6444\:52a8\:65b9\:6cd5\:6c42\:89e32", "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"\:63a7\:5236\:65b9\:7a0b", " ", 
         RowBox[{"V", "'"}], 
         RowBox[{"(", "t", ")"}]}], "+", 
        RowBox[{"V", 
         RowBox[{
          RowBox[{"(", "t", ")"}], "^", "2"}]}]}], "=", "1"}], ",", " ", 
      RowBox[{"t", "\[GreaterEqual]", "0"}], ",", " ", "V90"}], ")"}], "=", 
    "0"}], "*)"}], "\[IndentingNewLine]", 
  RowBox[{"(*", "\:5f15\:5165\:5c0f\:53c2\:6570epsilon", "*)"}], 
  "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"\:4ee4V", "[", "t", "]"}], "=", 
      RowBox[{"epsilon", "*", 
       RowBox[{"U", "[", "x", "]"}]}]}], ",", " ", 
     RowBox[{"x", "=", 
      RowBox[{
       RowBox[{"epsilon", "^", 
        RowBox[{"(", 
         RowBox[{"1", "/", "2"}], ")"}]}], "*", "t"}]}]}], ")"}]}]}]], "Input",
 CellChangeTimes->{
  3.887917656104933*^9, {3.887917688130855*^9, 3.8879177797678537`*^9}},
 EmphasizeSyntaxErrors->True],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"V", "[", "t_", "]"}], "=", 
  RowBox[{
   RowBox[{"epsilon", "^", 
    RowBox[{"(", 
     RowBox[{"1", "/", "2"}], ")"}]}], "*", 
   RowBox[{"U", "[", "x", "]"}]}]}], "\[IndentingNewLine]", 
 RowBox[{"x", "=", 
  RowBox[{
   RowBox[{"epsilon", "^", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"-", "1"}], "/", "2"}], ")"}]}], "t"}]}]}], "Input",
 CellChangeTimes->{{3.887917784157449*^9, 3.887917822189766*^9}, {
  3.8879178730351996`*^9, 3.8879178765310893`*^9}, {3.88791790739555*^9, 
  3.8879179497046103`*^9}, {3.887918002438507*^9, 3.8879180396031637`*^9}}],

Cell[BoxData[
 RowBox[{
  SqrtBox["epsilon"], " ", 
  RowBox[{"U", "[", "x", "]"}]}]], "Output",
 CellChangeTimes->{{3.887917823451836*^9, 3.8879178398093147`*^9}, {
  3.8879178784141836`*^9, 3.8879179571279163`*^9}, {3.8879180190582128`*^9, 
  3.887918048739741*^9}}],

Cell[BoxData[
 FractionBox["t", 
  SqrtBox["epsilon"]]], "Output",
 CellChangeTimes->{{3.887917823451836*^9, 3.8879178398093147`*^9}, {
  3.8879178784141836`*^9, 3.8879179571279163`*^9}, {3.8879180190582128`*^9, 
  3.887918048739741*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"D", "[", 
  RowBox[{
   RowBox[{"V", "[", "t", "]"}], ",", "t"}], "]"}]], "Input",
 CellChangeTimes->{{3.887917826117035*^9, 3.8879178271823874`*^9}, {
  3.8879178895099277`*^9, 3.887917895876108*^9}, {3.8879179633987703`*^9, 
  3.887917997718776*^9}}],

Cell[BoxData[
 RowBox[{
  SuperscriptBox["U", "\[Prime]",
   MultilineFunction->None], "[", 
  FractionBox["t", 
   SqrtBox["epsilon"]], "]"}]], "Output",
 CellChangeTimes->{
  3.88791799875134*^9, {3.8879180289922643`*^9, 3.8879180515044293`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"eq1", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"D", "[", 
     RowBox[{
      RowBox[{"V", "[", "t", "]"}], ",", "t"}], "]"}], "+", 
    RowBox[{
     RowBox[{"V", "[", "t", "]"}], "^", "2"}], "-", "1"}], "/.", 
   RowBox[{"{", 
    RowBox[{"t", "\[Rule]", 
     RowBox[{
      SqrtBox["epsilon"], "*", "z"}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.887918102013444*^9, 3.8879181393857503`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", "1"}], "+", 
  RowBox[{"epsilon", " ", 
   SuperscriptBox[
    RowBox[{"U", "[", "z", "]"}], "2"]}], "+", 
  RowBox[{
   SuperscriptBox["U", "\[Prime]",
    MultilineFunction->None], "[", "z", "]"}]}]], "Output",
 CellChangeTimes->{{3.8879180858684816`*^9, 3.8879181402786274`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{"S", "[", "z_", "]"}], "=", 
    RowBox[{
     RowBox[{"S0", "[", "z", "]"}], "+", 
     RowBox[{"epsilon", "*", 
      RowBox[{"S1", "[", "z", "]"}]}], "+", 
     RowBox[{
      RowBox[{"epsilon", "^", "2"}], "*", 
      RowBox[{"S2", "[", "z", "]"}]}], "+", 
     RowBox[{
      RowBox[{"epsilon", "^", "3"}], "*", 
      RowBox[{"S3", "[", "z", "]"}]}]}]}], "\[IndentingNewLine]", 
   RowBox[{"eq2", "=", 
    RowBox[{
     RowBox[{
      RowBox[{"-", "1"}], "+", 
      RowBox[{"epsilon", " ", 
       SuperscriptBox[
        RowBox[{"S", "[", "z", "]"}], "2"]}], "+", 
      RowBox[{
       SuperscriptBox["S", "\[Prime]",
        MultilineFunction->None], "[", "z", "]"}]}], "//", "Expand"}]}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{
  3.8879180752157707`*^9, {3.887918152453635*^9, 3.88791826972195*^9}, {
   3.8879183076698284`*^9, 3.8879183376548724`*^9}, {3.8879184063155804`*^9, 
   3.8879184078366446`*^9}, {3.8879184482696447`*^9, 3.887918450484495*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"S0", "[", "z", "]"}], "+", 
  RowBox[{"epsilon", " ", 
   RowBox[{"S1", "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{"S2", "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"S3", "[", "z", "]"}]}]}]], "Output",
 CellChangeTimes->{{3.887918246181563*^9, 3.887918308436737*^9}, 
   3.8879183401643686`*^9, 3.8879184085896053`*^9, {3.887918439442527*^9, 
   3.8879184515195303`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", "1"}], "+", 
  RowBox[{"epsilon", " ", 
   SuperscriptBox[
    RowBox[{"S0", "[", "z", "]"}], "2"]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{"S0", "[", "z", "]"}], " ", 
   RowBox[{"S1", "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   SuperscriptBox[
    RowBox[{"S1", "[", "z", "]"}], "2"]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"S0", "[", "z", "]"}], " ", 
   RowBox[{"S2", "[", "z", "]"}]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "4"], " ", 
   RowBox[{"S1", "[", "z", "]"}], " ", 
   RowBox[{"S2", "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "5"], " ", 
   SuperscriptBox[
    RowBox[{"S2", "[", "z", "]"}], "2"]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "4"], " ", 
   RowBox[{"S0", "[", "z", "]"}], " ", 
   RowBox[{"S3", "[", "z", "]"}]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "5"], " ", 
   RowBox[{"S1", "[", "z", "]"}], " ", 
   RowBox[{"S3", "[", "z", "]"}]}], "+", 
  RowBox[{"2", " ", 
   SuperscriptBox["epsilon", "6"], " ", 
   RowBox[{"S2", "[", "z", "]"}], " ", 
   RowBox[{"S3", "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "7"], " ", 
   SuperscriptBox[
    RowBox[{"S3", "[", "z", "]"}], "2"]}], "+", 
  RowBox[{
   SuperscriptBox["S0", "\[Prime]",
    MultilineFunction->None], "[", "z", "]"}], "+", 
  RowBox[{"epsilon", " ", 
   RowBox[{
    SuperscriptBox["S1", "\[Prime]",
     MultilineFunction->None], "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{
    SuperscriptBox["S2", "\[Prime]",
     MultilineFunction->None], "[", "z", "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{
    SuperscriptBox["S3", "\[Prime]",
     MultilineFunction->None], "[", "z", "]"}]}]}]], "Output",
 CellChangeTimes->{{3.887918246181563*^9, 3.887918308436737*^9}, 
   3.8879183401643686`*^9, 3.8879184085896053`*^9, {3.887918439442527*^9, 
   3.8879184515195303`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.8879183452150445`*^9, 3.887918349065816*^9}, 
   3.8879184314865537`*^9}],

Cell[BoxData["0"], "Output",
 CellChangeTimes->{3.887918354858339*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"D", "[", 
      RowBox[{
       RowBox[{"S0", "[", "z", "]"}], ",", "z"}], "]"}], "-", "1"}], 
    "\[Equal]", "0"}], ",", 
   RowBox[{"S0", "[", "z", "]"}], ",", "z"}], "]"}]], "Input",
 CellChangeTimes->{{3.8879185187681303`*^9, 3.8879185731612296`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"S0", "[", "z", "]"}], "\[Rule]", 
    RowBox[{"z", "+", 
     RowBox[{"C", "[", "1", "]"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{{3.8879185416833997`*^9, 3.8879185737799397`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
    "\:6839\:636e\:521d\:59cb\:6761\:4ef6\:53ef\:5f97C", "[", "1", "]"}], "=",
     "0"}], "*)"}], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"S0", "[", "z", "]"}], "=", "z"}]}]], "Input",
 CellChangeTimes->{{3.88791858989254*^9, 3.8879186636050887`*^9}}],

Cell[BoxData["z"], "Output",
 CellChangeTimes->{{3.887918652013639*^9, 3.8879186666777678`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coff1", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", "epsilon"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.887918357822389*^9, 3.887918391530941*^9}, {
  3.887918688272585*^9, 3.887918695957211*^9}}],

Cell[BoxData[
 RowBox[{
  SuperscriptBox["z", "2"], "+", 
  RowBox[{
   SuperscriptBox["S1", "\[Prime]",
    MultilineFunction->None], "[", "z", "]"}]}]], "Output",
 CellChangeTimes->{{3.8879183756603427`*^9, 3.8879183920949135`*^9}, 
   3.887918426640916*^9, 3.8879184805924654`*^9, {3.887918673436167*^9, 
   3.887918696805401*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"Coff1", "\[Equal]", "0"}], ",", 
   RowBox[{"S1", "[", "z", "]"}], ",", "z"}], "]"}]], "Input",
 CellChangeTimes->{{3.8879187053455906`*^9, 3.887918711846423*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"S1", "[", "z", "]"}], "\[Rule]", 
    RowBox[{
     RowBox[{"-", 
      FractionBox[
       SuperscriptBox["z", "3"], "3"]}], "+", 
     RowBox[{"C", "[", "1", "]"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{3.887918712708305*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"S1", "[", "z_", "]"}], "=", 
  RowBox[{"-", 
   FractionBox[
    SuperscriptBox["z", "3"], "3"]}]}], "\[IndentingNewLine]", 
 RowBox[{"Coff2", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", 
    RowBox[{"epsilon", "^", "2"}]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.8879187664346857`*^9, 3.8879187945222635`*^9}}],

Cell[BoxData[
 RowBox[{"-", 
  FractionBox[
   SuperscriptBox["z", "3"], "3"]}]], "Output",
 CellChangeTimes->{{3.8879187715485525`*^9, 3.8879187959491386`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", 
   FractionBox[
    RowBox[{"2", " ", 
     SuperscriptBox["z", "4"]}], "3"]}], "+", 
  RowBox[{
   SuperscriptBox["S2", "\[Prime]",
    MultilineFunction->None], "[", "z", "]"}]}]], "Output",
 CellChangeTimes->{{3.8879187715485525`*^9, 3.8879187959491386`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"Coff2", "\[Equal]", "0"}], ",", 
   RowBox[{"S2", "[", "z", "]"}], ",", "z"}], "]"}]], "Input",
 CellChangeTimes->{{3.8879188020880227`*^9, 3.8879188375208454`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"S2", "[", "z", "]"}], "\[Rule]", 
    RowBox[{
     FractionBox[
      RowBox[{"2", " ", 
       SuperscriptBox["z", "5"]}], "15"], "+", 
     RowBox[{"C", "[", "1", "]"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{3.887918838242525*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"S2", "[", "z_", "]"}], "=", 
  FractionBox[
   RowBox[{"2", " ", 
    SuperscriptBox["z", "5"]}], "15"]}]], "Input",
 CellChangeTimes->{{3.887918890682149*^9, 3.8879189000570264`*^9}}],

Cell[BoxData[
 FractionBox[
  RowBox[{"2", " ", 
   SuperscriptBox["z", "5"]}], "15"]], "Output",
 CellChangeTimes->{3.887918901802555*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"S", "[", "z_", "]"}], "=", 
  RowBox[{
   RowBox[{
    RowBox[{"S0", "[", "z", "]"}], "+", 
    RowBox[{"S1", "[", "z", "]"}], "+", 
    RowBox[{"S2", "[", "z", "]"}]}], "/.", 
   RowBox[{"{", 
    RowBox[{"z", "\[Rule]", 
     RowBox[{"t", "/", 
      SqrtBox["epsilon"]}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.887918862511116*^9, 3.887918951721563*^9}}],

Cell[BoxData[
 RowBox[{
  FractionBox["t", 
   SqrtBox["epsilon"]], "-", 
  FractionBox[
   SuperscriptBox["t", "3"], 
   RowBox[{"3", " ", 
    SuperscriptBox["epsilon", 
     RowBox[{"3", "/", "2"}]]}]], "+", 
  FractionBox[
   RowBox[{"2", " ", 
    SuperscriptBox["t", "5"]}], 
   RowBox[{"15", " ", 
    SuperscriptBox["epsilon", 
     RowBox[{"5", "/", "2"}]]}]]}]], "Output",
 CellChangeTimes->{3.887918919229647*^9, 3.8879189526412644`*^9}]
}, Open  ]]
},
WindowSize->{1520, 815},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 1443, 40, 155, "Input"],
Cell[2025, 64, 493, 14, 33, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2555, 83, 150, 3, 31, "Input"],
Cell[2708, 88, 968, 27, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3713, 120, 543, 16, 92, "Input"],
Cell[4259, 138, 122, 2, 30, "Output"],
Cell[4384, 142, 163, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4584, 151, 184, 4, 31, "Input"],
Cell[4771, 157, 174, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4982, 166, 237, 5, 31, "Input"],
Cell[5222, 173, 170, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5429, 182, 188, 4, 31, "Input"],
Cell[5620, 188, 148, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5805, 197, 211, 5, 31, "Input"],
Cell[6019, 204, 143, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6199, 213, 186, 4, 31, "Input"],
Cell[6388, 219, 219, 7, 51, "Output"]
}, Open  ]],
Cell[6622, 229, 270, 8, 31, "Input"],
Cell[6895, 239, 1156, 34, 117, "Input"],
Cell[CellGroupData[{
Cell[8076, 277, 601, 16, 52, "Input"],
Cell[8680, 295, 268, 6, 38, "Output"],
Cell[8951, 303, 238, 5, 50, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[9226, 313, 276, 6, 31, "Input"],
Cell[9505, 321, 248, 7, 50, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[9790, 333, 424, 13, 40, "Input"],
Cell[10217, 348, 321, 9, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[10575, 362, 1117, 29, 132, "Input"],
Cell[11695, 393, 496, 13, 30, "Output"],
Cell[12194, 408, 2093, 61, 50, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[14324, 474, 122, 2, 31, "Input"],
Cell[14449, 478, 70, 1, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[14556, 484, 345, 10, 31, "Input"],
Cell[14904, 496, 260, 7, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[15201, 508, 324, 9, 52, "Input"],
Cell[15528, 519, 96, 1, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[15661, 525, 238, 5, 31, "Input"],
Cell[15902, 532, 334, 8, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[16273, 545, 225, 5, 31, "Input"],
Cell[16501, 552, 307, 10, 51, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[16845, 567, 366, 10, 71, "Input"],
Cell[17214, 579, 161, 4, 51, "Output"],
Cell[17378, 585, 302, 9, 51, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[17717, 599, 227, 5, 31, "Input"],
Cell[17947, 606, 313, 10, 51, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[18297, 621, 219, 6, 50, "Input"],
Cell[18519, 629, 139, 4, 51, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[18695, 638, 398, 12, 40, "Input"],
Cell[19096, 652, 448, 15, 54, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)

m20230317摄动求解方法kdv.nb

(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     25713,        883]
NotebookOptionsPosition[     23404,        797]
NotebookOutlinePosition[     23748,        812]
CellTagsIndexPosition[     23705,        809]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[
 RowBox[{
  RowBox[{"(*", "\:6444\:52a8\:65b9\:6cd5\:6c42\:89e31", "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"\:63a7\:5236\:65b9\:7a0b", " ", "ut"}], "+", 
      RowBox[{"6", "*", "u", "*", "ux"}], "+", "uxxx"}], ")"}], "=", "0"}], 
   "*)"}], "\[IndentingNewLine]", 
  RowBox[{"(*", "\:5047\:8bbeepsilon\:4e3a\:5c0f\:53c2\:6570", "*)"}], 
  "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"u", "=", 
    RowBox[{"v", "[", 
     RowBox[{"x", ",", "t"}], "]"}]}], "\[IndentingNewLine]", 
   RowBox[{"u0", "=", 
    RowBox[{"epsilon", "*", 
     RowBox[{"Cos", "[", 
      RowBox[{"k", "*", "x"}], "]"}]}]}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{"eq1", "=", 
    RowBox[{
     RowBox[{"D", "[", 
      RowBox[{"u", ",", "t"}], "]"}], "+", 
     RowBox[{"u", "*", 
      RowBox[{"D", "[", 
       RowBox[{"u", ",", "x"}], "]"}]}], "+", 
     RowBox[{"D", "[", 
      RowBox[{"u", ",", 
       RowBox[{"{", 
        RowBox[{"x", ",", "3"}], "}"}]}], "]"}]}]}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{{3.8879165881542664`*^9, 3.8879166453552375`*^9}, {
   3.887916705789909*^9, 3.887916715456401*^9}, {3.8879168387143836`*^9, 
   3.8879171249355755`*^9}, 3.887917658286487*^9, {3.88791940884858*^9, 
   3.8879194956382465`*^9}, {3.887919593682848*^9, 3.8879196694957037`*^9}, {
   3.8879201541408463`*^9, 3.8879202225297985`*^9}, {3.8879205629570556`*^9, 
   3.887920563129549*^9}, {3.8879209528895397`*^9, 3.8879209530468493`*^9}, {
   3.887921201754115*^9, 3.887921205473319*^9}}],

Cell[BoxData[
 RowBox[{"v", "[", 
  RowBox[{"x", ",", "t"}], "]"}]], "Output",
 CellChangeTimes->{{3.8879171211759424`*^9, 3.8879171259391828`*^9}, 
   3.887919478980333*^9, 3.8879201636297736`*^9, 3.8879202234872046`*^9, 
   3.8879205488364773`*^9, {3.887920836355976*^9, 3.8879208518008776`*^9}, {
   3.8879209493736105`*^9, 3.887920953908944*^9}, {3.887921199238531*^9, 
   3.8879212073985786`*^9}, 3.887921266475166*^9, 3.887922551347904*^9}],

Cell[BoxData[
 RowBox[{"epsilon", " ", 
  RowBox[{"Cos", "[", 
   RowBox[{"k", " ", "x"}], "]"}]}]], "Output",
 CellChangeTimes->{{3.8879171211759424`*^9, 3.8879171259391828`*^9}, 
   3.887919478980333*^9, 3.8879201636297736`*^9, 3.8879202234872046`*^9, 
   3.8879205488364773`*^9, {3.887920836355976*^9, 3.8879208518008776`*^9}, {
   3.8879209493736105`*^9, 3.887920953908944*^9}, {3.887921199238531*^9, 
   3.8879212073985786`*^9}, 3.887921266475166*^9, 3.8879225513510265`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   SuperscriptBox["v", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"0", ",", "1"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}], "+", 
  RowBox[{
   RowBox[{"v", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["v", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"3", ",", "0"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}]}]], "Output",
 CellChangeTimes->{{3.8879171211759424`*^9, 3.8879171259391828`*^9}, 
   3.887919478980333*^9, 3.8879201636297736`*^9, 3.8879202234872046`*^9, 
   3.8879205488364773`*^9, {3.887920836355976*^9, 3.8879208518008776`*^9}, {
   3.8879209493736105`*^9, 3.887920953908944*^9}, {3.887921199238531*^9, 
   3.8879212073985786`*^9}, 3.887921266475166*^9, 3.8879225513520374`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"v", "[", 
    RowBox[{"x_", ",", "t_"}], "]"}], "=", 
   RowBox[{
    RowBox[{"epsilon", "*", 
     RowBox[{"v1", "[", 
      RowBox[{"x", ",", "t"}], "]"}]}], "+", 
    RowBox[{
     RowBox[{"epsilon", "^", "2"}], "*", 
     RowBox[{"v2", "[", 
      RowBox[{"x", ",", "t"}], "]"}]}], "+", 
    RowBox[{
     RowBox[{"epsilon", "^", "3"}], "*", 
     RowBox[{"v3", "[", 
      RowBox[{"x", ",", "t"}], "]"}]}]}]}]}]], "Input",
 CellChangeTimes->{{3.8879202592067013`*^9, 3.8879203340898952`*^9}, {
   3.887920435631364*^9, 3.8879205117884502`*^9}, {3.8879208231652613`*^9, 
   3.8879208298529873`*^9}, {3.8879209756325665`*^9, 3.887921066519549*^9}, {
   3.887921227710687*^9, 3.8879212293261824`*^9}, 3.8879212635835695`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"epsilon", " ", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"v3", "[", 
    RowBox[{"x", ",", "t"}], "]"}]}]}]], "Output",
 CellChangeTimes->{3.8879212308949766`*^9, 3.887921267921627*^9, 
  3.8879225527762957`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.8879211640734453`*^9, 3.8879211682823176`*^9}, {
  3.8879212204987993`*^9, 3.887921226393634*^9}}],

Cell[BoxData[
 RowBox[{"Cos", "[", 
  RowBox[{"k", " ", "x"}], "]"}]], "Output",
 CellChangeTimes->{
  3.887920287971174*^9, 3.8879203367097883`*^9, 3.887920480245757*^9, {
   3.887920514746146*^9, 3.8879205381832294`*^9}, 3.8879210683082023`*^9, {
   3.8879211693926797`*^9, 3.8879211796272264`*^9}, 3.887921223850042*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"eq2", "=", 
  RowBox[{"eq1", "//", "Expand"}]}]], "Input",
 CellChangeTimes->{{3.8879171335849524`*^9, 3.887917137492957*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"epsilon", " ", 
   RowBox[{
    SuperscriptBox["v1", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"0", ",", "1"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{
    SuperscriptBox["v2", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"0", ",", "1"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{
    SuperscriptBox["v3", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"0", ",", "1"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v1", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v1", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "4"], " ", 
   RowBox[{"v3", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v1", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v2", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "4"], " ", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v2", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "5"], " ", 
   RowBox[{"v3", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v2", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "4"], " ", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v3", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "5"], " ", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v3", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "6"], " ", 
   RowBox[{"v3", "[", 
    RowBox[{"x", ",", "t"}], "]"}], " ", 
   RowBox[{
    SuperscriptBox["v3", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"1", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{"epsilon", " ", 
   RowBox[{
    SuperscriptBox["v1", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"3", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "2"], " ", 
   RowBox[{
    SuperscriptBox["v2", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"3", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{
    SuperscriptBox["v3", 
     TagBox[
      RowBox[{"(", 
       RowBox[{"3", ",", "0"}], ")"}],
      Derivative],
     MultilineFunction->None], "[", 
    RowBox[{"x", ",", "t"}], "]"}]}]}]], "Output",
 CellChangeTimes->{
  3.8879171381517763`*^9, 3.887920341288196*^9, 3.88792051740003*^9, 
   3.8879205671335454`*^9, 3.88792107412014*^9, {3.887921172409004*^9, 
   3.8879211866668773`*^9}, 3.887921238127804*^9, 3.8879212741244793`*^9, 
   3.887922554883716*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coeff1", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", "epsilon"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.8879212837539277`*^9, 3.887921295411271*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   SuperscriptBox["v1", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"0", ",", "1"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}], "+", 
  RowBox[{
   SuperscriptBox["v1", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"3", ",", "0"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}]}]], "Output",
 CellChangeTimes->{3.8879212961781154`*^9, 3.8879225566256437`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"Coeff1", "\[Equal]", "0"}], ",", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.8879205780546703`*^9, 3.8879206300613747`*^9}, {
   3.8879210833360147`*^9, 3.887921103374196*^9}, 3.8879213026549654`*^9, {
   3.8879214494680505`*^9, 3.8879214533928547`*^9}, {3.887921541054287*^9, 
   3.887921543235078*^9}}],

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{
      SuperscriptBox["v1", 
       TagBox[
        RowBox[{"(", 
         RowBox[{"0", ",", "1"}], ")"}],
        Derivative],
       MultilineFunction->None], "[", 
      RowBox[{"x", ",", "t"}], "]"}], "+", 
     RowBox[{
      SuperscriptBox["v1", 
       TagBox[
        RowBox[{"(", 
         RowBox[{"3", ",", "0"}], ")"}],
        Derivative],
       MultilineFunction->None], "[", 
      RowBox[{"x", ",", "t"}], "]"}]}], "\[Equal]", "0"}], ",", 
   RowBox[{"v1", "[", 
    RowBox[{"x", ",", "t"}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Output",
 CellChangeTimes->{
  3.8879205877186937`*^9, {3.8879206256817107`*^9, 3.8879206315812607`*^9}, {
   3.887921089040619*^9, 3.8879211042973585`*^9}, 3.887921306782612*^9, 
   3.8879214548183856`*^9, 3.887921544442231*^9, 3.8879225584325476`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"v1", "[", 
   RowBox[{"x_", ",", "t_"}], "]"}], "=", 
  RowBox[{"Cos", "[", 
   RowBox[{
    RowBox[{"A", "*", "x"}], "+", 
    RowBox[{"B", "*", "t"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.887921601179281*^9, 3.887921650995696*^9}, {
  3.887921687358317*^9, 3.8879216987199593`*^9}}],

Cell[BoxData[
 RowBox[{"Cos", "[", 
  RowBox[{
   RowBox[{"B", " ", "t"}], "+", 
   RowBox[{"A", " ", "x"}]}], "]"}]], "Output",
 CellChangeTimes->{3.8879216519652996`*^9, 3.8879216997219906`*^9, 
  3.8879225601928678`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData["Coeff1"], "Input",
 CellChangeTimes->{{3.887921654301261*^9, 3.887921659974004*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   SuperscriptBox["A", "3"], " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"B", " ", "t"}], "+", 
     RowBox[{"A", " ", "x"}]}], "]"}]}], "-", 
  RowBox[{"B", " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"B", " ", "t"}], "+", 
     RowBox[{"A", " ", "x"}]}], "]"}]}]}]], "Output",
 CellChangeTimes->{3.887921660523925*^9, 3.8879217021412306`*^9, 
  3.8879225630188704`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"v1", "[", 
   RowBox[{"x_", ",", "t_"}], "]"}], "=", 
  RowBox[{
   RowBox[{"Cos", "[", 
    RowBox[{
     RowBox[{"A", "*", "x"}], "+", 
     RowBox[{"B", "*", "t"}]}], "]"}], "/.", 
   RowBox[{"{", 
    RowBox[{"B", "\[Rule]", 
     RowBox[{"A", "^", "3"}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.8879217274239717`*^9, 3.887921734589752*^9}}],

Cell[BoxData[
 RowBox[{"Cos", "[", 
  RowBox[{
   RowBox[{
    SuperscriptBox["A", "3"], " ", "t"}], "+", 
   RowBox[{"A", " ", "x"}]}], "]"}]], "Output",
 CellChangeTimes->{3.887921735405983*^9, 3.8879225644504695`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData["Coeff1"], "Input"],

Cell[BoxData["0"], "Output",
 CellChangeTimes->{3.8879217467025905`*^9, 3.887922566212372*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coeff2", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"Coefficient", "[", 
     RowBox[{"eq2", ",", 
      RowBox[{"epsilon", "^", "2"}]}], "]"}], "//", "TrigReduce"}], "//", 
   "Expand"}]}]], "Input",
 CellChangeTimes->{{3.887921762921474*^9, 3.887921770718666*^9}, {
  3.887922525824791*^9, 3.887922533256193*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"-", 
    FractionBox["1", "2"]}], " ", "A", " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"2", " ", 
      SuperscriptBox["A", "3"], " ", "t"}], "+", 
     RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["v2", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"0", ",", "1"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}], "+", 
  RowBox[{
   SuperscriptBox["v2", 
    TagBox[
     RowBox[{"(", 
      RowBox[{"3", ",", "0"}], ")"}],
     Derivative],
    MultilineFunction->None], "[", 
   RowBox[{"x", ",", "t"}], "]"}]}]], "Output",
 CellChangeTimes->{3.8879217718989916`*^9, 3.8879225339319124`*^9, 
  3.8879225678467913`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"Coeff2", "\[Equal]", "0"}], ",", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.8879217973776693`*^9, 3.8879218000068083`*^9}}],

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"-", 
       FractionBox["1", "2"]}], " ", "A", " ", 
      RowBox[{"Sin", "[", 
       RowBox[{
        RowBox[{"2", " ", 
         SuperscriptBox["A", "3"], " ", "t"}], "+", 
        RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}], "+", 
     RowBox[{
      SuperscriptBox["v2", 
       TagBox[
        RowBox[{"(", 
         RowBox[{"0", ",", "1"}], ")"}],
        Derivative],
       MultilineFunction->None], "[", 
      RowBox[{"x", ",", "t"}], "]"}], "+", 
     RowBox[{
      SuperscriptBox["v2", 
       TagBox[
        RowBox[{"(", 
         RowBox[{"3", ",", "0"}], ")"}],
        Derivative],
       MultilineFunction->None], "[", 
      RowBox[{"x", ",", "t"}], "]"}]}], "\[Equal]", "0"}], ",", 
   RowBox[{"v2", "[", 
    RowBox[{"x", ",", "t"}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Output",
 CellChangeTimes->{3.8879218016520123`*^9, 3.887922608405772*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"v2", "[", 
   RowBox[{"x_", ",", "t_"}], "]"}], "=", 
  RowBox[{"C1", "*", 
   RowBox[{"Cos", "[", 
    RowBox[{
     RowBox[{"A1", "*", "x"}], "+", 
     RowBox[{"B1", "*", "t"}]}], "]"}]}]}]], "Input",
 CellChangeTimes->{{3.8879218574901667`*^9, 3.8879218717089367`*^9}, {
  3.887921927285992*^9, 3.8879220141608768`*^9}, {3.887922105452215*^9, 
  3.8879221251453714`*^9}, {3.8879221920097866`*^9, 3.8879222198974633`*^9}, {
  3.8879222631627655`*^9, 3.887922265433198*^9}, {3.887922619806963*^9, 
  3.8879226199793806`*^9}}],

Cell[BoxData[
 RowBox[{"C1", " ", 
  RowBox[{"Cos", "[", 
   RowBox[{
    RowBox[{"B1", " ", "t"}], "+", 
    RowBox[{"A1", " ", "x"}]}], "]"}]}]], "Output",
 CellChangeTimes->{
  3.887921872699566*^9, 3.887921932163124*^9, 3.887921972991118*^9, {
   3.88792200318513*^9, 3.887922015056056*^9}, {3.8879221065943756`*^9, 
   3.8879221272574453`*^9}, {3.8879221930441914`*^9, 3.8879222208360996`*^9}, 
   3.8879222668899837`*^9, 3.887922621343624*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Coeff2", "//", "TrigReduce"}], "//", "Expand"}]], "Input",
 CellChangeTimes->{{3.887922167540891*^9, 3.887922177741206*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"-", 
    FractionBox["1", "2"]}], " ", "A", " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"2", " ", 
      SuperscriptBox["A", "3"], " ", "t"}], "+", 
     RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}], "+", 
  RowBox[{
   SuperscriptBox["A1", "3"], " ", "C1", " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"B1", " ", "t"}], "+", 
     RowBox[{"A1", " ", "x"}]}], "]"}]}], "-", 
  RowBox[{"B1", " ", "C1", " ", 
   RowBox[{"Sin", "[", 
    RowBox[{
     RowBox[{"B1", " ", "t"}], "+", 
     RowBox[{"A1", " ", "x"}]}], "]"}]}]}]], "Output",
 CellChangeTimes->{
  3.887921889522421*^9, 3.8879219752668986`*^9, {3.8879220072446623`*^9, 
   3.8879220174619102`*^9}, {3.88792210967334*^9, 3.8879221290512705`*^9}, {
   3.887922172475323*^9, 3.88792222284204*^9}, 3.8879222695408816`*^9, 
   3.8879226242208147`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Coeff21", "=", 
  RowBox[{
   RowBox[{"Coeff2", "/.", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"B1", "\[Rule]", 
       RowBox[{"2", "*", 
        RowBox[{"A", "^", "3"}]}]}], ",", 
      RowBox[{"A1", "\[Rule]", 
       RowBox[{"2", "*", "A"}]}]}], "}"}]}], "//", "TrigReduce"}]}]], "Input",
 CellChangeTimes->{{3.887922336531439*^9, 3.887922415187524*^9}, {
  3.8879227012728786`*^9, 3.8879227182296324`*^9}}],

Cell[BoxData[
 RowBox[{
  FractionBox["1", "2"], " ", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{
     RowBox[{"-", "A"}], " ", 
     RowBox[{"Sin", "[", 
      RowBox[{
       RowBox[{"2", " ", 
        SuperscriptBox["A", "3"], " ", "t"}], "+", 
       RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}], "+", 
    RowBox[{"12", " ", 
     SuperscriptBox["A", "3"], " ", "C1", " ", 
     RowBox[{"Sin", "[", 
      RowBox[{
       RowBox[{"2", " ", 
        SuperscriptBox["A", "3"], " ", "t"}], "+", 
       RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}]}], ")"}]}]], "Output",
 CellChangeTimes->{{3.887922384922779*^9, 3.8879224159244614`*^9}, {
  3.8879227021816673`*^9, 3.8879227192325487`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"Coeff21", "\[Equal]", "0"}], ",", "C1"}], "]"}]], "Input",
 CellChangeTimes->{{3.887922721323033*^9, 3.8879227362095356`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{"C1", "\[Rule]", 
    FractionBox["1", 
     RowBox[{"12", " ", 
      SuperscriptBox["A", "2"]}]]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{3.887922736883399*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"v2", "[", 
   RowBox[{"x", ",", "t"}], "]"}], "/.", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"C1", "\[Rule]", 
     FractionBox["1", 
      RowBox[{"12", " ", 
       SuperscriptBox["A", "2"]}]]}], ",", 
    RowBox[{"B1", "\[Rule]", 
     RowBox[{"2", "*", 
      RowBox[{"A", "^", "3"}]}]}], ",", 
    RowBox[{"A1", "\[Rule]", 
     RowBox[{"2", "*", "A"}]}]}], "}"}]}]], "Input",
 CellChangeTimes->{{3.8879227870738897`*^9, 3.8879228096629763`*^9}}],

Cell[BoxData[
 FractionBox[
  RowBox[{"Cos", "[", 
   RowBox[{
    RowBox[{"2", " ", 
     SuperscriptBox["A", "3"], " ", "t"}], "+", 
    RowBox[{"2", " ", "A", " ", "x"}]}], "]"}], 
  RowBox[{"12", " ", 
   SuperscriptBox["A", "2"]}]]], "Output",
 CellChangeTimes->{{3.887922799108447*^9, 3.8879228103374047`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"v", "[", 
   RowBox[{"x", ",", "t"}], "]"}], "/.", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"C1", "\[Rule]", 
     FractionBox["1", 
      RowBox[{"12", " ", 
       SuperscriptBox["A", "2"]}]]}], ",", 
    RowBox[{"B1", "\[Rule]", 
     RowBox[{"2", "*", 
      RowBox[{"A", "^", "3"}]}]}], ",", 
    RowBox[{"A1", "\[Rule]", 
     RowBox[{"2", "*", "A"}]}]}], "}"}]}]], "Input",
 CellChangeTimes->{{3.88792282399218*^9, 3.887922859318007*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"epsilon", " ", 
   RowBox[{"Cos", "[", 
    RowBox[{
     RowBox[{
      SuperscriptBox["A", "3"], " ", "t"}], "+", 
     RowBox[{"A", " ", "x"}]}], "]"}]}], "+", 
  FractionBox[
   RowBox[{
    SuperscriptBox["epsilon", "2"], " ", 
    RowBox[{"Cos", "[", 
     RowBox[{
      RowBox[{"2", " ", 
       SuperscriptBox["A", "3"], " ", "t"}], "+", 
      RowBox[{"2", " ", "A", " ", "x"}]}], "]"}]}], 
   RowBox[{"12", " ", 
    SuperscriptBox["A", "2"]}]], "+", 
  RowBox[{
   SuperscriptBox["epsilon", "3"], " ", 
   RowBox[{"v3", "[", 
    RowBox[{"x", ",", "t"}], "]"}]}]}]], "Output",
 CellChangeTimes->{3.8879228599122477`*^9}]
}, Open  ]]
},
WindowSize->{707, 688},
WindowMargins->{{Automatic, 83}, {Automatic, 33}},
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 1621, 40, 195, "Input"],
Cell[2203, 64, 446, 7, 30, "Output"],
Cell[2652, 73, 480, 8, 30, "Output"],
Cell[3135, 83, 1082, 33, 33, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4254, 121, 797, 20, 52, "Input"],
Cell[5054, 143, 455, 14, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5546, 162, 147, 2, 31, "Input"],
Cell[5696, 166, 323, 6, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6056, 177, 150, 3, 31, "Input"],
Cell[6209, 182, 4758, 172, 163, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[11004, 359, 192, 4, 31, "Input"],
Cell[11199, 365, 498, 18, 33, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[11734, 388, 482, 11, 31, "Input"],
Cell[12219, 401, 926, 28, 38, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[13182, 434, 325, 9, 31, "Input"],
Cell[13510, 445, 223, 6, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[13770, 456, 98, 1, 31, "Input"],
Cell[13871, 459, 430, 14, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[14338, 478, 385, 12, 31, "Input"],
Cell[14726, 492, 220, 6, 33, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[14983, 503, 32, 0, 31, "Input"],
Cell[15018, 505, 94, 1, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[15149, 511, 337, 9, 31, "Input"],
Cell[15489, 522, 766, 27, 49, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[16292, 554, 302, 8, 31, "Input"],
Cell[16597, 564, 1012, 33, 49, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[17646, 602, 562, 13, 31, "Input"],
Cell[18211, 617, 449, 10, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[18697, 632, 159, 3, 31, "Input"],
Cell[18859, 637, 877, 25, 49, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[19773, 667, 441, 12, 31, "Input"],
Cell[20217, 681, 691, 20, 49, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[20945, 706, 187, 4, 31, "Input"],
Cell[21135, 712, 224, 7, 50, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[21396, 724, 486, 15, 48, "Input"],
Cell[21885, 741, 316, 9, 53, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[22238, 755, 480, 15, 48, "Input"],
Cell[22721, 772, 667, 22, 53, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)

chap2.nb

(**********************************************************************************)
(*  Mathematica Code for the illustrative problem in chapter 2 of the book:       *)
(*      BEYOND BERTURBATION - INTRODUCTION TO THE HOMOTOPY ANALYSIS METHOD        *)
(*  by Shijun LIAO, Published by Chapman & Hall/CRC, Boca Raton, 2003             *)
(**********************************************************************************)
(*  Governing equation:                                                           *)
(*                            V'(t) +V(t)*V(t) = 1,                               *)
(*                                                                                *)
(*  subject to the initial condition:                                             *)
(*                                                                                *)
(*                            V(0) = 0                                            *)
(*                                                                                *) 
(*                                                      Sept.  2005               *)
(*                                                      Shanghai Jiao Tong Uni    *)
(*                                                      by SHIjun LIAO            *)
(**********************************************************************************)
<<Calculus`Pade`;
<<Graphics`Graphics`;


(**********************************************************************************)
(*              Which base functions would you like to use ?                      *)
(*--------------------------------------------------------------------------------*)
(*  BASE = 1    corresponds to polynomial functions  (2.50)                       *)
(*  BASE = 2    corresponds to fractional functions  (2.62)                       *)
(*  BASE = 3    corresponds to exponential functions (2.70)                       *)
(*  BASE = 4    corresponds to set of base functions (2.82)                       *)
(**********************************************************************************)
BASE = 1;


(**********************************************************************************)
(*                            Define chi[m]                                       *)
(*           This module gives the definition (2.42) of chi[m]                    *)
(**********************************************************************************)
chi[m_]:=If[m<=1,0,1];


(**********************************************************************************)
(*                            Define GetR[m]                                      *)
(*              This module gives R[m] defined by (2.43)                          *)
(**********************************************************************************)
GetR[m_]:=Module[{temp,n},
temp[1] = D[v[m-1],x];
temp[2] = Sum[v[n]*v[m-1-n],{n,0,m-1}];
temp[3] = temp[1] + temp[2] + chi[m] -1;
R[m]    = temp[3]//Expand;
];


(**********************************************************************************)
(*                            Define GetRHS[m]                                    *)
(*      This module gets the whole right-hand side term of Eq. (2.39)             *)
(**********************************************************************************)
GetRHS[m_]:=Module[{},
GetR[m];
RHS[m]= Expand[hbar*R[m]*H[x]];
];


(**********************************************************************************)
(*                            Define H                                            *)
(*         This module defines the auxiliary function H[t]                        *)
(**********************************************************************************)
H[x_]:=Module[{temp},
If[BASE == 1 || BASE == 4, temp = 1];
If[BASE == 2, temp = 1/x];
If[BASE == 3, temp = Exp[-x]];
Expand[temp]
];


(**********************************************************************************)
(*                            Define GetInitial                                   *)
(*              This module defines the initial guess of V(t)                     *)
(**********************************************************************************)
GetInitial = Module[{},
If[BASE == 1, v[0] = x];
If[BASE == 2, v[0] = 1-1/x];
If[BASE == 3 || BASE == 4, v[0] = 1-Exp[-x]];
Print[" initial guess =  ",v[0]];
];


(**********************************************************************************)
(*                            Define L                                            *)
(*       This module defines the auxiliary linear operator (2.23)                 *)
(**********************************************************************************)
L[f_]:=Module[{},
If[BASE == 1, gamma[1] = 1; gamma[2] = 0];
If[BASE == 2, gamma[1] = x; gamma[2] = 1];
If[BASE == 3 || BASE == 4, gamma[1] = 1; gamma[2] = 1];
Expand[gamma[1]*D[f,x]+gamma[2]*f]
];


(**********************************************************************************)
(*                            Define Linv                                         *)
(*  This module defines the inverse of the auxiliary linear operator (2.23)       *)
(*  In other words, find solution u of the following equation:                    *)
(*                            L[u ] =  f                                          *)
(**********************************************************************************)
Linv[f_]:=Module[{temp,EQ,u,solution},
EQ       = L[u[x]]-f;
temp     = DSolve[EQ==0,u[x],x];
solution = temp[[1,1,2]]/.C[_]->0;
Expand[solution]
];


(**********************************************************************************)
(*                    the property of the inverse operator of L                   *)
(*                         Linv[f_+g_]  := Linv[f] + Linv[g]                      *)
(**********************************************************************************)
Linv[p_Plus] := Map[Linv,p];
Linv[c_*f_]  := c*Linv[f] /; FreeQ[c,x];


(**********************************************************************************)
(*                          Define GetSPECIAL                                     *)
(*           This module gives a special solution of (2.39)                       *)
(**********************************************************************************)
GetSPECIAL[m_]:=Module[{temp},
temp    = Expand[RHS[m]];
SPECIAL = Linv[temp];
];


(**********************************************************************************)
(*                          Define GetCOMMON                                      *)
(*           This module gives a commoon solution of (2.39)                       *)
(**********************************************************************************)
GetCOMMON[m_]:=Module[{temp,u,solution},
temp     = DSolve[L[u[x]]==0,u[x],x];
solution = temp[[1,1,2]];
COMMON   = SPECIAL + chi[m]*v[m-1] + solution;
];


(**********************************************************************************)
(*                          Define Getv                                           *)
(*   This module gives the solution of (2.39) and (2.40)                          *)
(**********************************************************************************)
Getv[m_]:=Module[{temp,EQ,x0,res},
If[BASE == 1 || BASE == 3 || BASE == 4, x0 = 0];
If[BASE == 2, x0 = 1];
EQ   = Expand[COMMON/.x->x0];
temp = Solve[EQ==0,C[1]];
res  = COMMON/.temp[[1,1]];
v[m] = res//Expand;
];


(**********************************************************************************)
(*                          Define HP[F,m,n]                                      *)
(*   This module gives the [m,n] homotopy-Pade approximation of the series        *)
(*                     F[k]  =  sum[f[i],{i,0,k}]                                 *)
(*   For details, please see section 2.3.7                                        *)
(**********************************************************************************)
hp[F_,m_,n_]:=Block[{i,k,dF,temp,q},
dF[0] = F[0];
For[k=1, k<=m+n, k=k+1, dF[k] = Expand[F[k] - F[k-1]] ];
temp = dF[0]+Sum[dF[i]*q^i,{i,1,m+n}];
Pade[temp,{q,0,m,n}]/.q->1
];


(**********************************************************************************)
(*                     Definition of the function (2.58)                          *)
(**********************************************************************************)
mu0[m_,n_,h_] := (-h)^n*Sum[Binomial[n-1+j,j]*(1+h)^j,{j,0, m-n}];


(**********************************************************************************)
(*                     Definition of the function (2.85)                          *)
(**********************************************************************************)
sigma0[m_,n_,k_,h_] := (mu0[m,n+k,h]+mu0[m,n+k-1,h])/2;


(**********************************************************************************)
(*                     Definition of the function (2.91)                          *) 
(**********************************************************************************)
mu[m_,n_,alpha_,h_]:=If[n>m,0,(-h)^(n-alpha)
                          *(1+Sum[(-1)^j*Binomial[alpha-n,j]*(1+h)^j,{j,1,m-n}])];


(**********************************************************************************)
(*                     Definition of the function (2.96)                          *)
(**********************************************************************************)
sigma[m_,n_,k_,alpha_,h_]:=(mu[m,n+k,alpha,h]+mu[m,n+k-1,alpha,h])/2;


(**********************************************************************************)
(*                                  Main code                                     *)
(**********************************************************************************)
ham[m0_,m1_]:=Module[{temp,k,variable},
For[k=Max[1,m0],k<=m1,k=k+1,
    Print[" k  =  ",k];
    GetRHS[k];
    GetSPECIAL[k];
    GetCOMMON[k];
    Getv[k];
    If[BASE == 1 || BASE == 3 || BASE == 4, variable = t];
    If[BASE == 2, variable = 1 + t ];
    If[k == 1, V[0] = v[0]/.x->variable];
    V[k] = Simplify[V[k-1] + v[k]/.x->variable];
    Vtt0[k]  = D[V[k],{t,2}]/.t->0//Expand;
    Vttt0[k] = D[V[k],{t,3}]/.t->0//Expand;
    If[PRN==1,
       Print[" V''(0)  = ",N[Vtt0[k],20], "    delta  =  ",N[Vtt0[k]-chi[k]*Vtt0[k-1],20]];
       Print[" V'''(0) = ",N[Vttt0[k],20],"    delta  =  ",N[Vttt0[k]-chi[k]*Vttt0[k-1],20]];
      ];
   ];
Print[" Successful !"];
];


(**********************************************************************************)
(*    Would you like to print more information to check the convergence ?         *) 
(*              1          correspondings to YES                                  *)
(*              0          correspondings to NO                                   *)       
(**********************************************************************************)
PRN  = 1;


(**********************************************************************************)
(*    Parameters definitions                                                      *)
(**********************************************************************************)
hbar      =   h;


Print[ "The main code is ham[N_start,N_end]" ];
Print[ "BASE =  ",BASE];
Print[ "Auxiliary function = ", H[x] ];
Print[ "Initial guess      = ", v[0] ];
Print[ "PRN  =  ",PRN];
Print[ "hbar =  ",hbar];


(*  Get up-to 5th-order approximation *)
ham[1,5];


(*  Get [1,1] homotopy-Pade approximation of V(t)   *)
hp[V,1,1]//Simplify;



kdv-homotopy.m

(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(*********************************************************************************************)
(* This ia a Mathematica code for Kdv equation *)
(* (1-lambda)ft+a*fttt+b*f*ft=0 *)
(*-------------------------------------------------------------------------------------------*)
(* Definition of global variables *)
(* lambda[0]=>initial guess of w0/(C0*k) *)
(* lambda[k]=>kth-order approximation of w/(C0*k) *)
(* f[0]=>initial guess of solution f *)
(* f[k]=>solution of kth-order deformation equation *)
(* F[k]=>kth-order approximation of solution *)
(* ft[k]=>D[f[k],t] *)
(* ftt[k]=>D[f[k].{t,2}] *)
(* fttt[k]=>D[f[k],{t,3}] *)
(* R[k]=>a term on the right hand side of the mth deformation equation *)
(* RHS[k]=>right hand side of the kth-order deformation equation *)
(* fSpecial=>a special solution of the kth-order deformation equation *)
(*********************************************************************************************)



(*********************************************************************************************)

(* Define GetR[k] *)
GetR[k_]:=Module[{temp,n},
temp[1]=ft[k-1];
temp[2]=Sum[lambda[n]*ft[k-1-n],{n,0,k-1}];
(*Print["lambda*f'=",temp[2]];*)
temp[3]=fttt[k-1];
(*Print["f*f'=",temp[3]];*)
temp[4]=Sum[f[n]*ft[k-1-n],{n,0,k-1}];
(*Print["fttt=",temp[4]];*)
temp[5]=TrigReduce[Expand[temp[1]]];
temp[6]=TrigReduce[Expand[temp[2]]];
temp[7]=TrigReduce[Expand[temp[3]]];
temp[8]=TrigReduce[Expand[temp[4]]];
temp[9]=temp[5]-temp[6]+a*temp[7]+b*temp[8];
R[k]=TrigReduce[Expand[temp[9]]];
(*Print["R=",R[k]];*)
];

(* Define GetRHS *)
GetRHS[k_]:=Module[{},
GetR[k];
RHS[k]=Expand[TrigReduce[hbar*R[k]]];
];

(* Define the axiliary linear operator L0 *)
L0[f_]:= Module[{},
Expand[D[f,{t,3}]+D[f,t]];
];

(* Define the inverse operator of the auxiliary linear operator L0 *)
L0inv[Sin[n_*t]]:=Cos[n*t]/(n^3-n);
L0inv[f_+g_]:=L0inv[f]+L0inv[g];
L0inv[c_*f_]:=c*L0inv[f]/;FreeQ[c,t];
L0inv[c_]:=c/;FreeQ[c,t];
L0inv[p_Plus]:=Map[L0inv,p];

(* Set initial guess of f[t] *)
Getf0:=Module[{},
f[0]=Cos[t];
];

(* Define the function chi_{k} *)
chi[k_]:=If[k<=1,0,1];

(* Define Getft *)
Getft[k_]:=Module[{},
ft[k]=Expand[D[f[k],t]];
];

(* Define Getftt *)
Getftt[k_]:=Module[{},
ftt[k]=Expand[D[f[k],{t,2}]];
];

(* Define Getfttt *)
Getfttt[k_]:=Module[{},
fttt[k]=Expand[D[f[k],{t,3}]];
];

(* Define GetfAll *)
GetfAll[k_]:=Module[{},
Getft[k];
Getftt[k];
Getfttt[k];
];

(* Define lumbda[0] *)
GetLambda0:=Module[{temp,eq},
GetfAll[0];
GetR[1];
temp[1]=Expand[R[1]];
temp[2]=TrigReduce[temp[1]];
(*Print["R[1]=",temp[2]];*)
eq=Coefficient0[temp[2],Sin[t]];
(*Print["eq=",eq];*)
temp[0]=Solve[eq==0,lambda[0]];
temp[1]=lambda[0]/.temp[0];
temp[2]=temp[1][[1]];
lambda[0]=Simplify[temp[2]];
(*Print["lambda[0]=",lambda[0]];*)
];

(* Define lambda[k] *)
GetLambda[k_]:=Module[{temp,eq},
If[k==1,Print["lambda[0] must be known"]];
If[k>1,
GetfAll[k-1];
GetRHS[k];
temp[0]=Expand[RHS[k]];
(*Print["RHS=",temp[0]];*)
temp[1]=Expand[temp[0]];
temp[2]=TrigReduce[temp[1]];
eq=Expand[Coefficient[temp[2],Sin[t]]];
(*Print["Eq=",eq];*)
temp[0]=First[lambda[k-1]/.Solve[eq==0,lambda[k-1]]];
lambda[k-1]=Simplify[temp[0]];
];
(*Print["lambda=",lambda[k-1]];*)
];

(* Define CheckRHS[k] *)
CheckRHS[k_]:=Module[{temp,C1},
temp[0]=Expand[RHS[k]];
C1=Coefficient[temp[0],Sin[t]];
temp[1]=temp[0]-C1*Sin[t];
RHS[k]=Expand[temp[1]];
temp[0]=RHS[k]/.Sin[t]->0;
RHS[k]=Expand[temp[0]];
];

(* Define GetfSpecial *)
GetfSpecial[k_]:=Module[{temp},
temp[0]=Expand[RHS[k]];
fSpecial=L0inv[temp[0]];
(*Print["fSpecial=",fSpecial];*)
];

(* Define Getf *)
(*Getf[k_]:=Module[{eq,temp,n,C2},*)
(*temp[0]=fSpecial+C2*Cos[t];*)
(*eq[1]=temp[0]/.t->0;*)
(*eq[2]=temp[0]/.t->Pi;*)
(*eq[3]=Expand[eq[1]];*)
(*eq[4]=Expand[eq[2]];*)
(*temp[1]=First[C2/.Solve[eq[3]-eq[4]==0,C2]];*)
(*C2=Expand[temp[1]];*)
(*Print["C2=",C2];*)
(*temp[2]=Expand[fSpecial+C2*Cos[t]];*)
(*f[k]=temp[2]+chi[k]*f[k-1];*)
(*Print["f=",f[k]];*)
(*];*)


(* Define Getf *)
Getf[k_]:=Module[{eq,temp,n,C2},
temp[0]=fSpecial;
temp[1]=fSpecial+chi[k]*f[k-1];
eq[1]=temp[1]/.t->0;
eq[2]=temp[1]/.t->Pi;
(*eq[3]=Expand[eq[1]];*)
(*eq[4]=Expand[eq[2]];*)
(*temp[1]=First[C2/.Solve[eq[3]-eq[4]==0,C2]];*)
C2=(eq[2]-eq[1])/2;
(*Print["C2=",C2];*)
f[k]=Expand[temp[1]+C2*Cos[t]];
(*f[k]=temp[2]+chi[k]*f[k-1];*)
(*Print["f=",f[k]];*)
];



(* Define GetFig *)
GetFig[m0_,m1_]:=Module[{k,temp},
For[k=m0,k<=m1,k=k+1,
temp[1]=lambda[k-1];
temp[2]=Sqrt[a*6];
fig[k]=Show[exact,ParametricPlot[{temp[1],temp[2]},{}]];
];
];

(* Main Code *)
main[m0_,m1_]:=Module[{temp,k,n},
For[k=Max[1,m0],k<=m1,k=k+1,
    Print["k=",k];
    GetfAll[k-1];
    GetRHS[k];
    GetLambda[k];
    CheckRHS[k];
    GetfSpecial[k];
    Getf[k];

    LAMBDA[k-1]=Expand[Sum[lambda[n],{n,0,k-1}]];
    Print["LAMBDA=",LAMBDA[k-1]//N];    
    F[k]=F[k-1]+f[k];
   (* Print["F=",F[k]];*)

    delta1[k-1]=LAMBDA[k-1]-LAMBDA[k-2];
   Print["delta1=",delta1[k-1]//N];

    delta2[k]=F[k]-F[k-1]/.t->0;
   Print["delta2=",delta2[k]//N];
];
(*k=k-1;*)

f1=F[k]/.t->0;
f2=F[k]/.t->Pi;
(*Print["f1=",f1];*)
(*Print["f2=",f2];*)
h=f1-f2;
(*F[k]=F[k]-h;*)
Print["h=",h];


(*makeplotfile["E:\wave_kdv\Result1\F_30_8.dat",F[k],t,0,10,10,0,0];*)
(*makeplotfile["E:\wave_kdv\Result1\LAMBDA_30_3.dat",LAMBDA[k-1],c,0,1.5,100,0,0];*)
(*makeplotfile["E:\wave_kdv\Result1\LAMBDAb_30_3.dat",LAMBDA[k-1],d,0,0.7,100,0,0];*)
(*F[k]>>"E:\wave_kdv\Result\F_30_10.nb";*)
(*LAMBDA[k-1]>>"E:\My Research\Result_2\LAMBDA_20.nb"*) 

cpu[];  

Print["Successful !"];
];

   
(* set the initial guess *)
hbar=-1;
Getf0;
F[0]=f[0];
(*Z[0]=lambda[0];*)
lambda[0]=1-a;
(*c=kH,a=gamma;d=A/H;b=3A/2H*)
c=1;
d=3/10;
a=c^2/6;
b=(3/2)*d;

Print["kH=",c];
Print["A/H=",d];
$RecursionLimit=40000;




初始解的选取.nb

(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[      7989,        265]
NotebookOptionsPosition[      6910,        223]
NotebookOutlinePosition[      7315,        240]
CellTagsIndexPosition[      7272,        237]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
     RowBox[{"\:9009\:62e9\:521d\:59cb\:89e3u", "[", "0", "]"}], "=", "0"}], 
    ";", 
    RowBox[{
     RowBox[{"\:9690\:542b\:8fb9\:754c\:6761\:4ef6u", 
      RowBox[{"(", "Infinity", ")"}]}], "=", "1"}]}], "*)"}], 
  "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"u1", "[", "t_", "]"}], "=", 
     RowBox[{"c0", "+", 
      RowBox[{"c1", "*", 
       RowBox[{"Exp", "[", 
        RowBox[{
         RowBox[{"-", "lambda"}], "*", "t"}], "]"}]}]}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"u2", "[", "t_", "]"}], "=", 
     RowBox[{"c0", "+", 
      RowBox[{"c2", "*", 
       RowBox[{"Exp", "[", 
        RowBox[{
         RowBox[{"-", "2"}], "*", "lambda", "*", "t"}], "]"}]}]}]}], ";"}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{{3.8886108595718317`*^9, 3.888610934979669*^9}, {
  3.888611106698922*^9, 3.8886111277128797`*^9}, {3.888611209253703*^9, 
  3.8886112383355026`*^9}, {3.888611424484345*^9, 3.888611470408289*^9}, {
  3.8886115338856363`*^9, 3.888611536899101*^9}}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{"BCini1", "=", 
  RowBox[{"u1", "[", "0", "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"BCini2", "=", 
  RowBox[{"u2", "[", "0", "]"}]}]}], "Input",
 CellChangeTimes->{{3.8886109551000614`*^9, 3.8886109564945664`*^9}, {
  3.888653500091282*^9, 3.8886535083973575`*^9}, {3.8886535537670417`*^9, 
  3.8886535827298975`*^9}}],

Cell[BoxData[
 RowBox[{"c0", "+", "c1"}]], "Output",
 CellChangeTimes->{3.8886535090702877`*^9, 3.8886535834811916`*^9}],

Cell[BoxData[
 RowBox[{"c0", "+", "c2"}]], "Output",
 CellChangeTimes->{3.8886535090702877`*^9, 3.8886535834811916`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.8886114783664436`*^9, 3.8886114865825467`*^9}, 
   3.888653504042562*^9}],

Cell[BoxData[
 RowBox[{"c0", "+", "c2"}]], "Output",
 CellChangeTimes->{
  3.8886109572116127`*^9, {3.8886114829473567`*^9, 3.888611487026244*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{"BCInfty1", "=", 
  RowBox[{"Limit", "[", 
   RowBox[{
    RowBox[{"u1", "[", "t", "]"}], ",", 
    RowBox[{"t", "->", "Infinity"}], ",", 
    RowBox[{"Assumptions", " ", "->", 
     RowBox[{"lambda", ">", "0"}]}]}], "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"BCInfty2", "=", 
  RowBox[{"Limit", "[", 
   RowBox[{
    RowBox[{"u2", "[", "t", "]"}], ",", 
    RowBox[{"t", "->", "Infinity"}], ",", 
    RowBox[{"Assumptions", " ", "->", 
     RowBox[{"lambda", ">", "0"}]}]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.888610965979005*^9, 3.888611003244742*^9}, {
  3.8886111346817265`*^9, 3.888611151197734*^9}, {3.8886115019014626`*^9, 
  3.8886115056355853`*^9}, {3.8886115416978188`*^9, 3.8886115435419817`*^9}, {
  3.88865352495428*^9, 3.8886535438406677`*^9}, {3.8886537178275433`*^9, 
  3.8886537184052744`*^9}}],

Cell[BoxData["c0"], "Output",
 CellChangeTimes->{{3.888610980868559*^9, 3.888611004083729*^9}, 
   3.888611037776342*^9, {3.8886110945772314`*^9, 3.888611152385974*^9}, 
   3.888611506354329*^9, 3.888611544197648*^9, 3.8886535199480133`*^9, {
   3.888653670660355*^9, 3.8886537280701604`*^9}}],

Cell[BoxData["c0"], "Output",
 CellChangeTimes->{{3.888610980868559*^9, 3.888611004083729*^9}, 
   3.888611037776342*^9, {3.8886110945772314`*^9, 3.888611152385974*^9}, 
   3.888611506354329*^9, 3.888611544197648*^9, 3.8886535199480133`*^9, {
   3.888653670660355*^9, 3.8886537280701604`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"BCini1", "==", "0"}], "&&", " ", 
     RowBox[{"BCInfty1", "\[Equal]", "1"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"c0", ",", "c1"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.888653589441354*^9, 3.888653656337488*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"c0", "\[Rule]", "1"}], ",", 
    RowBox[{"c1", "\[Rule]", 
     RowBox[{"-", "1"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{{3.8886536574318304`*^9, 3.8886536728545723`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"BCini2", "==", "0"}], "&&", " ", 
     RowBox[{"BCInfty2", "\[Equal]", "1"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"c0", ",", "c2"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.888653691167903*^9, 3.8886536940657988`*^9}, {
  3.888653750534522*^9, 3.8886537509580555`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"c0", "\[Rule]", "1"}], ",", 
    RowBox[{"c2", "\[Rule]", 
     RowBox[{"-", "1"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{{3.888653694961228*^9, 3.888653753042244*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"u", "[", "t_", "]"}], "=", 
  RowBox[{
   RowBox[{"u1", "[", "t", "]"}], "+", 
   RowBox[{"epsilon", "*", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"u1", "[", "t", "]"}], "-", 
      RowBox[{"u2", "[", "t", "]"}]}], ")"}]}]}]}]], "Input",
 CellChangeTimes->{{3.8886115189011374`*^9, 3.8886115740103483`*^9}}],

Cell[BoxData[
 RowBox[{"c0", "+", 
  RowBox[{"c1", " ", 
   SuperscriptBox["\[ExponentialE]", 
    RowBox[{
     RowBox[{"-", "lambda"}], " ", "t"}]]}], "+", 
  RowBox[{
   RowBox[{"(", 
    RowBox[{
     RowBox[{
      RowBox[{"-", "c2"}], " ", 
      SuperscriptBox["\[ExponentialE]", 
       RowBox[{
        RowBox[{"-", "2"}], " ", "lambda", " ", "t"}]]}], "+", 
     RowBox[{"c1", " ", 
      SuperscriptBox["\[ExponentialE]", 
       RowBox[{
        RowBox[{"-", "lambda"}], " ", "t"}]]}]}], ")"}], " ", 
   "epsilon"}]}]], "Output",
 CellChangeTimes->{3.888611576135717*^9, 3.888653759582259*^9}]
}, Open  ]],

Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
   RowBox[{
    RowBox[{"\:9009\:62e9\:6ee1\:8db3\:8fb9\:754c\:6761\:4ef6u", 
     RowBox[{"(", "0", ")"}]}], "=", "0"}], ";", " ", 
   RowBox[{
    RowBox[{
     RowBox[{"u", "'"}], 
     RowBox[{"(", "0", ")"}]}], "=", "0"}], ";", " ", 
   RowBox[{
    RowBox[{
     RowBox[{"u", "'"}], 
     RowBox[{"(", "Infinity", ")"}]}], "=", 
    RowBox[{"1", "\:7684\:521d\:59cb\:89e3"}]}]}], "*)"}]], "Input",
 CellChangeTimes->{{3.8886537787227325`*^9, 3.8886538625798874`*^9}}]
},
WindowSize->{1520, 815},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
PrintingCopies->1,
PrintingPageRange->{Automatic, Automatic},
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 1150, 33, 112, "Input"],
Cell[CellGroupData[{
Cell[1732, 57, 343, 7, 52, "Input"],
Cell[2078, 66, 120, 2, 30, "Output"],
Cell[2201, 70, 120, 2, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2358, 77, 122, 2, 31, "Input"],
Cell[2483, 81, 147, 3, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2667, 89, 842, 19, 52, "Input"],
Cell[3512, 110, 293, 4, 30, "Output"],
Cell[3808, 116, 293, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4138, 125, 325, 9, 31, "Input"],
Cell[4466, 136, 252, 7, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4755, 148, 378, 10, 31, "Input"],
Cell[5136, 160, 248, 7, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5421, 172, 348, 10, 31, "Input"],
Cell[5772, 184, 605, 19, 33, "Output"]
}, Open  ]],
Cell[6392, 206, 514, 15, 31, "Input"]
}
]
*)

(* End of internal cache information *)

线性算子的选取-小练习1.nb

(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     12320,        389]
NotebookOptionsPosition[     11049,        341]
NotebookOutlinePosition[     11454,        358]
CellTagsIndexPosition[     11411,        355]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
   RowBox[{"\:9009\:62e9\:7ebf\:6027\:7b97\:5b50", "\:ff0c", 
    RowBox[{
    "\:5982\:4f55\:9009\:53d6\:7ebf\:6027\:7b97\:5b50\:5305\:62ecC0", "+", 
     RowBox[{"C1", "*", 
      RowBox[{"Exp", "[", 
       RowBox[{
        RowBox[{"-", "lambda"}], "*", "t"}], "]"}]}], "+", 
     RowBox[{"C2", "*", 
      RowBox[{"Exp", "[", 
       RowBox[{
        RowBox[{"-", "2"}], "*", "lambda", "*", "t"}], "]"}]}]}]}], 
   ")"}]}]], "Input",
 CellChangeTimes->{{3.888610023566291*^9, 3.888610063744712*^9}, {
  3.88865239063124*^9, 3.8886524628218174`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"eq1", "=", 
   RowBox[{
    RowBox[{"c3", "*", 
     RowBox[{
      RowBox[{"f", "'''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c2", "*", 
     RowBox[{
      RowBox[{"f", "''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c1", "*", 
     RowBox[{
      RowBox[{"f", "'"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c0", "*", 
     RowBox[{"f", "[", "t", "]"}]}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"eq2", "=", 
   RowBox[{
    RowBox[{"c3", "*", 
     RowBox[{
      RowBox[{"g", "'''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c2", "*", 
     RowBox[{
      RowBox[{"g", "''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c1", "*", 
     RowBox[{
      RowBox[{"g", "'"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c0", "*", 
     RowBox[{"g", "[", "t", "]"}]}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"eq3", "=", 
   RowBox[{
    RowBox[{"c3", "*", 
     RowBox[{
      RowBox[{"s", "'''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c2", "*", 
     RowBox[{
      RowBox[{"s", "''"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c1", "*", 
     RowBox[{
      RowBox[{"s", "'"}], "[", "t", "]"}]}], "+", 
    RowBox[{"c0", "*", 
     RowBox[{"s", "[", "t", "]"}]}]}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.888610071308409*^9, 3.8886101167479486`*^9}, {
  3.8886101883551044`*^9, 3.8886102105922594`*^9}, {3.888610448495055*^9, 
  3.8886104797883587`*^9}, {3.8886105203698797`*^9, 3.8886105364491434`*^9}, {
  3.8886396197097797`*^9, 3.8886396286028757`*^9}, {3.8886396652334185`*^9, 
  3.8886396677489667`*^9}}],

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.888610514596793*^9, 3.8886105280249333`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"f", "[", "t_", "]"}], "=", 
  RowBox[{"Exp", "[", 
   RowBox[{
    RowBox[{"-", "lambda"}], "*", "t"}], "]"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"g", "[", "t_", "]"}], "=", 
  RowBox[{"Exp", "[", 
   RowBox[{
    RowBox[{"-", "2"}], "*", "lambda", "*", "t"}], 
   "]"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"s", "[", "t_", "]"}], "=", "C0"}], "\[IndentingNewLine]"}], "Input",
 CellChangeTimes->{{3.8886102274930487`*^9, 3.888610285228719*^9}, {
  3.8886396320534163`*^9, 3.8886396466453795`*^9}}],

Cell[BoxData[
 SuperscriptBox["\[ExponentialE]", 
  RowBox[{
   RowBox[{"-", "lambda"}], " ", "t"}]]], "Output",
 CellChangeTimes->{
  3.8886102536824756`*^9, {3.8886103693855305`*^9, 3.888610382750493*^9}, {
   3.888610483865599*^9, 3.8886105405400324`*^9}, {3.8886396477787066`*^9, 
   3.888639674568632*^9}, 3.8886519213157964`*^9, 3.888652502191949*^9}],

Cell[BoxData[
 SuperscriptBox["\[ExponentialE]", 
  RowBox[{
   RowBox[{"-", "2"}], " ", "lambda", " ", "t"}]]], "Output",
 CellChangeTimes->{
  3.8886102536824756`*^9, {3.8886103693855305`*^9, 3.888610382750493*^9}, {
   3.888610483865599*^9, 3.8886105405400324`*^9}, {3.8886396477787066`*^9, 
   3.888639674568632*^9}, 3.8886519213157964`*^9, 3.888652502191949*^9}],

Cell[BoxData["C0"], "Output",
 CellChangeTimes->{
  3.8886102536824756`*^9, {3.8886103693855305`*^9, 3.888610382750493*^9}, {
   3.888610483865599*^9, 3.8886105405400324`*^9}, {3.8886396477787066`*^9, 
   3.888639674568632*^9}, 3.8886519213157964`*^9, 3.888652502191949*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"eq11", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq1", ",", " ", 
    SuperscriptBox["\[ExponentialE]", 
     RowBox[{
      RowBox[{"-", "lambda"}], " ", "t"}]]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.888610255129234*^9, 3.8886102556358967`*^9}, {
  3.888610342177508*^9, 3.88861036114948*^9}}],

Cell[BoxData[
 RowBox[{"c0", "-", 
  RowBox[{"c1", " ", "lambda"}], "+", 
  RowBox[{"c2", " ", 
   SuperscriptBox["lambda", "2"]}], "-", 
  RowBox[{"c3", " ", 
   SuperscriptBox["lambda", "3"]}]}]], "Output",
 CellChangeTimes->{
  3.888610256058464*^9, {3.8886103623062468`*^9, 3.888610384276697*^9}, {
   3.8886104851039705`*^9, 3.8886104948387394`*^9}, 3.8886105423930387`*^9, {
   3.888639652223256*^9, 3.888639676225166*^9}, 3.888651923423294*^9, {
   3.8886524988023667`*^9, 3.888652503706332*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"g", "[", "t_", "]"}], "=", 
   RowBox[{"Exp", "[", 
    RowBox[{
     RowBox[{"-", "2"}], "*", "lambda", "*", "t"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"eq12", "=", 
  RowBox[{"Coefficient", "[", 
   RowBox[{"eq2", ",", " ", 
    SuperscriptBox["\[ExponentialE]", 
     RowBox[{
      RowBox[{"-", "2"}], "lambda", " ", "t"}]]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.8886104035101876`*^9, 3.888610403682806*^9}, {
  3.888610554657301*^9, 3.8886105663234196`*^9}}],

Cell[BoxData[
 RowBox[{"c0", "-", 
  RowBox[{"2", " ", "c1", " ", "lambda"}], "+", 
  RowBox[{"4", " ", "c2", " ", 
   SuperscriptBox["lambda", "2"]}], "-", 
  RowBox[{"8", " ", "c3", " ", 
   SuperscriptBox["lambda", "3"]}]}]], "Output",
 CellChangeTimes->{{3.888610408376692*^9, 3.8886104108871975`*^9}, 
   3.888610568073242*^9, {3.888639654897622*^9, 3.8886396788653193`*^9}, 
   3.8886519253467073`*^9, 3.888652505028246*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData["eq3"], "Input",
 CellChangeTimes->{{3.888639685379307*^9, 3.8886396858522964`*^9}}],

Cell[BoxData[
 RowBox[{"c0", " ", "C0"}]], "Output",
 CellChangeTimes->{3.8886396863234606`*^9, 3.8886525068048925`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Solve", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"eq11", "\[Equal]", "0"}], ",", 
     RowBox[{"eq12", "\[Equal]", "0"}], ",", 
     RowBox[{"eq3", "\[Equal]", "0"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"c1", ",", "c2", ",", "c0"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.888610637995936*^9, 3.88861066278887*^9}, {
  3.8886519621728287`*^9, 3.888651984938379*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"c1", "\[Rule]", 
     RowBox[{"2", " ", "c3", " ", 
      SuperscriptBox["lambda", "2"]}]}], ",", 
    RowBox[{"c2", "\[Rule]", 
     RowBox[{"3", " ", "c3", " ", "lambda"}]}], ",", 
    RowBox[{"c0", "\[Rule]", "0"}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{
  3.8886106635743017`*^9, {3.888651978453732*^9, 3.8886519853791556`*^9}, 
   3.8886525099220247`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", "\:7ebf\:6027\:7b97\:5b50\:7684\:9a8c\:8bc1", "*)"}], 
  "\[IndentingNewLine]", 
  RowBox[{"eq4", "=", 
   RowBox[{
    RowBox[{
     RowBox[{"c3", "*", 
      RowBox[{
       RowBox[{"ss", "'''"}], "[", "t", "]"}]}], "+", 
     RowBox[{"c2", "*", 
      RowBox[{
       RowBox[{"ss", "''"}], "[", "t", "]"}]}], "+", 
     RowBox[{"c1", "*", 
      RowBox[{
       RowBox[{"ss", "'"}], "[", "t", "]"}]}], "+", 
     RowBox[{"c0", "*", 
      RowBox[{"ss", "[", "t", "]"}]}]}], "/.", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"c1", "\[Rule]", 
       RowBox[{"2", " ", "c3", " ", 
        SuperscriptBox["lambda", "2"]}]}], ",", 
      RowBox[{"c2", "\[Rule]", 
       RowBox[{"3", " ", "c3", " ", "lambda"}]}], ",", 
      RowBox[{"c0", "\[Rule]", "0"}]}], "}"}]}]}]}]], "Input",
 CellChangeTimes->{{3.888652069084038*^9, 3.888652077460681*^9}, 
   3.888652230394368*^9, 3.888652273280879*^9, {3.8886525305179205`*^9, 
   3.888652551620092*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"2", " ", "c3", " ", 
   SuperscriptBox["lambda", "2"], " ", 
   RowBox[{
    SuperscriptBox["ss", "\[Prime]",
     MultilineFunction->None], "[", "t", "]"}]}], "+", 
  RowBox[{"3", " ", "c3", " ", "lambda", " ", 
   RowBox[{
    SuperscriptBox["ss", "\[Prime]\[Prime]",
     MultilineFunction->None], "[", "t", "]"}]}], "+", 
  RowBox[{"c3", " ", 
   RowBox[{
    SuperscriptBox["ss", 
     TagBox[
      RowBox[{"(", "3", ")"}],
      Derivative],
     MultilineFunction->None], "[", "t", "]"}]}]}]], "Output",
 CellChangeTimes->{
  3.8886522312084646`*^9, {3.8886522745202084`*^9, 3.888652310265543*^9}, 
   3.888652556956444*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"eq4", "\[Equal]", "0"}], ",", 
   RowBox[{"ss", "[", "t", "]"}], ",", "t"}], "]"}]], "Input",
 CellChangeTimes->{{3.8886107538707647`*^9, 3.8886107693860435`*^9}, {
   3.8886520522434883`*^9, 3.8886520524629774`*^9}, {3.888652083024805*^9, 
   3.88865208552861*^9}, {3.8886521384120655`*^9, 3.8886522158029213`*^9}, 
   3.8886523024735546`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"ss", "[", "t", "]"}], "\[Rule]", 
    RowBox[{
     RowBox[{"-", 
      FractionBox[
       RowBox[{
        SuperscriptBox["\[ExponentialE]", 
         RowBox[{
          RowBox[{"-", "2"}], " ", "lambda", " ", "t"}]], " ", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{"C", "[", "1", "]"}], "+", 
          RowBox[{"2", " ", 
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"lambda", " ", "t"}]], " ", 
           RowBox[{"C", "[", "2", "]"}]}]}], ")"}]}], 
       RowBox[{"2", " ", "lambda"}]]}], "+", 
     RowBox[{"C", "[", "3", "]"}]}]}], "}"}], "}"}]], "Output",
 CellChangeTimes->{
  3.88861077032274*^9, 3.888652054987857*^9, {3.8886520861139884`*^9, 
   3.8886521034150286`*^9}, 3.8886521411296587`*^9, {3.888652183400833*^9, 
   3.888652237812479*^9}, {3.8886522773384457`*^9, 3.888652312247768*^9}, 
   3.8886525597036858`*^9}]
}, Open  ]],

Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
  "\:5c0f\:7ec3\:4e601", "\:ff1a", " ", 
   "\:9009\:62e9\:7ebf\:6027\:7b97\:5b50", "\:ff0c", 
   RowBox[{
   "\:5982\:4f55\:9009\:53d6\:7ebf\:6027\:7b97\:5b50\:5305\:62ecC0", "+", 
    RowBox[{"C1", "*", 
     RowBox[{"1", "/", "t"}]}], "+", 
    RowBox[{"C2", "*", 
     RowBox[{"1", "/", 
      RowBox[{"t", "^", "2"}]}]}]}]}], " ", "*)"}]], "Input",
 CellChangeTimes->{{3.888652609970996*^9, 3.888652637641102*^9}, {
  3.888652898532179*^9, 3.8886529067992563`*^9}}]
},
WindowSize->{1520, 815},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
PrintingCopies->1,
PrintingPageRange->{Automatic, Automatic},
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 594, 16, 33, "Input"],
Cell[1154, 38, 1562, 47, 72, "Input"],
Cell[2719, 87, 94, 1, 31, "Input"],
Cell[CellGroupData[{
Cell[2838, 92, 555, 15, 92, "Input"],
Cell[3396, 109, 357, 7, 30, "Output"],
Cell[3756, 118, 367, 7, 30, "Output"],
Cell[4126, 127, 274, 4, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4437, 136, 330, 8, 33, "Input"],
Cell[4770, 146, 503, 11, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5310, 162, 533, 15, 54, "Input"],
Cell[5846, 179, 430, 9, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6313, 193, 97, 1, 31, "Input"],
Cell[6413, 196, 120, 2, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6570, 203, 425, 11, 31, "Input"],
Cell[6998, 216, 438, 12, 33, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[7473, 233, 990, 28, 54, "Input"],
Cell[8466, 263, 667, 20, 30, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[9170, 288, 406, 8, 31, "Input"],
Cell[9579, 298, 940, 25, 53, "Output"]
}, Open  ]],
Cell[10534, 326, 511, 13, 31, "Input"]
}
]
*)

(* End of internal cache information *)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jmsyh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值