MATHS: SQUARE ROOT

MATHS: SQUARE ROOT FUNCTION

The square root of number n is the number that when multiplied by itself produces n (To multiply a number by itself is to 'square' it, thus square root). Thus the square root of 9 is 3, because 3x3=9. Every positive number had two square roots, a positive root and a negative root. This is because -3x-3 also produces 9. Poser returns the positive square root of positive numbers.

Above 1 the square root of any number is lower than the number itself (e.g. the square root of 4 is 2).

Below 1 the square root of any number is higher than the number itself (e.g. the square root of 0.25 is 0.5).

Below 0, Poser's maths breaks down a little. If there is any chance that your input into a square root function might drop below zero, I'd suggest putting an abs maths function in the way to avoid problems (see below for more on this).

The Sqrt maths function produces the Square Root of value_1. Value_2 is ignored in this function. Figure 1 shows the graph for the Square Root function over the range 0 to 2.5.

Fig 1: Square Root Graph
Fig 1: Square Root Graph

The square root function plays a crucial role behind the scenes in all 3D graphics. If you have a right angle triangle, and know the lengths of the two sides next to the right angle (Opposite and Adjacent sides), then you can calculate the length of the long side (hypotenuse). This is because H times H is equal to O time O+A times A. Therefore H is equal to the square root of (O*O+A*A).

Fig 2: Square Root and circles
Fig 2: Square Root and circles

Figure 2 shows this formula in the Poser material room, using U and V to give us our O and A. This gives us a segment from a circle. The result of the sqrt function for any point on the shader will be the distance from the bottom left corner of the shader to that point. Here we have plugged the output of the Sqrt function into a Step function. This returns 1 when Value_2 is equal or higher to Value_1 and 0 when it is not. Where Value_1 is low, near the bottom left corner, 0.5 is higher, and so we get 1 (white). Where Value_1 is high, further away from that corner, the result will be 0 (white). The higher we set Value_2, the more of the result will be within the segment of the circle.

To get the entire circle we would need to modify the output of our u and v nodes to get a range that runs from -1 to 1 instead of 0 to 1. To do this create a subtract node. Plug the u or v node into Value_1. Set Value_1 to 2. We now have a range of 0 to 2. Finally, set Value_2 to 1. We now have our -1 to 1. Plug the output from the two subtract nodes into the two Multiply nodes and you will have a complete circle.

Fig 3: Merging pictures using Square Root
Fig 3: Merging pictures using Square Root

Figure 3 shows one potential use of the square root function. Here it is being used to merge two other nodes.

Bias with value_2 set to 0.707106781 produces the same curve as the square root function. 0.707106781 is the square root of 0.5. I'm sure there must be some direct connection between these two facts, but I have no idea what it is!

Fig 4: Proof Poser does not use imaginary numbers
Fig 4: Proof Poser does not use imaginary numbers

One complication with square roots comes if you try to find the square root of a negative number. Two negative numbers multiplied by each other always produce a positive number, so -2 is the negative square root of +4, not the square root of -4. To work with the square roots of negative numbers we need to use imaginary numbers. These are based on the concept of i. i is the square root of -1. If we want the square root of other negative numbers, we multiply the square root of the positive number by i, so the square root of -4 is 2i.

Poser doesn't actually do any of this. Figure 4 provides a visual proof of this. We take the square root of -1 and multiply it by itself. If Poser dealt with imaginary numbers, the result of our Multiply maths node would be -1. If we then plug this into a Abs function, we should see +1, or white. Instead, we see black. If the values that you are putting into the square root function might drop below zero, then I'd suggest putting a Abs function between the square root and your input, to avoid any unwanted glitches.

 


PoserWorld