Saturday, May 1, 2010

Cable analysis with central point load

The following is a cable analysis with central point load using VBA excel code created by the author to produce approximate numerical solutions:

Private Sub CALC_Click()
Dim e, Lp, i, T As Double
i = Sheets(1).Cells(7, 2).Value
e = Sheets(1).Cells(8, 2).Value
T = Sheets(1).Cells(9, 2).Value
Lp = Sheets(1).Cells(16, 3).Value
For n = Lp To T Step i
Sheets(1).Cells(16, 3).Value = n
If Sheets(1).Cells(16, 9).Value < e Then GoTo 100
Next n
100:
End
End Sub


Monday, April 19, 2010

Mental Calculation of n^2 Base 50

n^2 = ((n-50) + 25)x 100+(n-50)^2

From

n^2 = (n-50)^2 + 100n - 50^2 <<< (n^2 - 100n + 50^2) + 100n - 50^2

example

55^2 = ((5 + 25 ) x 100 = 3000) + ( 5 x 5 = 25) = 3025

57^2 = ((7 + 25) x 100 = 3200) + ( 7 x 7 = 49) = 3249

47^2 = ((-3 + 25) x 100 = 2200) + (-3 x -3 = 9) = 2209

61^2 = ((11 + 25) x 100 = 3600) + (11 x 11 = 121) = 3721

Sunday, April 18, 2010

Mental Calculation of n^2 Base 10

n^2 = (n+(n-10))x10+(n-10)^2

From

n^2 = (n-10)^2 + 20n - 10^2 <<< (n^2 - 20n + 10^2) + 20n - 10^2

example

15^2 = ((15 + 5) x 10 = 200) + ( 5 x 5 = 25) = 225

17^2 = ((17 + 7) x 10 = 240) + ( 7 x 7 = 49) = 289

11^2 = ((11 + 1) x 10 = 120) + (1 x 1 = 1) = 121

9^2 = (( 9 - 1) x 10 = 80) + (-1 x -1 = 1) = 81

Mental Calculation of Multiplication Base 10

n x r = (n + (r - 10)) x 10 + (n - 10) x (r - 10)

From

n x r = (n - 10) x (r - 10) + (10n + 10r - 10^2)

example

13 x 12 = ((13+(12-10)=15)x10 = 150) + ((13-10)x(12-10) = 6) = 156

14 x 17 = ((14+(17-10)=21)x10 = 210) + ((14-10)x(17-10) = 28) = 238

17 x 9 = ((17+(9-10)=16)x10 = 160) + ((17-10)x(9-10) = -7) = 153

8 x 18 = ((8+(18-16)=16)x10 = 160) + ((8-10)x(18-10) = -16) = 144

Saturday, April 17, 2010

Mental Calculation of Multiplication Base 100

n x r = (n - (100 - r)) x 100 + (100 - n) x (100 - r)

From

n x r = (100 - r) x (100 - n) + (-100^2 + 100n + 100r)

example

95 x 96 = ((95-(100-96)=91)x100 = 9100) + ((100-95)x(100-96) = 20) = 9120

92 x 94 = ((92-(100-94)=86)x100 = 8600) + ((100-92)x(100-94) = 48) = 8648

106 x 107 = ((106-(100-107)=113)x100 = 11300) + ((100-106)x(100-107) = 42) = 11342

91 x 104 = ((91-(100-104)=95)x100 = 9500) + ((100-91)x(100-104) = -36) = 9464

Mental Calculation of Multiplication by Two-Digit Number Special

n x r = a (a + 1) x 100 + b x d

let
n = a x 10 + b ; First Two-Digit Number
r = c x 10 + d ; Second Two-Digit Number

If
a = c
b + d = 10

Then
n x r = (a x 10 + b ) x (c x 10 + d)
n x r = a x c x 100 + (a x d + b x c) x 10 + b x d
where
a = c
b + d = 10 >>> d = 10 - b
n x r = a x a x 100 + (a x (10 - b)+ b x a) x 10 + b x d
n x r = a x a x 100 + (a x 10 - b x a + b x a) x 10 + b x d
n x r = a x a x 100 + a x 100 + b x d
n x r = a x (a + 1 )x 100 + b x d

example

44 x 46 = (4 x 5 x 100 = 2000) + (4 x 6 = 24) = 2024

52 x 58 = (5 x 6 x 100 = 3000) + (2 x 8 = 16) = 3016

78 x 72 = (7 x 8 x 100 = 5600) + (8 x 2 = 16) = 5616

91 x 99 = (9 x 10 x 100 = 9000) + (9 x 1 = 9) = 9009

Saturday, April 3, 2010

ITERATION & NEWTON-RAPHSON METHOD

The following is an iteration using VBA excel code created by the author to produce approximate numerical solutions to certain mathematical problems:

Private Sub Commanditerate_Click()

Range("A8:c8").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents

Dim a, b, e, per As Double
e = Sheets(2).Cells(3, 2).Value
For x = 1 To 1000000

a = Sheets(2).Cells(6, 2).Value
b = Sheets(2).Cells(6, 3).Value
per = Abs((a - b) / b) * 100
If per < e Then GoTo 100

Sheets(2).Cells(6, 1).Value = x
Sheets(2).Cells(6, 2).Value = b
Sheets(2).Cells(7 + x, 1).Value = x
Sheets(2).Cells(7 + x, 2).Value = b
Next x

100:
Sheets(2).Cells(2, 2).Value = b
Sheets(2).Cells(7 + x, 1).Value = x
Sheets(2).Cells(7 + x, 2).Value = b
Range("b6:b6").Select
End Sub

Below is a video of iteration method by using Newton-Raphson Method


GAUSS ELIMINATION

In linear algebra, Gaussian elimination is an algorithm for solving systems of linear equations, finding the rank of a matrix, and calculating the inverse of an invertible square matrix The following is a sample of VBA excel code created by the author: Private Sub Clear_Click() Application.ScreenUpdating = False Dim ans As String ans = MsgBox("Data will be cleared. Please confirm ", vbYesNo + vbExclamation) If ans = vbNo Then End Sheets(8).Activate 'clear content of matrix Sheets(8).Range("A10:IV1000").Select Selection.ClearContents Sheets(8).Cells(3, 2).Select End Sub Private Sub Compute_Click() Dim N, div, multi As Integer 'reading data N = Sheets(8).Cells(3, 2).Value ReDim c(N, N + 1) For i = 1 To N For j = 1 To N + 1 c(i, j) = Sheets(8).Cells(i + 10, j + 3).Value Next j Next i 'ensure c(1, 1) <> 0 If c(1, 1) = 0 Then Call msg0 Else 'forward elimination of pivot row For i = 1 To N div = c(i, i) For j = i To N + 1 c(i, j) = c(i, j) / div Next j For k = i + 1 To N multi = c(k, i) For j = i To N + 1 c(k, j) = c(k, j) - multi * c(i, j) Next j Next k Next i 'back substitution For i = N To 0 Step -1 For k = N To i + 1 Step -1 c(i, N + 1) = c(i, N + 1) - c(i, k) * c(k, N + 1) Next k Next i 'value of unknown For i = 1 To N Sheets(8).Cells(i + 10, 1) = c(i, N + 1) Next i End Sub Sub msg250() MsgBox ("n value is limit to 250 only!") End End Sub Sub msg0() MsgBox ("C(1,1) is equal to 0") End End Sub Private Sub GenerateGE_Click() Dim N As Integer Dim ans As String Application.ScreenUpdating = False Sheets(8).Activate 'N as number of row or column N = Sheets(8).Cells(3, 2).Value 'limit N to 250 If N > 250 Then Call msg250 Else For i = 1 To N Sheets(8).Cells(i + 10, 3) = i Sheets(8).Cells(10, i + 3) = i Next i Sheets(8).Cells(10, N + 4) = N + 1 Sheets(8).Cells(11, 2).Select End Sub