Geosoft mapping software for geophysics, geology, geochemistry
 

How To: Use math expressions (for databases and grids)

|

Symptom/Problem:
User wants details on using math expressions - what is the syntax? What are the operators and how do I use them? How do I get into the correct mode to do this in my database?


Environment:
Oasis montaj, Target, Target for ArcGIS, all versions.


Resolution:
See also Help Topics - use "math expressions" as your search term. Specifically, search for "Rules for Math Expressions", and you will find a list of help files to choose from.

In v6.*, triple click on the channel header to which you wish to apply math expressions and then hit the "=" key. Begin typing in the math expression in the Formula box in the database window. When you have finished your math expression hit the "enter" key. Your expression will be evaluated and the results entered in the appropriate channel.

(In v6.*, you can also use X-Utility > Expressions > Expression or Expression File)

In v7.0, the channel math tool can be used as above (in v6.*), or by going to Database Tools | Channel Math.

The operators used in the math expressions in Geosoft's software are used to compare left and right-hand variables. In Oasis montaj, there is a precedence in which the operators must be used. The list of operators below, are shown in decreasing order of precedence. For some operators, there is a left-to-right order for evaluating.

Below is a comprehensive list of the math expressions used in Geosoft's software.

Precedence

Operator

Definition

1

()

Parentheses

2

F()

Function

3

!

Logical NOT operator

4

**

Exponent

5

/, *, %

(evaluated left to right)

Division, multiplication, modular division

6

+, -

(evaluated left to right)

Addition, subtraction

7

<, <=, >, >=

(evaluated left to right)

Greater than; greater than or equal to; less than; less than or equal to

8

==, !=

(evaluated left to right)

Equal to; not equal to

9

&&

Logical AND operator

10

||

Logical OR operator

11

?:

? represents the value if true

: represents the value if false

True/false operator (used with a statement preceding it)

 

Example, using an if true false statement:

I have a channel of aeromagnetic data. The data ranges from 4000-5500 nT. I want to grid data only in the range from 4000 to 5000 nT.

1) Create a new channel. The original aeromagnetic data channel is called "aeromag".

2) Enter a math expression in the new channel: aeromag<5000?aeromag:dummy.

This states that: Is aeromag less than 5000 - if true (?) then populate the new channel with data from the aeromag channel, if false (:), the populate the new channel with a dummy value.

Another possible expression would be: aeromag>5000?dummy:aeromag,