1
 (************** Content-type: application/mathematica **************  CreatedBy='%s'  Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file  with a name ending in .nb, then open the file inside the  application; * Copy the data starting with the line of stars above to the  clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research:  web: http://www.wolfram.com  email: [email protected]  phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 3136, 92]*) (*NotebookOutlinePosition[ 4185, 127]*) (* CellTagsIndexPosition[ 4141, 123]*) (*WindowFrame->Normal*) Notebook[{ Cell["\<\ Module to do static condensation of last freedom of a \ superelement\ \>", "Text",  CellFrame->True,  CellMargins->{{14, 55}, {Inherited, Inherited}},  CellLabelMargins->{{10, Inherited}, {Inherited, Inherited}},  ImageRegion->{{-0, 1}, {0, 1}},  Background->RGBColor[1, 1, 0]], Cell["\<\ CondenseLastFreedom[K_,f_]:=Module[{pivot,c,Kc,fc,  n=Length[K]}, If [n<=1,Return[{K,f}]]; \tKc=Table[0,{n-1},{n-1}]; fc=Table[0,{n-1}];  pivot=K[[n,n]]; If [pivot==0, Print[\"CondenseLastFreedom:\",  \" Singular Matrix\"]; Return[{K,f}]];  For [i=1,i<=n-1,i++, c=K[[i,n]]/pivot; fc[[i]]=f[[i]]-c*f[[n]];  For [j=1,j<=i,j++,  Kc[[j,i]]=Kc[[i,j]]=K[[i,j]]-c*K[[n,j]]  ];  ];  Return[Simplify[{Kc,fc}]]  ]; ClearAll[K,f]; K={{6,-2,-1,-3},{ -2,5,-2,-1},{ -1,-2,7,-4},{-3,-1,-4,8}}; f={3,6,4,0}; Print[\"Before condensation:\",\" K=\",K//MatrixForm,\" f=\",f//MatrixForm]; {K,f}=CondenseLastFreedom[K,f];Print[\"Upon condensing DOF 4:\",  \" K=\",K//MatrixForm,\" f=\",f//MatrixForm]; {K,f}=CondenseLastFreedom[K,f];Print[\"Upon condensing DOF 3:\",  \" K=\",K//MatrixForm,\" f=\",f//MatrixForm];\ \>", "Input",  CellFrame->True,  CellMargins->{{14, 55}, {Inherited, Inherited}},  CellLabelMargins->{{10, Inherited}, {Inherited, Inherited}},  ImageRegion->{{-0, 1}, {0, 1}},  Background->RGBColor[0, 1, 0]] }, FrontEndVersion->"4.2 for Macintosh", ScreenRectangle->{{0, 1920}, {0, 1180}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 740}, WindowMargins->{{1, Automatic}, {Automatic, 1}}, PrivateNotebookOptions->{"ColorPalette"->{RGBC olor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ 00<0001804P000000]P2:? oQon82n@960dL5:0?l0080001804P000000]P2:001 0000I00000400`<300000BL?00400@0000000000000006P801T1T00000000000 00000000000000000000000000000000\>" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1743, 53, 292, 8, 70, "Text"], Cell[2038, 63, 1095, 28, 70, "Input"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)

Condense Last Freedom

Embed Size (px)

Citation preview

 

(************** Content-type: application/mathematica **************  CreatedBy='%s'  Mathematica-Compatible NotebookThis notebook can be used with any Mathematica-compatibleapplication, such as Mathematica, MathReader or Publicon. The datafor the notebook starts with the line containing stars above.To get the notebook into a Mathematica-compatible application, doone of the following:* Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application;* Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application.Data for notebooks contains only printable 7-bit ASCII and can besent directly in email or through ftp in text mode. Newlines can beCR, LF or CRLF (Unix, Macintosh or MS-DOS style).NOTE: If you modify the data for this notebook not in a Mathematica-compatible application, you must delete the line below containingthe word CacheID, otherwise Mathematica-compatible applications maytry to use invalid cache data.For more information on notebooks and Mathematica-compatibleapplications, contact Wolfram Research: web: http://www.wolfram.com email: [email protected] phone: +1-217-398-0700 (U.S.)Notebook reader applications are available free of charge fromWolfram Research.*******************************************************************)(*CacheID: 232*)(*NotebookFileLineBreakTestNotebookFileLineBreakTest*)(*NotebookOptionsPosition[ 3136, 92]*)(*NotebookOutlinePosition[ 4185, 127]*)(* CellTagsIndexPosition[ 4141, 123]*)(*WindowFrame->Normal*)Notebook[{Cell["\<\Module to do static condensation of last freedom of a \superelement\\>", "Text", CellFrame->True, CellMargins->{{14, 55}, {Inherited, Inherited}}, CellLabelMargins->{{10, Inherited}, {Inherited, Inherited}}, ImageRegion->{{-0, 1}, {0, 1}}, Background->RGBColor[1, 1, 0]],Cell["\<\CondenseLastFreedom[K_,f_]:=Module[{pivot,c,Kc,fc,  n=Length[K]}, If [n<=1,Return[{K,f}]];\tKc=Table[0,{n-1},{n-1}]; fc=Table[0,{n-1}];  pivot=K[[n,n]]; If [pivot==0, Print[\"CondenseLastFreedom:\",  \" Singular Matrix\"]; Return[{K,f}]];  For [i=1,i<=n-1,i++, c=K[[i,n]]/pivot;fc[[i]]=f[[i]]-c*f[[n]];  For [j=1,j<=i,j++,  Kc[[j,i]]=Kc[[i,j]]=K[[i,j]]-c*K[[n,j]]  ];  ];  Return[Simplify[{Kc,fc}]]  ];ClearAll[K,f];K={{6,-2,-1,-3},{ -2,5,-2,-1},{ -1,-2,7,-4},{-3,-1,-4,8}};f={3,6,4,0};Print[\"Before condensation:\",\" K=\",K//MatrixForm,\" f=\",f//MatrixForm];{K,f}=CondenseLastFreedom[K,f];Print[\"Upon condensing DOF 4:\", \" K=\",K//MatrixForm,\" f=\",f//MatrixForm];{K,f}=CondenseLastFreedom[K,f];Print[\"Upon condensing DOF 3:\", \" K=\",K//MatrixForm,\" f=\",f//MatrixForm];\\>", "Input", CellFrame->True, CellMargins->{{14, 55}, {Inherited, Inherited}}, CellLabelMargins->{{10, Inherited}, {Inherited, Inherited}}, ImageRegion->{{-0, 1}, {0, 1}}, Background->RGBColor[0, 1, 0]]},FrontEndVersion->"4.2 for Macintosh",ScreenRectangle->{{0, 1920}, {0, 1180}},WindowToolbars->{},CellGrouping->Manual,WindowSize->{520, 740},WindowMargins->{{1, Automatic}, {Automatic, 1}},PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}},ShowCellLabel->True,ShowCellTags->False,RenderingOptions->{"ObjectDithering"->True,"RasterDithering"->False},MacintoshSystemPageSetup->"\<\00<0001804P000000]P2:?oQon82n@960dL5:0?l0080001804P000000]P2:0010000I00000400`<300000BL?00400@0000000000000006P801T1T0000000000000000000000000000000000000000000\>"](*******************************************************************Cached data follows. If you edit this Notebook file directly, notusing Mathematica, you must remove the line containing CacheID atthe top of the file. The cache data will then be recreated whenyou save this file from within Mathematica.*******************************************************************)(*CellTagsOutlineCellTagsIndex->{}*)(*CellTagsIndexCellTagsIndex->{}*)(*NotebookFileOutlineNotebook[{Cell[1743, 53, 292, 8, 70, "Text"],Cell[2038, 63, 1095, 28, 70, "Input"]}]*)(*******************************************************************End of Mathematica Notebook file.*******************************************************************)