Package esys :: Package escript :: Module pdetools :: Class Defect
[hide private]
[frames] | no frames]

Class Defect

object --+
         |
        Defect

Defines a non-linear defect F(x) of a variable x.

Instance Methods [hide private]
 
__call__(self, x)
 
__init__(self)
Initializes defect.
float
bilinearform(self, x0, x1)
Returns the inner product of x0 and x1
 
derivative(self, F0, x0, v, v_is_normalised=True)
Returns the directional derivative at x0 in the direction of v.
 
eval(self, x)
Returns the value F of a given x.
positive float
getDerivativeIncrementLength(self)
Returns the relative increment length used to approximate the derivative of the defect.
float
norm(self, x)
Returns the norm of argument x.
 
setDerivativeIncrementLength(self, inc=1.49011611938e-08)
Sets the relative length of the increment used to approximate the derivative of the defect.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

Initializes defect.

Overrides: object.__init__

bilinearform(self, x0, x1)

 

Returns the inner product of x0 and x1

Parameters:
  • x0 - value for x0
  • x1 - value for x1
Returns: float
the inner product of x0 and x1

derivative(self, F0, x0, v, v_is_normalised=True)

 

Returns the directional derivative at x0 in the direction of v.

Parameters:
  • F0 - value of this defect at x0
  • x0 - value at which derivative is calculated
  • v - direction
  • v_is_normalised - True to indicate that v is nomalized (self.norm(v)=0)
Returns:
derivative of this defect at x0 in the direction of v

Note: by default numerical evaluation (self.eval(x0+eps*v)-F0)/eps is used but this method maybe overwritten to use exact evaluation.

eval(self, x)

 

Returns the value F of a given x.

Parameters:
  • x - value for which the defect F is evaluated
Returns:
value of the defect at x

getDerivativeIncrementLength(self)

 

Returns the relative increment length used to approximate the derivative of the defect.

Returns: positive float
value of the defect at x

norm(self, x)

 

Returns the norm of argument x.

Parameters:
  • x - a value
Returns: float
norm of argument x

Note: by default sqrt(self.bilinearform(x,x) is returned.

setDerivativeIncrementLength(self, inc=1.49011611938e-08)

 

Sets the relative length of the increment used to approximate the derivative of the defect. The increment is inc*norm(x)/norm(v)*v in the direction of v with x as a starting point.

Parameters:
  • inc (positive float) - relative increment length