Cookbook: Difference between revisions

Jump to navigation Jump to search
175 bytes added ,  22 August 2012
No edit summary
Line 60: Line 60:
==== Problem  ====
==== Problem  ====


One sometimes needs to define a family of functions depending on a set of parameters, ''e.g.''
One sometimes needs to define a family of functions depending on a set of parameters, e.g.,
<math>f (x, y, z; a, b, c)</math>  
 
<math> f (x, y, z; a, b, c) </math>  
 
where  
where  
<math>x, y, z</math>  
 
<math> x, y, z </math>  
denote a the variables on which the function operates and  
denote a the variables on which the function operates and  
<math>a, b, c</math>  
 
<math> a, b, c </math>  
 
are the parameters used to chose one specific element of the family of functions.
are the parameters used to chose one specific element of the family of functions.


For example, let's say we want to implement a function that given the spring constant  
For example, let's say we want to implement a function that given the spring constant  
<math>k</math> and the initial elongation <math>x_0</math> of a  
 
<math> k </math>  
 
and the initial elongation  
 
<math> x_0 </math>  
 
of a spring, computes the time evolution of the elongation
 
<math> x (t ; x_0, k) </math>
 
by solving the Cauchy problem
 
<math> x' = - k x\\ x(0) = x_0 </math>
 
==== Solution ====
==== Solution ====
==== Discussion ====
==== Discussion ====
349

edits

Navigation menu