Last Update: 02/15/04   Home Page  >>  AutoCAD  >>   AutoLISP Tutorials  >> Tutorial 1: Math Functions

 Helping you to navigate
 AutoCAD

 Navagating AutoCAD w/ HyperPics


  AutoLISP Tutorials
  Tutorial 1: Math Funcs.

 Send Mail to: lee_ambrosius@hyperpics.com
Send e-mail and comments

AutoLISP Tutorial
A little Math to get started.....

Mathematical Equation : 1 + 2 = 3

AutoLISP expression: (+ 1 2)


Symbols used for Math Calculations under AutoLISP:

Math Functions
Symbol Real Name Function Format
abs Absolute (abs nbr)
exp Exponent (natural antilog) (exp nbr)
gcd Greatest Common Denominator (gcd int1 int2)
log Natural Log (log nbr)
rem Remainder (rem nbr1 nbr2)
sqrt Square Root (sqrt nbr)
* Multiplication (* nbr1 nbr2...)
+ Addition (+ nbr1 nbr2...)
- Subtraction (- nbr1 nbr2...)
/ Division (/ nbr1 nbr2...)
1+ Add One (1+ nbr)
1- Subtract One (1- nbr)

Examples:
(abs -12.67) 12.67
(abs 1.95) 1.95

(exp 1) 2.71828 e = 2.71828
(exp 10.0) 22026.5 e = 2.71828

(gcd 852 15) 3
(gcd 852 12) 12

(log 12) 2.48491
(log 1) 0

(rem 10 5) 0
(rem 8.5 2 7) 0.5

(sqrt 4) 2.0
(sqrt pi) 1.77245

(* 4 12) 48
(* 4 8) 32

(+ 4 12) 16
(+ 8 3) 11

(- 4 12) -8
(- 8 3) 5

(/ 4 12) 0
(/ 8 3) 2
(/ 8 3.0) 2.66667

(1+ 3) 4
(1+ 1.25) 2.25

(1- 3) 2
(1- 1.25) 0.25



Home
| About HyperPics | AutoCAD | AutoCAD LT | Feedback |

© Copyright 2000,2004 - 2005 HyperPics. All rights reserved.