Converting a Mathematica Notebook to Batch File

Steps

  1. Group all cells in the notebook into one cell. (Note: Selection of more than about 5 cells for merging causes a General Protection Fault in Windows 95 version 3.0! Work on your notebook piece by piece.)

  2. Choose Save As Special... from the File menu, then choose Text.

  3. Now edit the text file...

  4. Remove header charaters:

    \!\(\(
    
    and trailing characters:
    \)\)
    

  5. Do a search replace for the following characters:
    Orginal CharacterReplace with
    \n
    [CARRIAGE RETURN]
    \/
    /
    \)
    )
    \(
    (
    \^
    ^
    \[SPACE]
    [SPACE]

  6. NOTE: I've run into trouble with balancing parantheses when trying to fix the following entities:
    Orginal CharacterDON'T Replace with
    ((
    (
    ))
    )
    The notebooks seem to run fine with the extra parantheses, so I recommend leaving them unaltered.

  7. Edit the file so that each formula fits on one line (no line wrapping)

  8. Save the edited file

Example Conversion

Result of Save as Special... Text

\!\(\( (*\ IPC - D - 279\ PTH\ Model\ *) \nh = 0.0015875\ \ 
   (*Meter, \ PWB\ Board\ Tickness*) ; \nd = 0.0003175\ 
   (*Meter, \ Drilled\ PTV\ diameter*) ; \nt = 0.00003048\ 
   (*Meter, \ Thickness\ of\ Copper\ deposit\ in\ Barrel*) ; \n
  Sy = 172*10\^6\ \  (*Newton/Meter\^2, \ Copper\ Yield\ Strength*) ; \n
  \[Alpha]Elow = 65*10\^\(-6\)\ 
   (*MLB\ CTE\ in\ z\ dir\ below\ Tg\ per\ deg\ C*) ; \n
  \[Alpha]Ehigh = 315*10\^\(-6\)\ 
   (*MLB\ CTE\ in\ z\ dir\ above\ Tg\ per\ deg\ C*) ; \nETg = 137\ 
   (*Tg\ for\ Epoxy, \ deg\ C*) ; \n\[Alpha]Cu = 18*10\^\(-6\)\ 
   (*Copper\ CTE\ per\ deg\ C*) ; \n\[CapitalDelta]T = 50\ 
   (*Temperature\ range\ of\ thermal\ cycling, \ deg\ C*) ; \nTref = 25\ 
   (*Reference\ Temperature - \ typically\ ambient, \ deg\ C*) ; \n
  EE = 3.5*10\^9\ \ 
   (*Newton/Meter\^2, \ Modulus\ of\ Elasticity\ of\ epoxy*) ; \n
  ECu = 35*10\^9\ \ 
   (*Newton/Meter\^2, \ 
    Modulus\ of\ Elasticity\ of\ pyrophosphate - plated\ copper*) ; \n
  ECuPrime = 0.7*10\^9\ \ 
   (*Newton/Meter\^2, \ Modulus\ of\ Plasticity\ of\ plated\ copper*) ; \n
  de = \((2*d)\) + \((h/2)\)\  (*Diameter\ of\ MLB\ dielectric\ influence*) ; 
  \nAE = \((\[Pi]/4)\)*\((de\^2 + d\^2)\)\ ; \n
  ACu = \((\[Pi]/4)\)*\((d\^2 - \((d - 2*t)\)\^2)\)\ ; \n
   (*Include\ tempreature\ dependent\ MLB\ CTE\ behavior*) \n
  \[Sigma]avglow = 
    If\ [\[CapitalDelta]T + Tref < ETg, 
      \(\((\[Alpha]Elow - \[Alpha]Cu)\)*\[CapitalDelta]T*AE*EE*ECu
          \)\/\(\((AE*EE)\) + \((ACu*ECu)\)\), 
      \(\((\[Alpha]Ehigh - \[Alpha]Cu)\)*\[CapitalDelta]T*AE*EE*ECu
          \)\/\(\((AE*EE)\) + \((ACu*ECu)\)\)]\  (*below\ Sy, \ in\ Pa\ *) ; 
  \n\[Sigma]avglow = 
    If[\[Sigma]avglow < Sy, \[Sigma]avglow, \ 
      If\ [\[CapitalDelta]T + Tref < ETg, 
        \(\((\((\((\[Alpha]Elow - \[Alpha]Cu)\)*\[CapitalDelta]T)\) + 
                \((Sy*\(ECu - ECuPrime\)\/\(ECu*ECuPrime\))\))\)*AE*EE*
            ECuPrime\)\/\(\((AE*EE)\) + \((ACu*ECuPrime)\)\), 
        \(\((\((\((\[Alpha]Ehigh - \[Alpha]Cu)\)*\[CapitalDelta]T)\) + 
                \((Sy*\(ECu - ECuPrime\)\/\(ECu*ECuPrime\))\))\)*AE*EE*
            ECuPrime\)\/\(\((AE*EE)\) + \((ACu*ECuPrime)\)\)]]\ 
   (*i.e.\ recompute\ if\ above\ Sy, \ in\ Pa\ *) \n\n\)\)

Edited File, Suitable for Kernel Processing

(*IPC - D - 279 PTH Model *) 
h = 0.0015875 (*Meter, PWB Board Thickness*) ; 
d = 0.0003175 (*Meter, Drilled PTV diameter*) ; 
t = 0.00003048 (*Meter, Thickness of Copper deposit in Barrel*) ; 
Sy = 172*10^6 (*Newton/Meter^2, Copper Yield Strength*) ; 
\[Alpha]Elow = 65*10^(-6) (*MLB CTE in z dir below Tg per deg C*) ; 
\[Alpha]Ehigh = 315*10^(-6) (*MLB CTE in z dir above Tg per deg C*) ; 
ETg = 137 (*Tg for Epoxy, deg C*) ; 
\[Alpha]Cu = 18*10^(-6) (*Copper CTE per deg C*) ; 
\[CapitalDelta]T = 50 (*Temperature range of thermal cycling, deg C*) ; 
Tref = 25 (*Reference Temperature - typically ambient, deg C*) ; 
EE = 3.5*10^9 (*Newton/Meter^2,  Modulus of Elasticity of epoxy*) ; 
ECu = 35*10^9 (*Newton/Meter^2, Modulus of Elasticity of pyrophosphate - plated copper*) ; 
ECuPrime = 0.7*10^9 (*Newton/Meter^2, Modulus of Plasticity of plated copper*) ; 
(*Calculations begin here*)
de = ((2*d)) + ((h/2)) (*Diameter of MLB dielectric influence*) ; 
AE = ((\[Pi]/4))*((de^2 + d^2)) ; 
ACu = ((\[Pi]/4))*((d^2 - ((d - 2*t))^2)) ; 
(*Include tempreature dependent MLB CTE behavior*) 
\[Sigma]avg = If [\[CapitalDelta]T + Tref < ETg, (((\[Alpha]Elow - \[Alpha]Cu))*\[CapitalDelta]T*AE*EE*ECu) / (((AE*EE)) + ((ACu*ECu))), (((\[Alpha]Ehigh - \[Alpha]Cu))*\[CapitalDelta]T*AE*EE*ECu ) / (((AE*EE)) + ((ACu*ECu)))]  (*below Sy, in Pa*) ; 
\[Sigma]avg = If[\[Sigma]avg < Sy, \[Sigma]avg, If [\[CapitalDelta]T + Tref < ETg, (((((((\[Alpha]Elow - \[Alpha]Cu))*\[CapitalDelta]T)) + ((Sy*(ECu - ECuPrime) / (ECu*ECuPrime)))))*AE*EE*ECuPrime) / (((AE*EE)) + ((ACu*ECuPrime))), (((((((\[Alpha]Ehigh - \[Alpha]Cu))*\[CapitalDelta]T)) + ((Sy*(ECu - ECuPrime) / (ECu*ECuPrime)))))*AE*EE*ECuPrime) / (((AE*EE)) + ((ACu*ECuPrime)))]] (*i.e. recompute if above Sy, in Pa*)

Send mail to andrew.scholand@cad.gatech.edu with questions or comments about this web page.
Copyright © 1997 Georgia Institute of Technology