Delphi and BASM sample code
PIC specific math@ (including
trigonometric functions sin(), arctan(), etc.),
SX specific math@,
Intel specific math@
Dr Dobbs Journal #271 pg 18
"A Conversation with William
Kahan" William Kahan
"Formulas that are numerically stable are sometimes quite inelegant. Formulas
that give you greater accuracy are sometimes full of cases, ugly cases....
F(x)=(sin x)/x .... F(x)=(sin x)/x if x != 0 and F(0) = 1"
Have ex-mathematicians become dysfunctional?
Multiplying Faster with Squares (Lookup). Because:
(a+b)2 = a2 + b2 + 2ab
(a-b)2 = a2 + b2 - 2ab
Subtracting these gives:
4ab = (a+b)2 - (a-b)2
ab = (a+b)2/4 - (a-b)2/4
which reduces the difficult parts from an x*y to an x2/4. With only one variable (and enough ram) lookup tables are suddenly back in frame. Because a-b and a+b are always both even or both odd, you only need one table. So if we keep in memory
a table of x2/4 we can do a multiply with an add, two subtractions
and two table lookups. The tables have a+b number of entries rather than
a*b, but must hold values as large as a*b if the full range of possible output
is to be supported.+
http://floating-point-gui.de/ Floating point guide. Detailed
explanation of how floating point works on binary systems and what can go
Fast ATAN2. if |X|>|Y| [(-b*x*y)/(x^2+ a*y^2) + c*sign(x)] else [-c*sign(x*y)=
c*sign(x) + (b*x*y)/(y^2+a*x^2)] where a = 0.28088, b = 180/Pi, c = b/2*Pi
2^ Shows how mechanical elements are used to compute answers. Understanding
these methods helps to round out our understanding of mathematics.
On-line CRC Concise
Encyclopedia of Mathematics from
Frequently Asked Questions
in Mathematics from The Sci.Math FAQ Team. Editor:
National Institute of Standards and Technology
- Guide to Available Mathematical Software
Netlib is a collection of mathematical software,
papers, and databases
Nice step by step tutorial in various aspects of computational physics
Online integral evaluation with Mathematica.
SIN / COS approximations
Randy Hyde's UCR
Toby Opferman's Math Tutorials For - Unit Circle & Trig Functions *
Linear Algerbra - Vectors - Matrices * Calculus - Limits - Derivatives
- Integrals (Anti-Derivatives)
a few good algorithems. Russian Peasant Multiplication, The Single-Pole Low-Pass
Filter, Welford's Method (And Friends), Topological Sort
Part 5: Quadratic Extremum Interpolation and Chandrupatla's Method
Part 6: Greenâs Theorem and Swept-Area Detection
Convert between decimal and IEEE-754 formats
FAQ: Numerical Analysis & Associated Fields Resource Guide
Two's Complement and Binary Math
"Statistical Distributions" by NAJ Hastings and J.B.Peacock John Wiley 1974
0-470-35889-0 This rare book is essential for anyone doing MonteCarlo
simulations or using Random Number sequences. It is a collection of simple
algorithms for generating random numbers with specific distributions given
a simple random number generator with good first and second order distribution.
If you've got a basket with 3 oranges in it and you take 5 out, then you
have to put 2 oranges in again in order for it to be empty. -- Peter Gutmann
Simple way to factor quadratic equations of the form x2 + Bx +
C = 0.
- Convert from Ax2 + Bx + C = 0 by dividing all terms by A.
- Find two numbers with sum -B and product C.
- They will sum to -B if they are the average of B plus or minus some number:
-B/2 +- u in other words: -B/2 = u and -B/2 = -u.
- And (-B/2 + u)(-B/2 - u) = C or -B/2 - u2 = C or u2
= C - B/2
- So u = sqrt(C - B/2).
Summary: x^2 + Bx + C = 0. u = sqrt(C - B/2), r = -B/2 + u, and w = -B/2
- u. So (r + x)(w - x) = 0.
taking the square (x^2) with
Nicolaas Gerhardus Scheepers of
Hi there, I am having trouble with arithmetic in assembler. I want to do
the following calculation:
Y = ((X-Xmin)((Ymax-Ymin)/(Xmax-Xmin))) + Ymin This is a formula to scale
a point between Xmax and Xmin to a point between Ymax and Ymin. The Y points
is 8-bit but the X points can be up to 16-bit values. You can already see
my problem because I cannot get any 16-bit divided by 16-bit algorith or
for that matter 24-bit divided by 16-bit that replies with the fractional
part. So I came up with the next formula to try and use a 16-bit divided
by 8-bit number to give back fractions:
Y = ((X-Xmin)(1/(Xmax-Xmin)/(Ymax-Ymin))) + Ymin But it just gets more complex
as I go along. My second problem is that say I work out the division and
now I must multiply the answer (which is fractional , how the hell do you
do it with the fractional part. Do you first multiply both numbers so they
are integer and then divide it again later with the same number or what.
Am I even on the right track here or am I going bananas? Please help me I
am now three months into the game and have learned a lot in a short space
of time but the learning just seems to grow and not level out, not that I
am complaining just a remark:-)
Rearrange the formula so that the top and bottom of the fraction is kept
seperate. What you really want is:
Y = ((X-Xmin)(Ymax-Ymin) + Ymin(Xmax-Xmin)) over Xmax-Xmin.
Now you can do the top and bottom seperatly. Multiplying by a fraction is
a seperate job but can still be done without division. It is a good
idea to reduce the fraction after each operation to prevent overflow. A method
for doing that is available but I can't find it at the moment.
Once you have the final answer, then you do the division.
| ||©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/Techref/method/math.htm"> Methods in Math</A>
Welcome to www.sxlist.com!