logo  VB.Net - Mathematical Functions
This Chapter
Mathematics
Area
Statistics
Factorial
Trignometry
Hyperbolic Trig.
Number Range
Quad&Cubic
Chapters
Home Page
Colours, RGB
Computer Specifications
Dates&Times
Disk Drives
Files
Folders
GPS and OS Ref
VB.Net Forms
Image Files
If & Select
List/Array
Mathematics
NuGet
Sound
String Functions
Sun and Moon
User Controls
Validation
DigitalDan Sites
My Other Sites
Contact Site

Note
Some pages
may contain
inaccuracies
Hits=6
Mathematical Functions
The Math. Namespace contains many of the popular mathematical functions, however, it would be impossible for any language to build-in commands for every possible function variant. This section of the formulary provides VB.Net code for some of the missing features.
 
Converting Algorythmns and Other Computer Languages into VB.Net
= a ^ b
VB.Net interprets this as = a Xor b
Some other languages or formula sheets use this expression to mean = a b
In VB.Net, = a b is coded as = Math.Pow(a, b)
 
Trignometry (Sin, Cos, Tan etc.)
Pocket calculators often default to measuring angles in degrees and many formula sheets also use degrees.
Most computer languages (including .Net) measure angles in Radians. The following code converts radians to degrees
radians = degrees * Math.Pi / 180
degrees = radians * 180 / Math.Pi
 
= ATan2(x, y) Computer languages disagree on how to interpret = ATan2(x, y) some of them swap the x and y parameters. If the VB.Net function = Math.ATan2(x, y) produces unexpected results, try swapping the parameters
In Excel ATan2(1,2) = -1.107 and ATan2(2,1) = 0.464
In VB.Net Math.ATan2(1, 2) = 0.464 and Math.ATan2(2, 1) = -1.107

DigitalDan.co.uk