# Using JPythonMethod's math functions

May, 2001

## Introduction

There are a large number of trig and math functions available, as defined below. Each of these operates on an entire VisAD Data object. For example:
```imagex = max(image1, image2)
```
will make a new Data object, imagex which will contain the maximum value at each point from both image1 and image2. Note that this is much more efficient than running through a loop in Jython and making the comparison yourself, since all the iterations are done in a much faster environment.

Note that if these images have navigation (coordinate systems) defined, they may have different domain samplings. In this case, the resulting imagex will have the domain sampling of image1. During the execution of this statement, if values from image2 need to be resampled to match the location of values in image1, this will take place automatically.

## Trig functions

• cos(Data d), cosDegrees(Data d)
• acos(Data d), acosDegrees(Data d)
• sin(Data d), sinDegrees(Data d)
• asin(Data d), asinDegrees(Data d)
• tan(Data d), tanDegrees(Data d)
• atan(Data d), atanDegrees(Data d)
• atan2(Data d1, Data d2), atan2Degrees(Data d1, Data d2)

## Other math functions

• ceil(Data d)
• floor(Data d)
• round(Data d)
• exp(Data d)
• log(Data d)
• sqrt(Data d)
• abs(Data d)
• max(Data d1, Data d2)
• min(Data d1, Data d2)