Difference between revisions of "Integrate"

m (adding doc status category)
Line 2: Line 2:
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
  
Returns the result of applying the trapezoidal rule of integration of array R over index I.  ''Integrate'' computes the cumulative integral across I, returning a value with the same number of dimensions as R.  Compare ''Integrate'' to [[Area]].
+
= Integrate( y,x'',i'' ) =
  
= Declaration =
+
Returns the result of applying the trapezoidal rule of integration to the set of points <code>(x_i,y_i></code>.
 +
''Integrate'' computes the cumulative integral across «i», returning a value with the same number of dimensions as «x» and «y».  Compare [[Integrate]] to [[Area]].
  
Integrate(R,I)
+
When either «x» or «y» is an index, the index parameter «i» may be safely omitted.
or
+
 
  Integrate(R1,R2,I)
+
= Library =
 +
 
 +
:Array functions
 +
 
 +
= Examples =
 +
 
 +
Let:
 +
:Function Sinc(x) := [[If]] x=0 Then 1 Else [[Sin]]([[Degrees]](x)) / x
 +
:Index r := [[Sequence]](-20,20,0.01)
 +
 
 +
:Sinc(r) &rarr; [[Image:Sinc.png]].
 +
 
 +
The integral of this function is given by:
 +
 
 +
:Integrate( Sinc(r), r ) &rarr; [[Image:Integral_of_sinc.png]]
 +
 
 +
Note that because the index ''r'' was defined from -20 to 20, [[Integrate]] treats all values for x<-20 as being zero.
 +
 
 +
= Handling of [[Null]] values =
 +
 
 +
''New to [[What's new in Analytica 4.2?|Analytica 4.2]]''
 +
 
 +
The «x» and «y» arrays must contain numbers, but may also contain [[Null]] values.  Any point having «x»=[[Null]] is entirely ignored and has no impact on the result.  When a point has a numeric «x» but a [[Null]]-valued «y», this is treated as a ''gap'' in the function, and the trapezoid extending from the previous «x» to the next «x» is ''not'' counted in the integration.
 +
 
 +
Suppose, for example, that:
 +
:Index x := 1..5
 +
:Variable y := [[If]] x=3 then [[Null]] else x
 +
In this example, the curve denoted by (x,y) has a gap at x=3. Integrate treats this as if it were the function shown here:
 +
 
 +
[[Image:Integrate with null y.jpg]]
 +
 
 +
In this case, the area to the left of x=1 is 0, the area to the left of x=2, x=3 or x=4 is 1.5, and the area to the left of x=5 is 1.5+4.5 = 6.
 +
 
 +
= Functions with Discontinuities =
  
 
= See Also =
 
= See Also =
  
 
* [[Area]]
 
* [[Area]]
 +
* [[Normalize]]

Revision as of 19:48, 13 September 2009


Integrate( y,x,i )

Returns the result of applying the trapezoidal rule of integration to the set of points (x_i,y_i>. Integrate computes the cumulative integral across «i», returning a value with the same number of dimensions as «x» and «y». Compare Integrate to Area.

When either «x» or «y» is an index, the index parameter «i» may be safely omitted.

Library

Array functions

Examples

Let:

Function Sinc(x) := If x=0 Then 1 Else Sin(Degrees(x)) / x
Index r := Sequence(-20,20,0.01)
Sinc(r) → Sinc.png.

The integral of this function is given by:

Integrate( Sinc(r), r ) → Integral of sinc.png

Note that because the index r was defined from -20 to 20, Integrate treats all values for x<-20 as being zero.

Handling of Null values

New to Analytica 4.2

The «x» and «y» arrays must contain numbers, but may also contain Null values. Any point having «x»=Null is entirely ignored and has no impact on the result. When a point has a numeric «x» but a Null-valued «y», this is treated as a gap in the function, and the trapezoid extending from the previous «x» to the next «x» is not counted in the integration.

Suppose, for example, that:

Index x := 1..5
Variable y := If x=3 then Null else x

In this example, the curve denoted by (x,y) has a gap at x=3. Integrate treats this as if it were the function shown here:

Integrate with null y.jpg

In this case, the area to the left of x=1 is 0, the area to the left of x=2, x=3 or x=4 is 1.5, and the area to the left of x=5 is 1.5+4.5 = 6.

Functions with Discontinuities

See Also

Comments


You are not allowed to post comments.