Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

eg1

By: a guest on Feb 25th, 2013  |  syntax: None  |  size: 3.85 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. (* Content-type: application/vnd.wolfram.mathematica *)
  2.  
  3. (*** Wolfram Notebook File ***)
  4. (* http://www.wolfram.com/nb *)
  5.  
  6. (* CreatedBy='Mathematica 8.0' *)
  7.  
  8. (*CacheID: 234*)
  9. (* Internal cache information:
  10. NotebookFileLineBreakTest
  11. NotebookFileLineBreakTest
  12. NotebookDataPosition[       157,          7]
  13. NotebookDataLength[      3638,        100]
  14. NotebookOptionsPosition[      3315,         83]
  15. NotebookOutlinePosition[      3669,         99]
  16. CellTagsIndexPosition[      3626,         96]
  17. WindowFrame->Normal*)
  18.  
  19. (* Beginning of Notebook Content *)
  20. Notebook[{
  21.  
  22. Cell[CellGroupData[{
  23. Cell["functions", "Section",
  24.  CellChangeTimes->{{3.525542878650548*^9, 3.525542880416729*^9}}],
  25.  
  26. Cell[TextData[{
  27.  StyleBox["\n   \n",
  28.   FontColor->RGBColor[0, 0, 1]],
  29.  StyleBox["Clear[getpos];\n",
  30.   FontColor->GrayLevel[0]],
  31.  StyleBox["getpos",
  32.   FontColor->RGBColor[1, 0, 0]],
  33.  "[element_String] :=\n  Module[{goodpos, val, k = Position[",
  34.  StyleBox["vars",
  35.   FontColor->RGBColor[0, 0, 1]],
  36.  ", element][[1,1]]},\n     good =  Flatten[Position[",
  37.  StyleBox["data",
  38.   FontColor->RGBColor[0, 0, 1]],
  39.  ", _?((Abs[#[[k]]] > 10^-4)&), {1}]];\n     Array[(val = ",
  40.  StyleBox["data",
  41.   FontColor->RGBColor[0, 0, 1]],
  42.  "[[",
  43.  StyleBox["good[[#]],k",
  44.   Background->RGBColor[0, 1, 0]],
  45.  "]]; If[val < 0, ",
  46.  StyleBox["data",
  47.   FontColor->RGBColor[0, 0, 1]],
  48.  "[[",
  49.  StyleBox["good[[#]],k",
  50.   Background->RGBColor[0, 1, 0]],
  51.  "]] = -val/2])&, Length[good] ];\n     {k, good}]\n     ",
  52.  StyleBox["\n",
  53.   Background->GrayLevel[0.5]],
  54.  "(* ",
  55.  StyleBox["goodpos from 'data' ",
  56.   FontColor->RGBColor[0, 0, 1]],
  57.  "*)\n\n"
  58. }], "Input",
  59.  CellChangeTimes->{{3.536807353579389*^9, 3.536807366004743*^9}, {
  60.    3.5368075257040854`*^9, 3.5368075365711107`*^9}, {3.5368075905904207`*^9,
  61.    3.536807603851081*^9}, {3.5368076695852537`*^9, 3.536807670155402*^9}, {
  62.    3.5368077084972143`*^9, 3.5368077264154882`*^9}, 3.5368078060379066`*^9, {
  63.    3.53680785859536*^9, 3.536807868419298*^9}, {3.5368081049732656`*^9,
  64.    3.536808244619398*^9}, {3.5368082756393957`*^9, 3.536808434603407*^9}, {
  65.    3.536808473526009*^9, 3.536808476628237*^9}, {3.536808538685506*^9,
  66.    3.536808542483759*^9}, {3.536808906243566*^9, 3.536808962619392*^9}, {
  67.    3.5368099502054367`*^9, 3.536810010486621*^9}, 3.536810159050418*^9, {
  68.    3.536810189133416*^9, 3.536810484355564*^9}, {3.5368108056318913`*^9,
  69.    3.536810815483436*^9}, {3.5368108563894672`*^9, 3.536810887541497*^9}, {
  70.    3.536810938937948*^9, 3.536811007746114*^9}, 3.5368120422730513`*^9, {
  71.    3.536816734635078*^9, 3.536816764495511*^9}, {3.536817205022016*^9,
  72.    3.5368172718624496`*^9}, {3.53681758429191*^9, 3.5368175845152807`*^9}, {
  73.    3.551205323937608*^9, 3.5512053516434*^9}, {3.552789865373589*^9,
  74.    3.552789884220105*^9}, {3.552859591216968*^9, 3.552859601409501*^9}, {
  75.    3.552859666075337*^9, 3.552859688200486*^9}, {3.552865291934667*^9,
  76.    3.5528652998012*^9}, {3.552865368420989*^9, 3.552865376361524*^9}, {
  77.    3.552865408982329*^9, 3.5528654116231833`*^9}, {3.552865446054214*^9,
  78.    3.552865457377349*^9}, {3.5528655097334137`*^9, 3.552865522895688*^9}, {
  79.    3.552865694133601*^9, 3.552865809620863*^9}, 3.5707790512968493`*^9, {
  80.    3.570781056632057*^9, 3.570781065779727*^9}, {3.5707839119561443`*^9,
  81.    3.57078391905689*^9}, {3.570783950408087*^9, 3.5707839820464973`*^9}}]
  82. }, Open  ]]
  83. },
  84. WindowSize->{1132, 999},
  85. WindowMargins->{{4, Automatic}, {Automatic, 4}},
  86. FrontEndVersion->"8.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (October 5, \
  87. 2011)",
  88. StyleDefinitions->"Default.nb"
  89. ]
  90. (* End of Notebook Content *)
  91.  
  92. (* Internal cache information *)
  93. (*CellTagsOutline
  94. CellTagsIndex->{}
  95. *)
  96. (*CellTagsIndex
  97. CellTagsIndex->{}
  98. *)
  99. (*NotebookFileOutline
  100. Notebook[{
  101. Cell[CellGroupData[{
  102. Cell[579, 22, 94, 1, 67, "Section"],
  103. Cell[676, 25, 2623, 55, 170, "Input"]
  104. }, Open  ]]
  105. }
  106. ]
  107. *)
  108.  
  109. (* End of internal cache information *)