Skip to content

Commit

Permalink
Add usage for Power algorithm.
Browse files Browse the repository at this point in the history
Refs #9574
  • Loading branch information
martyngigg committed Jun 6, 2014
1 parent 97959e0 commit 8801e0f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion Code/Mantid/docs/source/algorithms/Power-v1.rst
Expand Up @@ -14,11 +14,37 @@ Exponent. When acting on an event workspace, the output will be a
Workspace2D, with the default binning from the original workspace.

Errors
------
######

Defining the power algorithm as: :math:`y = \left ( a^b \right )`, we
can describe the error as: :math:`s_{y} = by\left ( s_{a}/a \right )`,
where :math:`s_{y}` is the error in the result *y* and :math:`s_{a}` is
the error in the input *a*.


Usage
-----

**Example - Square each Y value:**

.. testcode::

# Create a 2 spectrum workspace with Y values 1->8
dataX = [0,1,2,3,4,
0,1,2,3,4]
dataY = [1,2,3,4,
5,6,7,8]
data_ws = CreateWorkspace(dataX, dataY, NSpec=2)
result_ws = Power(data_ws, 2)

print "Squared values of first spectrum:", result_ws.readY(0)
print "Squared values of second spectrum:", result_ws.readY(1)

Output:

.. testoutput::

Squared values of first spectrum: [ 1. 4. 9. 16.]
Squared values of second spectrum: [ 25. 36. 49. 64.]

.. categories::

0 comments on commit 8801e0f

Please sign in to comment.