MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to parametrize a block of commands?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111021] How to parametrize a block of commands?
  • From: Sam Takoy <sam.takoy at yahoo.com>
  • Date: Sat, 17 Jul 2010 08:16:02 -0400 (EDT)

Hi,

Suppose I have written the following block of commands for computing the 
differential geometry elements on a surface of evolution given by r=F[g] 
z=Z[g]. This topic not my interest, I just cooked it up for an example.

TF[m_] := Flatten[Transpose[m]]
Combine[m1_, m2_] :=
  Partition[Join[m1 // TF, m2 // TF], Length[m1]] // T
R[g_, theta_] := {F[g] Cos[theta], F[g] Sin[theta], Z[g]}
Z1[g_, theta_] := Derivative[1, 0][R][g, theta]
Z2[g_, theta_] := Derivative[0, 1][R][g, theta]
UnitN[g_, theta_] := Cross[Z1[g, theta], Z2[g, theta]] // Normalize
shift[g_, theta_] := Combine[{Z1[g, theta]} // T, {Z2[g, theta]} // T]
m[g_, theta_] := Transpose[shift[g, theta]].shift[g, theta]
M[g_, theta_] := Inverse[m[g, theta]]

M[g, theta] // MatrixForm


My question is this: could this entire block be turned into a function 
"paramtrized" by F and Z. For example, denote that whole block by XXXXX. 
Is there something along the lines of

DiffGeom[F_, Z_] := XXXXX
r[g_] := a Cosh[(g - H/2)/a]
z[g_] := g
DiffGeom[r, z]

In other words, once I have taught Mathematica to compute these objects 
for general surfaces of revolution, I want it to apply it to a 
particular surface of revolution. What's the best way to organize this?


  • Prev by Date: Re: Select only certain sublists matching criteria
  • Next by Date: Re: how to display the value of w after using do?
  • Previous by thread: Re: Transform differential equation by tranformation rule
  • Next by thread: Re: How to parametrize a block of commands?