Math::Volume::Rotational - Volume of rotational bodies
use Math::Volume::Rotational qw/volume_x volume_y/; my $volume = volume_rot_x( '(2-x^2)^0.5', -2, 2 ); # equivalent: use Math::Symbolic qw/parse_from_string/; my $formula = parse_from_string('(2-x^2)^0.5'); $volume = volume_rot_x($formula, -2, 2); # The above calculates the volume of a sphere of radius 2 by rotating # the half-circle of radius 2 around the x-axis. # This is equivalent to the well-known formula "4/3*pi*radius^3". # volume_rot_y works similar by rotating around the y-axis.
This module calculates the volume of rotational bodies. These are bodies resulting from the rotation of a portion of a 2D function around an axis.
Please note that rotations around an axis other than either x- or y-axis are considered highly experimental at this point.
None by default, but you may choose to have any of the following subroutines exported to the calling namespace via standard Exporter semantics:
volume_rot_x volume_rot_y volume_rot_arb
Additionally, you may use the export tag ':all' to export all of the above.
Calculates the volume of a rotational body by rotatinf a the portion of a function graph around the x-axis. The function graph is integrated from a lower to an upper boundary.
Expects a Math::Symbolic tree or a string to be parsed as such as first argument. Second argument must be the lower boundary, third must be the upper parameter boundary.
Works the same as volume_rot_x. It calculates the volume of a rotational body by rotating a the portion of a function graph around the y-axis. The function graph is integrated from a lower to an upper boundary.
Expects a Math::Symbolic tree or a string to be parsed as such as first argument. Second argument must be the lower boundary, third must be the upper parameter boundary.
Calculates the volume of a rotational body by rotating a portion of a function graph around an arbitrary axis in R^2. The function graph is integrated from a lower to an upper boundary. volume_rot_arb takes named arguments:
This is the function to integrate over. It must be a Math::Symbolic tree or a string to be parsed as such. Needs to be a scalar function. This is a mandatory argument.
Indicates the name of the variable to use for integration. This is an optional argument if the variable can be inferred from the function.
This optional argument indicates a function to subtract from the integration function before integration. Thus, you can calculate the volume of a hollow sphere of a given thickness.
Mandatory argument indicating the y value of the axis to rotate around at x=0.
Indicates the slope of the axis in R^2. Mandatory argument.
The lower boundary for integration. Mandatory argument.
The upper boundary for integration. Mandatory argument.
Steffen Mueller, <volume-module at steffen-mueller dot net>
New versions of this module can be found on http://steffen-mueller.net or CPAN. The module development takes place on Sourceforge at http://sourceforge.net/projects/math-symbolic/