## Bible Studies #41 Does God predestine anyone to be saved or to be dammed?

November 22nd, 2013

Here are relevant verses from the KJV (King James Version) containing the word predestine:

Are we predestined to be saved or predestined to be dammed?

We gather here verses from the KJV (King James Version) Bible containing the idea of predestination.

1. Acts 4:28, "to do whatever Your hand and purpose predestined to occur."
2. 1 Cor. 2:7, "but we speak God's wisdom in a mystery, the hidden wisdom,
which God predestined before the ages to our glory."

3. Ephesians 1:11 - In whom also we have obtained an inheritance, being predestinated according to the purpose of him who worketh all things after the counsel of his own will:
4. Romans 8:29 - For whom he did foreknow, he also did predestinate [to be] conformed to the image of his Son,
that he might be the firstborn among many brethren.

5. Romans 8:29-30 - For whom he did foreknow, he also did predestinate [to be] conformed to the
image of his Son, that he might be the firstborn among many brethren. (Read More...)

6. Rom. 8:30, "and whom He predestined, these He also called; and whom He called, these He also justified; and whom He justified, these He also glorified."
7. Ephesians 1:5 - Having predestinated us unto the adoption of children by Jesus Christ to himself,
according to the good pleasure of his will,

8. Eph. 1:11, "also we have obtained an inheritance, having been predestined according to His purpose who works all things after the counsel of His will."

Nowhere do any verses here lend any support for predestination towards salvation or predestination to damnation!

Now let us expand the scope of predestination.From an article in Wiki:Predestination,predestination is the theological doctrine that all events have been willed by God. So this means that John Calvin interpreted biblical predestination to mean that God willed eternal damnation for some people and salvation for others, meaning that God ignores man's choices. He based this on Romans 9:14-16:

14 What shall we say then? Is there unrighteousness with God? God forbid!

15 For He saith to Moses, “I will have mercy on whom I will have mercy, and I will have compassion on whom I will have compassion.”

16 So then it is not of him that willeth, nor of him that runneth, but of God who showeth mercy.

Arminius, in contrast to John Calvin holds that each person is free to choose to accept or reject God's offer of salvation and hence God allows man's choice to determine salvation (John 3:16-18).

John 3:16

16 “For God so loved the world that He gave His only begotten Son, that whosoever believeth in Him should not perish, but have everlasting life.

We tend to side with Arminius since it finds support in other biblical passages.

Those who believe in predestination like to cite
Romans 8:29-30

“Whom he foreknew, he also foreordained to be conformed to the image of his Son, that he might be the firstborn among many brethren: and whom he foreordained, them he also called: and whom he called, them he also justified: and whom he justified, them he also glorified”

What do you mean "foreknew"? A man knows his wife in intimate terms. Here God is saying that He knows those who love HIM. This is the reason Abel was chosen over Cain, why a repentant Jacob was chosen over Esau who treated his birthright as worthless.

The remaining part:----to be confomed to the image of his Son--- Jesus is God's ONLY son. This part shows us that we will be brethen of Jesus. God want us to be HIS children too!

Nowhere does this Romans 8:29-30 passage show predestination to SALVATION. Why? Because you must first LOVE God the Father!!

Love God, believe in Jesus- these are personal choices, not predestination!
In retrospect, Jesus is not needed if predestination is true,since belief in Jesus Christ as saviour, lord and redeemer amounts to NOTHING.

## Python snakery: Base-n integer conversions

August 26th, 2013

Python comes with base conversion routines to convert numeric values or number strings to binary, octal and hexadecimal values.The format is int(number or string, base). If the base is omitted, then base
is implied by the leading symbols or prefix. Binary numbers are prefixed by 0b, octal numbers by a 0, and hexadecimal numbers by 0x. If the base is 0,
the base is implied by the leading symbols. Here are some examples with outputs.

 call Output Remarks int(0b1111) 15 base 2 int(0x1111) 4369 base 16 int(01111) 585 base 8 int("1111", 2) 15 base 2 int("011") 11 base 10 (!!) int("011", 0) 9 base 8 int("0xABC",0) 2748 base 16 int(0xABC) 2748 base 16 int("ABC", 16) 2748 base 16 int(ABC) error int(ABC, 16) error

The int() function cannot convert non-string input with explicit base.

Conversion of decimal integers to binary, octal and hexadecimal are illustrated by the following examples.

 bin(12345) '0b11000000111001' base 2 oct(12345) '030071' base 8 hex(12335) '0x3039' base 16

To convert a decimal to a string numeral in nonstandard base, we can use the remainder method.
Here is a clear implementation with error checking from Sebastianjb with base up to 36. See href="http://code.activestate.com/recipes/65212-convert-from-decimal-to-any-base-number/">http://code.activestate.com/recipes/65212-convert-from-decimal-to-any-base-number/
for more implementations.

?View Code PYTHON
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  def basen(num, base, numerals = '0123456789abcdefghijklmnopqrstuvwxyz'): if base < 2 or base > len(numerals): raise ValueError("str_base: base must be between 2 and %i" % len(numerals))   if num == 0: return '0' if num < 0: sign = '-' num = -num else: sign = ''   result = '' while num: result = numerals[num % (base)] + result num //= base   return sign + result

## Management Pinoy Style #5 personal background to be taken with a grain of salt.

August 21st, 2013

Just because someone is the son or daughter of a general, or of a strong politician, just because a woman is a daughter of a missionary... these do not translate to a good leadership behavior. On the contrary such backgrounds will blind other people in assessing rightfully the morals and inclinations of employees, and leaders.

It is shocking indeed that people do not conform to the expected behavior. Just because someone served as a sacristan in church only make other people unnerved when they talk ill of other people or coleagues in a small company.

## Aug. 19, 2013: It is still raining...No work(MM) and all classes suspended.

August 19th, 2013

It is not a typhoon, just the ordinary moonsoon rains, made more intense by a tropical depression.

The Palace just announced the suspension of classes in all levels: PANGASINAN, BENGUET, BATAAN, ZAMBALES, TARLAC, PAMPANGA, BULACAN, RIZAL, LAGUNA, CAVITE, BATANGAS, OCCIDENTAL MINDORO, METRO MANILA: Classes are suspended in ALL LEVELS as ordered by the Executive Secretary. Likewise, the Executive Secretary has also ordered the suspension of work in government offices in Metro Manila except those involved in disaster risk reduction and management.

--From Presidential Spokesperson Edwin Lacierda, 5:56 AM Aug. 19, 2013

## Who is Jennifer Sulfridge and why is she emailing me this letter?

July 31st, 2013

from: Mrs.Jennifer Sulfridge
to: xxxxxxxx.xxxxxxx@hotmail.com
date: Sun, Jul 28, 2013 at 5:36 AM
subject: Re: A MESSAGE TO YOU FROM MY HEART
signed-by: yahoo.com.ph

Mrs.Jennifer Sulfridge

Jul 28 (3 days ago)

to me

My Dearest Friend ,I am very sure you can make a lot of difference by our communications and become good friends to see that with greater power comes greater responsibility. You can make a lot of changes in the life of others with this great offer through me to you and most especially the poor heated and the less privileged. Firstly i think I would start all with a proper introduction of myself.

I'm Mrs Jennifer Sulfridge A widow to Late Mr Bryan Hubert Sulfridge who died at a gun point some years back in Syria and am just 51 years old with no child, suffering from long time cancer of the breast. From all indications, my condition is really deteriorating and is quite obvious that I may not live more than two months according to my doctor because the stage at which my cancer is (Level 3) due to the critical ability and also to a very severe stage.

My personal physician told me that I may not live for more than 2 months and I am so scared about it. My late husband and I both grew up in a motherless home in Switzerland we got married over 28 years and we travel to the SPAIN for our wedding and decided to stay back there simply because it is a lovely country to be and we were given a permanent stay after so many years of living in the country and also we have no child of our own due to one problem and the other, Since his death I decided not to re-marry or get a child outside my matrimonial home which the Bible is against even though i wish to have. It is late now you know and age is no longer at my side but I still believe and have a great faith that they will be someone who will make me smile which is you.

Now i decided to give out all the wealth of i and my late husband by contributing to the development of the motherless baby homes, less privileges, raising the church of God, needy, poor, charity homes, widows and Cancer patient too in your country and I just want you to forget about the distance between me and you because life is not by distance but by the faith and grace upon ones head. I am willing to donate the sum of {1.000,000.00 British Pounds} which is still the major inheritance i and my late husband left, i wish you could be someone who I could trust with all my heart even at my pains and stage of given up due to my illness to make this wish of mine come true despite my prayers over you before I get to contact you.

I really need you to use this funds to help the poor which is very essential and also the widow and cancer patient just has the condition which am going through and i know this may sound strange but you should keep saying this proverb in your mind, soul and heart that i am like Moses in the Bible who came to the Red Sea and Pharaoh behind him and no way to turn but he was delivered by a miraculous deliverance so it will be a miracle from above to be able to help all the people he has laid on our hearts as you have been laid on my heart to do his will.

This is why in my heart i contact you and i want you to get back to me so we can always be in constant communications with all the poor souls out there. I have come to find out that wealth acquisition without been born again is vanity and i hope you will agree with this also. I will be praying hard that Satan will not stop this effort. Please do contact me and I will tell you more of what you wish to know in regards of the funds. Note that they is a great reason for me contacting you and i will be very grateful if you will heed to the call and paying attention to my words. I patiently await to hear a Good responds from you so i can enclose more visions to you.

Thank you beloved & God Bless You.

Mrs. Jennie

jenniesulfridge@hotmail.com

## Management Pinoy Style Stories #4, Senators and congressmen are legislators, not fund disbursers.

July 31st, 2013

What has PDAF (priorrity development assistance fund or pork barrel) to do with our management stories? A plenty!

First of all, Senators and congressmen, in accepting this largese from the executive branch are forgetting their roles as legislators.

Second, the president should accept responsibility for the proper disbursement and use of public funds.

Horror stories of billions of pesos wasted and slurped by supposed accredited NGOs is not unexpected.

In an institution or company, each must understand their roles in the organization.

It is a wonder why the general public are NOT mad enough to demand accounting resposibilty on the part of the president. The COA is just a cosmetic office. It is toothless.

## Management Pinoy Style Stories #3, an organization that accepts hearsay is bound to fail in its objectives.

July 31st, 2013

In an executive meeting, focusing on the problem of whether to terminate or keep an employee, some executives may be tempted to present letters, or other forms of communications from absent executives to the executive meeting.

If the meeting is allowed to accept such communications, it is well as good that they have allowed hearsay to look respectable. Especially if the absent executive has an axe to grind about the employee.

But the responsibility of accepting the consequencies lies with the one in charge of the meeting. Never allow such indirect and secondary presentations in a meeting. Irraparable damage may visit that institution and all will suffer, but they deserve that.

## Management Pinoy style stories #2. Why most public institution executives like to stay on AFTER their job term.

July 31st, 2013

This is not a rare situation, in fact the Philippines suffer from their politicians who will ensure that they or their relatives or supporters will fill-in positions after their term has ended.

You see, current executives may have enjoyed their perks of office that they will do everything to stop a potential but qualified successor in ascending and replacing the incumbent, to the extent that they will invent stories about the supposed incompetencies of their potential successors.

Never believe any claims that the incumbent is entitled to continue in office if the law says the position is time limited. On the contrary, it is HIS job to train future executives. Hence, He is an UTTER failure, in spite of his "accomplishments" if He is hell-bent on pursuing methods and stratagems to ensure his continued stay in office.

If you are the natural NEXT in line, you must be a martyr and suffer for your health and sanity by standing on your own grounds.Only EXTERNAL forces outside the community or organization can then FORCIBLY remove the power hungry incumbent.

## Management Pinoy style stories #1: Your immediate boss just cannot charge you with inefficiency.

July 31st, 2013

You work quietly at your desk and your immediate boss goes to your desk and say out loud:

Why are you so quiet? What are you working on? You are inefficient!

Keep your cool! You may have knowledge that the company may have performance outputs and efficiency metrics and monitoring system if the company or organization is working for a client which requires it. If this is the case, you have nothing to worry about.

Your immediate boss is out of line. It is his problem.

However, if there is no such standards in place, you cannot do much, but you can talk to the president of the company, unless the president is your immediate boss!

## Facebook is the favorite medium for presenting alarming wild claims

July 30th, 2013

Here is a screen grab of realfarmacy claims that gardasil is unsafe.

The claims should be matched with the more credible article from snopes.com

## Did Bayer infected people with HIV?

July 27th, 2013

If we do not believe it as true, better avoid using this medicine. An ounce of prevention is better than a pound of cure.

http://www.realfarmacy.com/bayer-and-us-government-knowingly-gave-hiv-to-thousands-of-children/

Unfortunate that the photo suggests aspirin from Bayer is tainted with HIV. but this is a hoax.

The real story is about a product called a blood clotting factor VIII for haemophilacs where it was sourced from donated blood from people infected with HIV.

The sad truth was that, it was not only Bayer but other companies were also involved. Alpha Therapeutic Corporation, Rhone-Poulenc Rorer Inc., a unit of Rhone-Poulenc S.A., Bayer Corporation and its Cutter Biological division, Baxter International and its Hyland Pharmaceutical division.The newer products do not source from donated blood anymore.

It is there the height of irresponsibility to suggest that Bayer gave HIV to children.

realfarmacy.

We ask readers to read the following sources before taking at face value the above claims in the image.

References.

## Using pylinpro to solve linear programming problems.

July 22nd, 2013

Our pylinpro function was a Python translation of a C trranslation of the original LINPRO program. In this article we have explain the new interface function to use pylinpro more effectively.

Recall that the standard LP program will have the standard input format

 Minimize: C'X Subject to: AX [<=, =, >=] b with X $\ge$ 0

All the user has to do is to supply the following:

 A -the coefficients of the left hand side of the set of constraint equations in the order of "less than or equal to", "equal to", and finally the "greater than or equal to" constraints b -the RHS vector of the as a list C -the cost coefficients of the original variables. L,E G - the number of less than, equal to and greater than constraints. qProcessArtificialVars True if artificial variables are to be included in the solution process. qMaximize True if maximizing and False if minimizing

For convenience, we are presenting the complete code, together with some published examples for testing.

?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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396  """ file pylinpro.py author ernesto.adorio@gmail.com UPEPP UP at Clark Field Pampanga, the PHilippines zip code: 2009 source translation from BASIC to C/C++ to Python of G.E. linpro program. revisions 2009.01.25 first version 2009.01.26 debugged and updated. """   from matlib import matzero, matdim, matprint, matsetblock   def pylinpro (AA,M,N,L, E,G, artifcode,opticode,Basis, display_code, ZTOL = 1.0e-6): """ Parameters AA AA is a dynamically allocated matrix and should be dimensioned (M+2) * JLIM where JLIM = N + G + L + 1 if artifcode = 0 and JLIM = N + G + M + 1 if artifcode = 1.   B coefficients are stored in AA[ ][0] Z coefficients are stored in AA[M][] Phase 1 coefficients are stored in AA[M+1][]   M Number of constraint equations N Number of variables L Number of less thans E Number of equal tos G Number of greater thans   artifcode 0 - do not process artificial variables, 1 - otherwise   opticode 0 - minimization 1 - maximization   Basis[] Output current Basis column. Variables are numbered 1 to L+E+G.   LPcode Return LPcode code of LP routine: 0 - Successful 1 - Array too small 2 - Inconsistent equations 3 - B coefficients must be positive ! 4 - Infeasible, artificial variable in solution 5 - No solution, unbounded solution 6 - Excessive number of iterations 7 - Failed to allocate space for VC   display_code 0 no display 1 for display of results only 2 for display of Basis and objective function 3 for display of tableau at each iteration   Description This is a C++ translation of the G.E.(General Electric) LINPRO program. """   def disp_Basis(): print "Iteration No. %d " % LPIter print "Basis Value " # print(" Variable ") for sub_i in range(M): # (sub_i = 0 sub_i < M sub_i++): print " %4d %15.5lf" % (Basis[sub_i], AA[sub_i][0])   print "The value of the Objective function is %11.5lf" % (-AA[M][0] if (opticode == 0) else AA[M][0])#? -AA[M][0] : AA[M][0])   def disp_Tableau(): print "Tableau at iteration : %-d " % LPIter print "Basis Value ", for sub_j in range(1, JLIM): # (sub_j = 1 sub_j < JLIM sub_j++): print "%-8d" % VC[sub_j],   print ""   for sub_i in range(M+2): #(sub_i = 0 sub_i < M + 2 sub_i++): if (sub_i == M): print "%4c" % ' ', for sub_j in range((JLIM+1)*8): # (sub_j = 0 sub_j < (JLIM + 1) * 8 sub_j++): print "%c" % '=', print ""   if (sub_i < M): print "%8d" % Basis[sub_i],   else: print "%8c" % ' ',     print "%12.3lf" % AA[sub_i][0], for sub_j in range(1, JLIM): #(sub_j = 1 sub_j < JLIM sub_j++): print "%8.3lf" % AA[sub_i][sub_j], print     MAXDOUBLE = 1.0e100 if display_code: print "M = %d" % M print "N = %d" % N print "L = %d" % L print "E = %d" % E print "G = %d" % G   K = N + G + M + 1 if (artifcode): JLIM = K else : JLIM = N + G + L + 1 # Check for size of AA, and equation for L, E and G nrows, ncols = matdim(AA) if display_code: print "nrows = %d" % nrows print "ncols = %d" % ncols print "JLIM = %d" % JLIM print "M = %d" % M if ((nrows < M + 2) or ((ncols < JLIM))): LPcode = 1 # Array too small return LPcode elif (L + E + G != M): LPcode = 2 # Inconsistent equations. return LPcode # Check for B for I in range(M+1): #(I = 0 I <= M I++): if (AA[I][0] < 0.0): LPcode = 3 return LPcode # Initialize the Basis for I in range(M): # (I = 0 I < M I++): Basis[I] = I + 1 + N + G   for I in range(M, M+2): #(I = M I <= M + 1 I++): Basis[I] = 0 # Initialize the Variable Header VC = range(JLIM) #(int *) (malloc (sizeof (int) * JLIM)) if (VC is None): LPcode = 7 return LPcode for J in range(1, JLIM):# (J = 1 J < JLIM J++): VC[J] = J # Initialize to zero the surplus and slack regions for I in range(M+2): #(I = 0 I <= M + 1 I++): for J in range(N+1, JLIM): #(J = N + 1 J < JLIM J++): AA[I][J] = 0.0 # The surplus part J = N + 1 for I in range(L + E, M): #(I = L + E I < M I++): AA[I][J] = -1.0 J+= 1 # The slack part of the array (include artificial # part if JLIM == K) J = N + G + 1 for I in range(M): #(I = 0 I < M I++): AA[I][J] = 1.0 J+= 1 if (J >= JLIM): break # Negate the objective coefficients for # maximization problems if (opticode): for J in range(1, JLIM): #(J = 1 J < JLIM J++): AA[M][J] = -AA[M][J] # Compute the last row for phase 1 do_phase1 = False if (G + E == 0) else True # if (do_phase1): for J in range(JLIM): #(J = 0 J < JLIM J++): RSum = 0.0 for I in range(L, M): #(I = L I < M I++): RSum = RSum + AA[I][J] AA[M + 1][J] = -RSum else : for J in range(JLIM): #(J = 0 J < JLIM J++): AA[M + 1][J] = 0.0     Test_Row = M+1 if (do_phase1) else M # ? M + 1 : M maxLPIter = 2 * K for LPIter in range(1, maxLPIter+1): #(LPIter = 1 LPIter <= maxLPIter LPIter++): # Step 1: find pivot column while (1): if (display_code == 2): disp_Basis() if (display_code == 3): disp_Tableau()   # find the most negative number in the test row tempR = 0.0 Piv_Col = 0 for J in range(JLIM -1, 0, -1): #(J = JLIM - 1 J >= 1 J--): R = AA[Test_Row][J] if (R < tempR): if (do_phase1 or (AA[Test_Row + 1][J] == 0)): tempR = R Piv_Col = J if ((Piv_Col == 0) and do_phase1): Test_Row-= 1 do_phase1 = False if (display_code == 3): print " End of Phase 1 " else: break if (Piv_Col == 0): for I in range(M): #(I = 0 I < M I++): if ((Basis[I] >= JLIM) and (abs (AA[I][0]) > ZTOL)): if (display_code >= 1): print "Artificial variable in solution." LPcode = 4 return LPcode if (display_code >= 1): disp_Basis() print "Succesful termination " LPcode = 0 # successful termination return LPcode     # Step 2: Find pivot row R = MAXDOUBLE Piv_Row = -1 Tie_Row = K + 2   for I in range(M-1, -1, -1): # (I = M - 1 I >= 0 I--): tempR = AA[I][Piv_Col] if (tempR > ZTOL) : Ratio = abs (AA[I][0] / tempR) if (Ratio < R): R = Ratio Piv_Row = I   elif (Ratio == R): # break row ties if (Basis[Tie_Row] > Basis[I]): Piv_Row = I     Tie_Row = Basis[I]     if (Piv_Row == -1): if (display_code >= 1): print "Unbounded Solution"   LPcode = 5   return LPcode     if (display_code >= 2): print "Pivot Row: %d, Pivot Column: %d " % (Piv_Row, Piv_Col)     # Step 3: Reduce the array invPivot = 1.0 / AA[Piv_Row][Piv_Col] for I in range(Test_Row + 1): #(I = 0 I <= Test_Row I++): R = AA[I][Piv_Col] * invPivot if (I != Piv_Row): for J in range( JLIM): # (J = 0 J < JLIM J++): if (J != Piv_Col): AA[I][J] = AA[I][J] - AA[Piv_Row][J] * R if (abs (AA[I][J]) <= ZTOL): AA[I][J] = 0.0 AA[I][Piv_Col] = 0.0     for J in range(JLIM): # (J = 0 J < JLIM J++): AA[Piv_Row][J] = AA[Piv_Row][J] * invPivot   AA[Piv_Row][Piv_Col] = 1.0   # Step 4: replace old Basis variable VC[Piv_Col] = Basis[Piv_Row] Basis[Piv_Row] = Piv_Col     if (display_code >= 1): print "Maximum iterations exceeded."   LPcode = 6 return LPcode     def solveLP(A, B, C, L, E, G, qProcessArtificialVars=False, qMaximize=False,display_code=3, ZTOL=1.0e-6): """ Desc Interface to pylinpro. Author Dr. Ernesto P. Adorio Version 0.0.1 July 20, 2013 """ M = len(A) N = len(A[0]) if (qProcessArtificialVars): JLIM = N + G + M + 1 else: JLIM = N + G + L + 1   Basis = range(JLIM) AA = matzero(M + 2, JLIM)   #set the first column of AA. for i in range(M): AA[i][0] = B[i] #set the first column of AA. for j, aij in enumerate(A[i]): AA[i][j+1] = aij # cost coefficient. for j, cj in enumerate(C): AA[M][j+1]= cj return pylinpro (AA, M, N,L, E, G, qProcessArtificialVars, qMaximize, Basis, display_code, ZTOL=1.0e-6)       def Example1(): """ Illustrative example in Bronson. """ C = [1,9,1] B= [9, 15] A = [[1, 2, 3], [3, 2, 2], ] L= 2 E= 0 G= 0 qProcessArtificialVars= True qMaximize = True display_code = 3 return solveLP(A, B, C, L, E, G, qProcessArtificialVars, qMaximize, display_code, ZTOL= 1.0e-6)     def Example2(): """ Using simplified interface. """ A = [[ 1.0, 1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0, 1.0], [ 1.0, 0.0, 1.0, 0.0], [ 0.0, 1.0, 0.0, 1.0], [ 1.0, -10.0, 0.0, 0.0], [ 0.0, 0.0, 6.0, -5.0], [ 2.0, -8.0, 0.0, 0.0], [0.0, 0.0, 2.0, -8.0], [1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0]] B= [100000.0, 20000.0,40000.0,60000.0,0.0,0.0,0.0,0.0,0.0, 50000.0,5000.0] C = [4.0, -3.0, 6.0, -1.0] L = 8 E = 0 G = 2 qProcessArtificialVars = True qMaximize = True display_code = 3 return solveLP(A, B, C, L, E, G, qProcessArtificialVars, qMaximize, display_code, ZTOL= 1.0e-6)     def Example3(): """ #problem 4.3 p. 36 Bronson,"Operations Research" """ A = [[6.0, 1.0], [4.0,3.0], [1.0,2.0]] B= [6, 12, 4] C = [5, 2] L = 0 E = 0 G = 3 qProcessArtificialVars = True qMaximize = True display_code = 3 return solveLP(A, B, C, L, E, G, qProcessArtificialVars, qMaximize, display_code, ZTOL= 1.0e-6)     def Example4(): """ #problem 4.2 p. 35 Bronson,"Operations Research" """ A = [[0.20, 0.32], [1, 1]] B= [ 0.25, 1.0] C = [80.0, 60.0] L = 1 E = 1 G = 0 qProcessArtificialVars = False qMaximize = True display_code = 3 return solveLP(A, B, C, L, E, G, qProcessArtificialVars, qMaximize, display_code, ZTOL= 1.0e-6)   if __name__ == "__main__": Example2()

We think that our new interface function will help OR students in exploring the Simplex code on linear programming problems.

Here is our original pylinpro article

## R functions for linear algebra

July 8th, 2013

We list functions in R for numeric lists, vectors and matrices.

 Create a list(column vector) x <- c(1,4,5,6) Length or size of list length(x) Change to row vector, transpose t(x) Create seq 1,2,...,100 x <- seq(1,100) Create seq 1,4,7, 100 x <- seq(1,100, by = 3) Create seq from start point to end point of specified length x <- seq(1,5, length=100) Create seq from repeat repeat(3,100), repeat(c(1,2,3),2) Sum of list elements sum(x) Product of list elemetns prod(x) Cumulative sum of list elements cumsum(x) Cumulative product of list elements cumprod(x) Factorial of seq 1,..., n factorial(n) Sum of squares of list elements sum(x*x), sum(x^2) Create a rowwise oriented matrix from list x <- matrix(seq(1,9),nrow=3, byrow=T) Create a columnwise(default) oriented matrix from list x<- matrix(seq(1,9),nrow=3, bycol=T) Create an identity matrix of size n diag(n) Create an m by n zero matrix mat.or.vec(m,n) #supply values for m and n! Create a diagonal matrix from list x diag(x) Create a diagonal matrix with common value and rows=m diag(value, m) Extract the element at position i, j x[i,j] Extract the kth column of a matrix x[,k] Extract the ith row of a matrix x[i,] Extract a submatrix rows i-j, cols k-l x[seq(i,j), seq(k,l)] Extract the diagonal of a matrix diag(x) Create a single matrix by appending columnwise cbind(x, y, z) Create a single matrix by appending rowwise rbind(x, y, z) Delete columns or rows of x x[,-c(2,3)], x[-c(2,3),]#second and third columns|rows deleted Add, subtract from, multiply, divide a value v to all matrix elements x + v, x -v, x*v, x/v Add,subtract, multiply corr. elements of two compatible matrices x and y x+y, x -y, x*y Perform modulo and integer division x \%\% y, x \%/\% Matrix multiply x \%*\% y Outer product x \%o\% y Cross product , x' y crossprod(x,y) Transpose of matrix x t(x) Inverse of matrix x solve(x) Generalized inverse of x ginv(x) Determinant of matrix x det(x) Norm of a matrix norm(x, type = c("O", "I", "F", "M")) Solve for x in A x = B solve(A, B) Eigenvalues, eigenvectors E <- eigen(x) # E$values, E$vectors LU factorization require(Matrix) lu(x) Cholesky decomposition chol(x, pivot = FALSE, LINPACK = pivot, ...) QR decomposition qr(x, tol = 1e-07 , LAPACK = FALSE, ...) SVD factorization svd(x,nu = min(np),nv = min(np),LINPACK = FALSE) Means of rows of x rowMeans(x) Sum of rows of x rowSums(x) Means of columns of x colMeans(x) Sums of columns of x colSums(x)

## Logic: Valid Argument Forms or Rules of Inference

July 8th, 2013

ok for use...

Form of Argument Premises Conclusion
Modus (Ponendo) Ponens,Law of Detachment) $p \wedge (p \Rightarrow q)$ $q$
Modus Tollendo Tollens $\neg q \wedge (p \Rightarrow q)$ $\neg p$
Modus Tollendo Ponens, disjunctive syllogism $\neg p \wedge (p \vee q)$ $q$
Modus Ponendo Tollens $\neg(p\wedge q)\wedge p$ $\neg q$
Law of Addition, disjunction $p$ $p \vee q$
Law of Exportation $(p\wedge q) \Rightarrow r$ $p \Rightarrow (q \Rightarrow r)$
Law of Importation $p \Rightarrow (q \Rightarrow r)$ $(p\wedge q) \Rightarrow r$
Law of Hypothetical Syllogism $(p \Rightarrow q) \wedge (q \Rightarrow r)$ $p \Rightarrow r$
Absorption $p\Rightarrow q$ $p\Rightarrow (p\wedge q)$
Law of Absurdity $p \Rightarrow (q \wedge \neg q)$ $\neg p$
Resolution Principle $(p \vee q) \wedge (\neg p \vee r)$ $p \vee q$
Constructive Dilemma $(p \Rightarrow q) \wedge (r\Rightarrow s) \wedge (p \vee r)$ $q \vee s$
Destructive Dilemma $(p \Rightarrow q) \wedge (r \Rightarrow s)\wedge (\neg q \vee \neg s))$ $(\neg p \vee \neg r)$

Examples (from Wikipedia), except starred.

• Modus Ponens
1. If today is Tuesday, then John will go to work.
2. Today is Tuesday.
3. Conclusion:John will go to work.
• Modus tollendo tollens
1. If the watch-dog detects an intruder, the dog will bark.
2. The dog did not bark
3. conclusion: No intruder was detected by the watch-dog
• Modus tollendo ponens
1. Either the breach is a safety violation, or it is not subject to fines>li>.
2. The breach is not a safety violation.
3. Therefore, it is not subject to fines.
• Modus ponendo tollens
1. Ann and Bill cannot both win the race.
2. Ann won the race.
3. Conclusion: Bill cannot have won the race.
1. Socrates is a man.
2. Conclusion: Either Socrates is a man or pigs are flying in formation over the English Channel.
• Exportation
1. It rains and the sun shines implies that there is a rainbow.
2. Conclusion:if it rains, then the sun shines implies that there is a rainbow.
• Importation
1. if it rains, then the sun shines implies that there is a rainbow.
2. Conclusion: It rains and the sun shines implies that there is a rainbow.
• Hypothetical Syllogism
1. If I do not wake up, then I cannot go to work.
2. If I cannot go to work, then I will not get paid.
3. Conclusion: if I do not wake up, then I will not get paid.
• Absorption
1. If it will rain, then I will wear my coat.
2. Conlusion:if it will rain then it will rain and I will wear my coat.
• *Absurdity
1. if it will rain then I will wear my coat and I will not wear my coat
2. Conclusion: It will not rain
• *Resolution
1. It will rain or I will water my garden.
2. It will not rain or I can sit in my lounge chair
3. Conclusion: I will water my garden or I can seat in my lounge chair
• Constructive Dilemma
1. If I win a million dollars, I will donate it to an orphanage.
2. If my friend wins a million dollars, he will donate it to a wildlife fund.
3. Either I win a million dollars, or my friend wins a million dollars.
4. Either an orphanage will get a million dollars, or a wildlife fund will get a million dollars.
• Destructive Dilemma
1. If it rains, we will stay inside.
2. If it is sunny, we will go for a walk.
3. Either we will not stay inside, or we will not go for a walk.
4. Conclusion: Either it will not rain, or it will not be sunny.

[1] http://rip94550.wordpress.com/2010/04/05/logic-tautologies/

## Logic: The truth set of the conditional "p implies q"

July 7th, 2013

The truth set of the conditional p implies q

Given two statements p and q, the conditional (sometimes called material implication) $p \Rightarrow q$ , read as "if p,
then q" is logically true when

1. p is true and q is True.
2. p is False and q is True.
3. p is False and q is False.

In the second case We say that p is necessary but not sufficient for q to be True. For example, if it is sunny then we are shopping at SM and everyone knows that we need money too. Thus p is only a "necessary" but not a "sufficient" condition for q to be true.

The only case where the implication is False is when p is true and and q is false.

Now draw a Venn diagram for P and Q having non-empty intersection. You can see that the shaded area for False is give by $P\cap Q'$ . Thus the truth of the implication is given by $(P\cap Q')'= P' \cup Q$ , using de Morgan's law.

Conclusion: The truth set of $p \Rightarrow q$ is $P' \cup Q$ .

Here is a table of related implication forms.

 Description Form Equivalent Implication $p \Rightarrow q$ $\neg p \vee q$ Contrapositie $\neg q\Rightarrow \neg p$ $\neg p \vee q$ Converse $q \Rightarrow p$ $\neg q \vee p$ Inverse $\neg p \Rightarrow \neg q$ $p \vee \neg q$ Negation $p\Rightarrow \neg q$ $\neg p \vee \neg q$

The implication and contrapositive have the same truth sets. So do the converse and inverse of the implications!