If you know the formula (i.e., how to create the result by hand) you shouldn't have any difficulty in creating the subroutine yourself. What difficulty are you having with it?
As I see it, you'd start with something like:
sub Normalize { my $v = shift; my $vSquared = InProduct($v, $v); my $divisor = ... square root of sum of components of vSquared ... my $newVec1 = ... vector created by components of v divided by posi +tive divisor ... my $newVec2 = ... vector created by componets of v divided by negat +ive divisor ... .... whatever else is needed ... return $stuff; } my @dipoleMomentVectors = Normalize($dipoleMoment);
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^5: The problem of getting the unit vector "Undefined subroutine &main::Normalize"
by roboticus
in thread The problem of getting the unit vector "Undefined subroutine &main::Normalize"
by windcrazy86
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |