It is that time of the year to upgrade the Ubuntu operating system-11.10-Oneiric Ocelot to 12.04-Precise Pangolin

May 9th, 2012

Draft mode until this notice is removed.

I do not immediately upgrade my Ubuntu system using software system upgrade. You will be at the mercy of network glitches and suffer longer times than downloading the newest ISO. Here is my terminal command for my 64 bit system:

wget -ct 0 http://ftp.ticklers.org/releases.ubuntu.org/releases//precise/ubuntu-12.04-desktop-amd64.iso

It took 3 hours and 23 minutes for the full download of 732,213,248 bytes at about 66Kbits per second speeds . That is how slow the Internet is in the Philippines.

Now you can burn the image file to a DVD or a high capacity CD disk. But we will continue to explain how to do it using a usb flash drive.

In the next step we use netbootin, a utility which installs operating systems given its ISO to usb flash drives. If not available, install it via the "sudo apt-get install unetbootin". Fire the unetbootin and specify diskimage. click on the "..." button to open a graphical menu to select the downloaded iso file. After selectiong the iso image file, click the Ok button. Then it will ask you to reboot. Save any intermediate task works if you have not done so.

You then click the reboot button and take off from there!

To be continued.

Further reading:

  1. Linux Insider: Ubuntu Linux 12.04, Microsoft's Worst Nightmare?
  2. Wikipedia: Ubuntu Releases
Share

Humor in the classroom. Getting fried by an excuse.

May 7th, 2012

Subject: Fw: Why Planning is important ?

Dear friends

Some time planning is more important than hard work....,Read this ..Why Planning is important?

One Night 4 college students were playing till late night and could not study for the test which was scheduled for the next day.

In the morning they thought of a plan. They made themselves look dirty with grease and dirt. They then went up to the Dean and said that they had gone out to a wedding last night and on their return the tire of their car burst and they had to push the car all the way back and that they were in no condition to appear for the test. So the Dean said they could have the re-test after 3 days. They thanked him and said they would be ready by that time.

On the third day they appeared before the Dean. The Dean said that as this was a Special Condition Test, all four were required to sit in separate classrooms for the test. They all agreed as they had prepared well in the last 3 days.

The Test consisted of 2 questions with a total of 100 Marks.

Scroll Below for the question Paper

Q.1. Name of the car??
........... ............ ......... (2 MARKS)

Q.2. which tire burst? (98 MARKS)

a) Front Left b) Front Right
c) Back Left d) Back Right

True story from the Indian Institute of Technology Bombay ... a world class Technology university, and copied from a Facebook posting.

Share

Avoid clicking on links to Facebook Games

April 29th, 2012

You might lose your privacy, and may provide hackers an outlet to get your passwords to sensitive sites (they are not forthcoming). This one is on Hidden Chronicles.

There are two buttons "ALLOW" and "DONT ALLOW". Now that you know, play it safe, by not making it easy for identity theft to happen. Your personal information is precious, do you want to give it away for free??!

Share

The Lyric mobile spam and scam

April 26th, 2012

From time to time we gat spam from 8070 with irritating messages like these (Two exmaples out of twenty stored in my phone are shown below) :

LYRIC: Manalo ng up to 20,000.00
Q: CUESHE: Lagi na lang ________, UMUULAN ba ang sunod?
Repy w/ LYRIC Y or LYRIC N now. To quit, txt OFF to 8070. P2.5/tx. prome from 01/21/12 to 01/21/13. DTINCRPermit#0400S of 12. Cflyr4dtls.

Received 09:31:32AM Today [April 26]
From: (no name)
8070

LYRIC: Manalo ng up to 20,000.00
Q: JIMMY BONDOC: Let me be the one to ________ it up, BREAK ba ang sunod?
Repy w/ LYRIC Y or LYRIC N now. To quit, txt OFF to 8070. P2.5/tx. prome from 01/21/12 to 01/21/13. DTINCRPermit#0400S of 12. Cflyr4dtls.

Received 08:3617am [April 13]
From: (no name)
8070

I just wish there is a system that someone sending unwanted message to me will be charged 2.50 pesos!

Share

"A scam in the name of the United Nations Human Settlements Programme" Redux

April 26th, 2012

I got this new comment from a certain Kimberly regarding the posting on a scam using an international organization name.

A new comment on the post "A scam in the name of the United Nations Human Settlements Programme" is waiting for your approval:

http://adorio-research.org/wordpress/?p=12271

Author : Kimberly (IP: 208.54.39.180 , mb42736d0.tmodns.net)
E-mail : Kimkeepit100@aol.com
URL :
Whois : http://whois.arin.net/rest/ip/208.54.39.180
Comment:
After much attempts to reach you on phone, I deemed it necessary and urgent to contact you via your e-mail and to notify you finally about your outstanding compensation payment.

During our last annual calculation of your banking and Internet activities we realized that you are eligible to receive a compensation payment of $2,811,041.00 USD.

This compensation is being made to all of you who have suffered losses as a result of fraud, accident or illness.

For more information, contact the UPS agent for the delivery of your cashier check ($2,811,041.00 USD).

United Parcel Service (UPS)
Contact Name: Ford Hamilton
Tel: +2348077932717
E-mail: upscss1@aim.com

Please take note that you will pay a shipping/handling fee of $145.00 USD to UPS.

Thanks for your patience.

Tylor Robinson

Programme Manager
United Nations Human Settlements Program

Share

repost: Complex trigonometric and hyperbolic functions

April 24th, 2012

This article originally appeared in our alternate site Optimal Learning Systems.

Complex Trigonometic Functions

\begin{array}{ll} \hline\mbox{\bf Function }& \mbox{\bf Formula} \\ \hline\mbox{sine}  & \sin(z) = \frac{1}{2j}(e^{jz} - e ^{-jz}) \\      & = \sin x \cosh y + j \cos(x) \sinh(y)    \\\mbox{cosine}& \cos(z) = \frac{1}{2j}(e^{jz} + e ^{-jz}) \\      & = \cos x \cosh y - j \sin(x) \sinh(y)    \\\mbox{tangent}& \tan(z) = \frac{\sin(z) }{\cos(z)}\\      &= \frac{e^{jz} - e^{-jz}}{j(e^{jz} + e^{-jz})} \\\mbox{cotangent}& \cot(z) = \frac{\cos(z)} {sin(z)}\\      &= \frac{j(e^{jz} + e^{-jz}}{e^{jz} - e^{-jz}} \\\mbox{secant} & \sec(z) = \frac{1}{\cos(z)} = \frac{2}{e^{jz} + e^{-jz}}\\\mbox{cosecant} &\csc(z) = \frac{1}{\sin(z)} = \frac{2j }{e^{jz} - e^{-{jz}}}\\\end{array}

Complex Hyperbolic Functions.

  \begin{array}{ll} \hline\mbox{\bf Function} & \mbox{\bf Formula}\\ \hline\mbox{hyperbolic sine} & \sinh(z)= \frac{e^{jz}- e ^{-jz}}{2} = -j \sin(jz)\\                        &= \sinh(x) \cos(y) + j \cosh(x) \sin(y)\\\mbox{hyperbolic cosine}& \cosh(z) = \frac{e^{jz}+ e ^{-jz}}{2} = \cos(jz)\\\mbox{hyperbolic tangent} & \tanh(z) = \frac{\sinh(z)}{\cosh(z)} = \frac{e^z - e^{-z}}{e^z + e^{-z}}\\ \mbox{hyperbolic secant} &sech(z) = \frac{1}{\cosh(z)} = \frac{2}{e^z + e^{-z}}\\\mbox{hyperbolic cosecant} & csch(z)= \frac{1}{\sinh(z)} = \frac{2}{e^z - e^{-z}}\\\mbox{hyperbolic cotangent} &\coth(z) = \frac{\cosh(z)}{\sinh(z)}= \frac{e^z + e^{-z}}{e^z - e^{-z}}\\\end{array}

Complex Inverse Functions.

\begin{array}{ll} \hline\mbox{\bf Function} & \mbox{\bf Formula} \\ \hline\mbox{Inverse sine} & \sin^{-1}(z) = \frac{1}{j}\ln(jz \pm\sqrt{1-z^2}\\\mbox{Inverse cosine} & \cos^{-1}(z) = \frac{1}{j}\ln(z \pm\sqrt{z^2-1}\\\mbox{Inverse tangent} & \tan^{-1}(z) = \frac{1}{2j} ln(\frac{1 + jz}{1 -jz})\\\mbox{Inverse cotangent} & \cot^{-1}(z) = \frac{1}{2j} ln(\frac{ z + j}{z- j})\\\mbox{Inverse cosecant} & \csc^{-1}(z) = \frac{1}{j}\ln(\frac{j+\sqrt{z^2-1}}{2})\\\mbox{Inverse secant} & \sec^{-1}(z) = \frac{1}{j}\ln(\frac{1+\sqrt{1-z^2}}{2})\\\mbox{Inverse hyperbolic sine} &\sinh^{-1}(z) = \ln(z + \sqrt{z^2+1})\\\mbox{Inverse hyperbolic cosine}&\cosh^{-1}(z) = \ln(z + \sqrt{z^2-1})\\\mbox{Inverse hyperbolic tangent}&\tanh^{-1}(z) = (1/2) ln(\frac{1+z}{1-z})\\\mbox{Inverse hyperbolic cosecant}&csch^{-1}(z) = \ln(\frac{1 + \sqrt{z^2+1}}{2})\\\mbox{Inverse hyperbolic secant}& sech^{-1} (z) = \ln(\frac{1 + \sqrt{1-z^2}}{2}\\\mbox{Inverse hyperbolic cotangent}&\coth^{-}(z)= (1/2) \ln(\frac{z+1}{z-1})\\\end{array}

Relationships between trig and hyperbolic complex functions.

\begin{array}{ll}\sin (jz) = j \sinh(z) & \sin(z)= -j \sinh(jz)\\\sinh (jz)= j \sin(z) & \cos(z) = \cosh(jz) \\\cos (jz) = \cosh(z) & \tan(z) = -j \tanh(jz)\\\cosh (jz) = \cos(z) & \sinh(2 + j 2\pi) = \sinh(z) \\\tan (jz) = j \tanh(z) & \sinh(z + j\pi = -\sinh(z)  \\\tanh (z) = j \tan(z) & \sinh(z + j\pi/2) = j \cosh(z) \\\cosh (z + j 2\pi) = \cosh(z)&cos(z + j\pi) =  -\cosh(z)\\\cosh(z + j\pi/2) = j\sinh(z) \\\end{array}

Please comment in case of errors! Any errors will be fixed right away!

Share

repost: Complex Algebra: Basic Operations and Functions of a complex number.

April 24th, 2012

This is a repost of an article which originally appeared in our former Optimal Learning Systems site.

Let z_1 = x_1 + j y_1= r_1 \angle\theta_1= (x_1, y_1) and z_2 = x_2 + j y_2= r_2 \angle\theta_2= (x_2, y_2).

\begin{array}{ll}\mbox{Equivalence} & z_1 = z_2 \mbox{ iff } x_1=x_2 \mbox{ and } y_1 = y_2. \\\mbox{Addition}    & z_1 + z_2 = (x_1 + x_2) + j( y_1 + y_2)\\\mbox{Subtraction} & z_1 - z_2 = (x_1 - x_2) + j( y_1 - y_2)\\\mbox{Multiplication} &z_1 z_2 = (x_1 x_2 - y_1 y_2) + j(x_1 y2 + x_2 y_1)\\                      & = r_1 r_2 \angle (\theta_1 + \theta_2) \\                      & = r_1 r_2 [cos(\theta_1 + \theta_2 ) + j sin(\theta_1 + \theta_2)]\\\mbox{Division}    & z_1 /z_2 = \frac{x-1 x_2 + y_1 y_2}{x_2^2 + y_2^2} -j\frac{x_2 y_1 - x_1 y_2}{x_2^2 + y_2^2}\\                   & = \frac{r_1}{r_2} \angle {(\theta_1 - \theta_2)}\\                   & = \frac{r_1}{r_2} [\cos(\theta_1 - \theta_2)+ j \sin(\theta_1 - \theta_2)]\\\mbox{Sum or reciprocals} & \frac{1}{z_1} + \frac{1}{z_2}= \frac{z_1+ z_2}{z_1 z_2}\\                  & = \frac{x_1}{x_1^2+ y_1^2}+ \frac{x_2}{x_2^2 + y_2^2}                     - j [\frac{y_1}{x_1^2 + y_1^2} +\frac{y_2}{x_2^2 + y_2^2}]\\ \mbox{Product of} z_1  & z_1 \overline{z_2} = (x_1 x_2  y_1y_2) - j (x_1 y_2 - y_1 x_2)\\ \mbox{ and  conjugate of }z_2 &= r_1 r_2 \angle(\theta_1 - \theta_2) \\\mbox{Dot product} & |z_1||z_2| \cos(\theta) = (x_1 x_2 + y_1 y_2) \\                   & = R_e(\overline{z_1} z_2) \\                   & =\frac{1}{2} (\overline{z_1} z_2 + z_1 \overline{z_2} \\\mbox{Cross product} & |z_1||z_2| \sin(\theta) = x_1 y_2 - y_1 x_2 \\                     & = Im(\overline{z_1} z_2)\\                     & = \frac{1}{2j} (\overline{z_1} x_2 + z_1 \overline{z_2})\\\mbox{Principal value of } \ln (z_1 z_2) & \ln(z_1) + \ln(z_2) - i 2\pi; \pi < \theta_1+\theta_2 \le 2 \pi\\                     &=\ln (z_1) +\ln z_2 ; -\pi < \theta_1+\theta_2 \le 2 \pi\\                     &=\ln (z_1) +\ln(z_2) + j 2\pi ; -2\pi < \theta_1+\theta_2 \le -\pi\\ \end{array}

\begin{array}{ll}\mbox{\bf Function} & \mbox{\bf Formula} \\ \mbox{Real part} & Re (z) = x = \frac{1}{2}(z + \overline{z})\\ \mbox{Imaginary part} & Im(z) = y = \frac{1}{2j}( z - \overline{z}\\ \mbox{Absolute value} & mod(z) = |z| = r = \sqrt{x^2 +y^2} = \sqrt{z\overline{z}}\\ \mbox{Norm}& norm(z) = r^2 = x^2 + y^2 = z\overline{z}\\ \mbox{Argument} & arg(z)= \theta = \tan^{-1}(y/x) = \sin^{-1} (y/r)\\ \mbox{or amplitude} &= \cos^{-1} (x/r)\\ \mbox{Conjugate} & \overline{z} = z^* = x- jy = re^{-j\theta} =  r cis(-\theta)= (x, -y)\\\mbox{Square} & z^2 = (x^2-y^2) + j xy= r^2 \angle(2\theta)= r^2 [cos(2\theta) + j \sin(2\theta) \\\mbox{Square roots}& \pm \sqrt{z} = \pm(\sqrt{r} (cos(\theta/2) + j \sin(\theta/2)\\                   & \pm [\frac{|z|+x}{2}+ sign(y) j \sqrt{\frac{|z|-x}{2}}\\\mbox{Integral power} & z^n = r^n \angle(n\theta) = r^n[\cos(n\theta) + j \sin(n\theta)]\\\mbox{Integral roots} & z^{(1/n)}= r^{(1/n)}[\cos(\frac{\theta + 2k\pi}{n}) + j \sin(\frac{\theta + 2k\pi}{n})]\\                      & \mbox{for k }= 0, 1, \ldots, n-1\\\mbox{Rational roots} & z^{(p/q)}= r^{(p/q)}[\cos[(p/q)(\theta + 2k\pi)] + j \sin[(p/q)(\theta + 2k\pi)]]\\                      & \mbox{for k }= 0, 1, \ldots, p-1\\\mbox{General power} & z^c = e^{c\ln(z)}, \mbox{many valued unless c is a rational number.}\\\mbox{Exponential } & e^z = e^{(x + jy)} = e^x [\cos(y)+ j\sin(y)]\\\mbox{Reciprocal}   & 1/z = \frac{x}{x^2+y^2}- j\frac{y}{x^2+y^2} = (1/r) \angle (-\theta)\\\mbox{Natural log}  & \ln(z) = ln(|z|) + j (\theta + 2n\pi), n= 0, \pm 1, \pm 2, \ldots\\\mbox{Principal value } ln(z) & = \ln(|z|) + j\theta \\\mbox{Principal value } ln (z^m) & = m \ln(z) - j 2k\pi, \mbox{k is unique integer satisfying}\\                     & \frac{m}{2\pi} arg(z) - 1/2\le k \le \frac{m}{2\pi}arg(z) + 1/2\\\end{array}

Finally, in the next post for Complex Algebra, we shall list the trigonometric and hyperbolic functions including their inverses for complex numbers.

Share

repost: The many ways of specifying a straight line

April 24th, 2012

This is originally from our alternative site Optimal Learning Systems.

  • Two-point, intercept form
  • Given two points (x_1, y_1), (x_2,y_2) along the line: y = \frac{y_2-y_1}{x_2-x_1} x + b where b is the intercept, i.e., (0, b) is on the line.

  • Point slope form
  • Given the slope m and a point (x_1, y_1) on the line:
    y = y_1 + m (x-x_1)

  • Slope intercept form
  • Given the slope and the point (0, y_1) on the line: y =  m x + y_1

  • Intercepts form
  • Given (a,0) and (0, b): \frac{x}{a} +\frac{y}{b} = 1.

  • Parametric trigonometric form
  • Given the angle \theta which the line makes with the positive x-axis, and a fixed point, (x_1, y_1) on the line: x= x_1 + r\cos(\theta);  y = y_1 + r \sin(\theta)
    where r = distance from (x,y) to (x_1 y_1).

  • Trigonometric perpindicular distance to origin:
    Let p be the perpindicular distance to origin. and \theta angle of line in standard position. Then

    x cos (\theta) + y \sin(\theta) = p.

  • General form
  • Ax + By = C.

  • Vector form
  • Let a be a vector to a point on the line, then any vector from the origin to any other point on the line may be written as: \bf{r} = \bf{a} + t \bf{b} where t is a real number parameter.

Share

reposted: Mean Value Theorems of Calculus.

April 24th, 2012

The original post was in our alternative site, Optimal Learning Systems.org.

  • Rolle's Theorem
  • If f(x) is continuous in [a,b] and differentiable in (a,b), then there exists a point c \in (a, b) such that f'(c) = 0.

  • Theorem of the Mean

    If f(x) is continuous in [a,b] and differentiable in (a,b), then there exists a point  c \in (a, b) such that \frac{f(b)-f(a) }{b-a} = f'(c).

  • Cauchy's theorem of the mean

    If f(x) and g(x) are continuous in [a,b] and differentiable in (a,b), then there exists a point  c \in (a, b) such that

    \frac{f(b)-f(a)}{g(b) - g(a)}= \frac{f'(c)}{g'(c)}

  • Taylor's theorem of the mean:

    (Future article on Power series expansion of function centered at a point a.)

  • Mean value theorem for function of two variables:

    If f(x,y) is continuous in a closed region and if the first partial derivatives exist in the open region , then

    f(x_0 + h , y_0 + k) - f(x_0, y_0) =  h f_x(x_0 + \theta h, y_0 + \theta k) + k f_y (x_0 + \theta h, y_0 + \theta k)

Share

Important fluid flow dimensionless groups in engineering.

April 24th, 2012

Originally published in Optimal-Learning-Systems.org(Life, Research, Education on the Web).

These numbers are used in dimensional scaling of models, hydrodynamics and aeronautics.

  1. Reynolds Number, N_R or R_e:
     N_R = \frac{VD\rho}{\mu}

    Viscuous forces are dominant.

    V average fluid velocity
    D diameter of pipe
    \rho fluid density
    \mu viscosity
  2. Froude's Number,N_F

    N_F = \frac{V^2}{gL}

    Gravitational forces are dominant.

    V average fluid velocity
    g acceleration due to gravity
    L characteristic length
  3. Mach Number, N_M or M
     N_M = \frac{V}{\sqrt{\frac{E}{\rho}}}= \frac{V}{a}

    Elasticity forces are dominant.

    V average fluid velocity
    E modulus of elasticity of fluid
    \rho fluid density
    a acoustic velocity
  4. Prandtl Number, N_{Pr} or P_R
     N_{Pr} = \frac{u c}{\kappa}

    \mu viscosity
    c specific heat
    \kappa conductivity
  5. Nusselt's number, N_{Nu} or N_u
     N_{Nu} = \frac{hL}{\kappa}

    h Heat transfer film coefficient
    L characteristic surface length
    \kappa conductivity
  6. Weber's number, N_{W}
     N_{W} = \frac{V^2L\rho}{\sigma}

    V fluid velocity
    L characteristic length
    \rho fluid density
    \sigma surface tension
  7. Grashoff's number, N_{Gr}
     N_{Gr} = \frac{L^3\rho^2\beta g \theta}{\mu^2}

    L surface characteristic length
    \rho fluid density
    \beta cubical expansion coefficient
    g acceleration due to gravity
    \theta temperature
    \mu viscosity
  8. Graetz number, N_{Gz}
     N_{Gz} = \frac{\dot{m} c}{\kappa L}

    \dot{m} mass of fluid flowing per time
    c specific heat
    \kappa condctivity
    L length
  9. Karman number, N_{K}=N_{K} = \frac{D\rho}{\mu}\sqrt{\frac{2g_c D \overline{L_{wf}}}{L}}

    N_K= N_R \sqrt{f}

    gc gravitational constant (conversion factor)
    D diameter
    \rho fluid density
    L length
    \overline{L_{wf}} friction loss, (in fluid height)
  10. Peclet number, N_{Pe} or P_e
     N_{P_e} = \frac{Dv\rho c}{k}= R_e P_r

  11. Stanton Number, N_{st} or S_t

    N_{st}= \frac{h}{V\rho c}=\frac{N_U}{R_e P_r}

  12. Schmidt NUmber, S_c

    S_c = \frac{\mu}{\rho D_G}

    D_G Molecular diffusibility in the gas phase (area /time).
    Share

republished: Formulas for Numerical Differentiation with Error Estimates

April 23rd, 2012

Originally published in http://optimal-learning-systems.org/wp/?p=136

Let f(x) be the function whose first or second derivatives at x = a are desired.

\begin{array}{|l|l|l|}\hline Method &Formula & Error \\ \hline  \mbox{Forward difference} & f'(a) = \frac{f(a+h) - f(a}{h}&   \frac{-1}{2} h f^{(2)} (\varphi)\\ \mbox{Central difference} & f'(a)= \frac{f(a + h) - f(a -h)}{2h}& \frac {-h^2}{6} f^{(3)}(\varphi) \\ \mbox{Four point} & f'(a) = \frac{-3 f(a_ + 4 f(a+h) - f(a + 2h)}{2h} & \frac{h^2}{3} f^2(\varphi)\\  \mbox{Five point} & f'(a) = \frac{[f(a -2h) - 8 f(a -h) + 8 f(a +h) - f(a + 2h)]}{12h} &  \\ & f''(a)= \frac{f(a) - 2 f(a +h) + f(a +2h}{h^2} &  \frac{h^2}{6}f^{iv}(\varphi) - hf''' (\varphi) \\ & f''(a)= \frac{f(a-h) - 2 f(a) + f(a +h)}{h^2} & \frac{-h^2}{12}f^{iv}(\varphi), |\varphi - a | < |a|\\ \hline\end{array}

Further reading:

Trent Guidry: Numerical Differentiation formulas provides a comprehensive tabulation from two points first derivatives to eleven points fifth derivatives. His table is derived on his post
Trent Guidry: Calculate derivatives function numerically, complete with Java code! It is a challenge to convert this to Python.

Share

Python, Number Theory: generating Pythagorean triples

April 23rd, 2012

Originally published in http://optimal-learning-systems.org/wp/?p=146

Pythagorean triples are a set of three integers forming the sides of a right triangle.
The algorithm to generate these numbers were already known to Euclid, who also
introduced the Euclidean algorithm to determine the greatest common divisor of
two positive integers.

Here is Python code to generate Pythagorean triples.

?View Code PYTHON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
file      pythagtriple.py
author    dr. ernesto p. adorio
          up clarkfield
version   2010.06.26  initial release
"""
 
def gcd(a,b):
    """
    Computes the  greatest common divisor of two integers a and b.
    """
    if a < b: 
       a,b = b, a
    while b != 0:
       a, b = b, a - a//b * b
    return a
 
 
 
def genpytriple(maxa):
    """
    Generates pythagorean triples.
    """
    outlist=[]
    for a in range(2, maxa+1):
       for b in range(1, a):
          if gcd(a,b) == 1:
             x = 2 * a *b 
             y = a * a - b * b
             z = a * a + b * b
             outlist.append((a, b, x,y,z))
    return tuple(outlist)
 
 
outlist = genpytriple(15)
 
print """
<table>
<tr>
<th>i</th><th>a</th><th>b</th><th>x</th><th>y</th><th>z</th></tr>
"""
 
 
for i, (a, b, x, y, z) in enumerate(outlist):
    print "<tr>",
    print "<td>%s</td>" % (i+1),
    print "<td>%s</td>" % a,
    print "<td>%s</td>" % b,
    print "<td>%s</td>" % x,
    print "<td>%s</td>" % y,
    print "<td>%s</td>" % z,
    print "</tr>"
print "</table>"

When the above program is run, it outputs the following html table:

i a b x y z
1 2 1 4 3 5
2 3 1 6 8 10
3 3 2 12 5 13
4 4 1 8 15 17
5 4 3 24 7 25
6 5 1 10 24 26
7 5 2 20 21 29
8 5 3 30 16 34
9 5 4 40 9 41
10 6 1 12 35 37
11 6 5 60 11 61
12 7 1 14 48 50
13 7 2 28 45 53
14 7 3 42 40 58
15 7 4 56 33 65
16 7 5 70 24 74
17 7 6 84 13 85
18 8 1 16 63 65
19 8 3 48 55 73
20 8 5 80 39 89
21 8 7 112 15 113
22 9 1 18 80 82
23 9 2 36 77 85
24 9 4 72 65 97
25 9 5 90 56 106
26 9 7 126 32 130
27 9 8 144 17 145
28 10 1 20 99 101
29 10 3 60 91 109
30 10 7 140 51 149
31 10 9 180 19 181
32 11 1 22 120 122
33 11 2 44 117 125
34 11 3 66 112 130
35 11 4 88 105 137
36 11 5 110 96 146
37 11 6 132 85 157
38 11 7 154 72 170
39 11 8 176 57 185
40 11 9 198 40 202
41 11 10 220 21 221
42 12 1 24 143 145
43 12 5 120 119 169
44 12 7 168 95 193
45 12 11 264 23 265
46 13 1 26 168 170
47 13 2 52 165 173
48 13 3 78 160 178
49 13 4 104 153 185
50 13 5 130 144 194
51 13 6 156 133 205
52 13 7 182 120 218
53 13 8 208 105 233
54 13 9 234 88 250
55 13 10 260 69 269
56 13 11 286 48 290
57 13 12 312 25 313
58 14 1 28 195 197
59 14 3 84 187 205
60 14 5 140 171 221
61 14 9 252 115 277
62 14 11 308 75 317
63 14 13 364 27 365
64 15 1 30 224 226
65 15 2 60 221 229
66 15 4 120 209 241
67 15 7 210 176 274
68 15 8 240 161 289
69 15 11 330 104 346
70 15 13 390 56 394
71 15 14 420 29 421

The first two triples are our familiar 3,4,5 (known to the ancient Egyptians) and 6,8, 10.

Share

republished: Formulas for Area of Triangle.

April 23rd, 2012

Formerly published in http://optimal-learning-systems.org/wp/?p=151.

We present various formulas for computing areas of a tringle.

  1. Base and height (b,h) known: A = \frac{1}{2}b h
  2. Three sides (a,b,c) known(Heron's formula): A = \sqrt{s(s-a)(s-b)(s-c)}= \frac{1}{4}\sqrt{(a + b+ c)(a + b - c) (a-b + c) (-a + b+ c)} where
    s = \frac{a + b + c}{2}

  3. Two adjacent sides and included angle known:
    A = \frac{bc \sin(\alpha)}{2} = \frac{ab sin\gamma}{2}= \frac{ac \sin(\beta}{2}

  4. One side, three angles known:
    A = a^2 \frac{\sin(\beta) \sin(\gamma)}{2\sin(\alpha)}=b^2 \frac{\sin(\alpha)\sin(\gamma) }{2\sin(\beta)}=c^2 \frac{sin(\alpha)\sin(\beta)}{2\sin(\gamma)}

  5. Radius of circumscribed circle R, with three sides (a,b,c) known: A = \frac{abc}{R^2}
  6. Radius of inscribed circle, r, and s known: A = rs
  7. Radius of escribed circle r_a and side a known: A = r_a (s -a).
  8. Coordinates of vertices(x_1, y_1), x_2, y_2), (x_3, y_3) known:
    A = \frac{1}{2}\left| \begin{array}{lll} 1  & 1 & 1\\ x_1 &x_2 &x_3\\ y_1 & y_2 & y_3\\ \end{array}\right|
Share

republished: A MultiVariate Function (mvf) library in C

April 23rd, 2012

I am planning to close down my other blogs hosted in another site. I will be transferring some of the articles originally posted there to this blog.

This article was firs published in http://optimal-learning-systems.org/wp/?p=484

When I was still in Diliman, I wrote on my own free time, and without any funding, a library in C consisting of the well known global optimization functions we keep encountering in the optimization literature. I put it up at Geocities. Unfortunately, Geocities was bought by Yahoo but sometime later, Geocities was sent to oblivion. I still remember when searching using Google, the best references were in Geocities! or Angelfire or Tripod.com.



The list of functions included in the library included the Ackley,Branin, Camel, Hartmann,GoldsteinPrice and of course, the famous Rosenbrock function.



I am bringing back from obscurity my mvf work. Readers who wish to view the contents as an html should click on mvf.html and those who prefer a pdf file, should click on mvf.pdf and the source code is available as a C file and the header file is at mvf.h. All files including the latex source files can be obtained by downloading the bzipped file jan.19.mvf.tar.bz2


We will spend more time trying to resuscitate our love of the subject of global optimization, ignoring stupid critics who love disparaging our work and naively thinking that creative scientific programming is a clerical activity!



Googling mvf.c returned the following citations:

1. "The Bees Algorithm: modelling foraging behaviour to solve continuous optimization problems", D T Pham, M Castellani Reference site: http://journals.pepublishing.com/content/t70214132l32p0j0/
Proceedings of the Institution of Mechanical Engineers, Part C: Journal of Mechanical Engineering Science

Publisher Professional Engineering Publishing
ISSN 0954-4062 (Print) 2041-2983 (Online)
Issue Volume 223, Number 12 / 2009
DOI 10.1243/09544062JMES1494
Pages 2919-2938

The references cited the following:

E. P. Adorio, 'MVF – multivariate test functions library in C for unconstrained global optimization' (2005): available from http://geocities.com/eadorio/mvf.pdf


2. "Differential Evolution: Fundamentals and Applications in Electrical Engineering", Anyong Qing, 2009, Wiley
Web reference: Qing


3. 'Multidimensional sequential sampling for NURBs-based metamodel development', Engineering with Computers, Vol 23, No.3, Sep. 2007, ISSN 01777-0667(print), 1435- 5663(online)"
Turner(Plutonium manufacturing and technology division, Los Alamos
National Laboratory), Crawford and Campbell(University of Texas at Austin),

Unfortunate that one has to shell out money to view the articles! We hope to be more productive always in spite of the lack of facilities.

Share

Beware: Prudential Life scam

April 21st, 2012

Frm: PHILIPPINE PRUDENTIAL FINAL NOTIFICATION:

Good day...
This is Mrs. ROQUE from PHIL> PRUDENTIAL RELEASING OFFICE Marilao Bulacan Branch. We have beentrying to reach you regarding your Unclaimed Rewards.To know the Details on how to Claim these REwardsa. Please Call at Holtine numbers.

*MARILAO BULACAN OFFICE*
(Office Hour 9AM-5Am)
[044-8158958]
[044-8158964]

Your prompt feedback will be Highly Appreciated. Thank you and God Bless. (Disregard if claimed)

Received:
03:10:03pm
20-04-2012
Sender:
(noname)
+639234999944

Share

Featuring Recent Posts WordPress Widget development by YD