Consciousness

Finding an Automated Algorithm to Solve Hess’ Law II

Posted in Chemistry, Math, Programming by Personalife on the May 24th, 2009

Update: You can see my current progress here. As of now, I have the modified Gaussian elimination completed, meaning part I is now done (unless more matrices break under it). It’s beta code and shouldn’t be considered complete until a battery of linear equations are run against it to check for validity.

Well, it’s been almost one week since I started working on this problem. To start off, I had several great answers from my question posted on LinkedIn, but it was shut down since someone flagged it as “commercial services”, which it really isn’t, but the person who shut down the problem clarified why it was, and that made sense.

Overall, I put out $100 because I wanted to put my money where my mouth was – it gave this problem value to others, and it also motivated me to work on it, as I was putting my own money on the line.

Anyways, I’ll be splitting the $100 to two people who were really helpful with providing their own pseudo-algorithms for this, Viacheslav Usov and Mkrtich Laziev, which helped me find a path towards developing an algorithm to do what I want.

I’ve spent probably over 15 hours on this program and managed to finish 99% of my initial code to solve the matrices that may represent Hess Law equations (I’ll explain why I said may at the end). I’ll never know if it’s possible to solve these problems until I run a lot of problems against the algorithm to see if I can get the expected values.

Then, there’s another issue once I feel I’m done with my algorithm. Although at first I thought I figured out how to translate a set of chemical equations to a matrix, there are some special cases where I cannot fit the equations into the rules that I use to form the matrix. Instead, I have to re-arrange it a bit to have a proper matrix that is solvable.

By the end of this, I hope to:

1. Have a PHP version of my own algorithm for Gaussian elimination with partial partitioning, backsubbing, as well as a least squares algorithm implemented. (99% done),

2. Be able to demonstrate that with any given Hess Law set of equations, that it can be applied to a matrix and that there will be one unique solution (assuming the set of equations has a solution, as textbooks tend to).

Needless to say, it’s been really fun doing this so far. I’ve never been so involved in working with algorithms or math for that matter. I had to do hours of research on linear algebera and figure out with my limited knowledge how to translate scary math notation into code.

Finding an Automated Algorithm to Solve Hess’ Law

Posted in Chemistry, Math by Personalife on the May 17th, 2009

Last week in my chemistry class, I was exposed to Hess’ Law and while doing some example problems in class, I immediately wondered if there was some way to apply linear algebra to automagically solve the equations. I asked my professor if he knew if linear algebra could be applied to solve them, but he said he was unsure since he’s actually not a math person.

I really hate throwing things like that out in class where it doesn’t really apply to what’s being taught (you know, those jerks that ask these stupid wiseguy questions in class just to look like they know more than everyone else), but I just had to get some affirmation if it was possible.

During the weekend I tried to see if I can do it with matrix operations, but I eventually realized that the linear algebra I know is too limited to find a solution. I’ve completely mapped out what the problem looks like, I know how it can be solved via human guess and check, but I really feel there’s a set of consistent mathematical operations that would just give me what I need (kind of like gaussian elimination to solve linear systems of equations).

If anyone knows the algorithm, I will give $100 USD to the first person who does. Note that I’ve also posted this on LinkedIn, meaning whoever is the first, gets it. The algorithm needs to be able to solve all matrices that can be assembled from problems found in Hess’ Law without human intervention (other than inputting initial and final values of the problem). What I’m looking for is an automatic generation of the intermediate Xn values that are required to multiply each row to get the final values.

Edit 1: Piyush Pant discovered that Wolfram Alpha can be used to solve these problems. However, it does not give the algorithm.

http://www95.wolframalpha.com/input/?i=Solve+{w,x,y,z}.{{1,0,0,-3,-1,3,0},+{0,2,3,0,-1,0,0},+{0,0,1,0.5,0,0,-1},{0,0,0,0,0,-1,1}}%3D{-2,4,0,3,0,0,0}

Hess' Law problem

Here is an actual application of this possible algorithm:

Solution: http://www95.wolframalpha.com/input/?i=Solve+{w%2Cx}.{{1%2C3%2C-2%2C-3%2C0}%2C+{0%2C3%2C-2%2C-2%2C1}}%3D{-1%2C0%2C0%2C1%2C1}

Hess' Law Algorithm Application

I have a 1040 SAT and a 123 IQ

Posted in Autobiography, Books, Favorites, Math, Poems, Psychology, Quotes, Random, Songs, Thoughts, Video Games by Personalife on the May 12th, 2009

Creativity cover

Well, 1040 on the old-style SAT, when it was out of 1600. This was back in high school, around 8 years ago when I obtained my results from my first SAT test. My friends were surprised, since according to them, I should have had way better than them (them with 1200+ scores), I was surprised too.

When I was 17, I was administered an actual IQ test that consumed a few hours. It involved memorization, some general knowledge, figuring out number sequences, assembling blocks to some specified shape, oh and drawing your way through a maze. The maze was probably the most memorable, since the rule was if you can complete the first maze (which was beyond easy – the gaps between the walls were WIDE, and the maze was easy enough for an ant to run through in 5 seconds across), without touching the walls with your pencil, you wouldn’t have to do the subsequent mazes.

Guess what I did. I touched the walls. The proctor and I stared at the squiggly line that passed the boundary line of the maze, completely baffled that I had managed to cross the wall with my pencil; we looked at each other blankly with one of us going, “I guess we have to do the rest.”

The rest of the mazes were not fun to complete, and the last one was beyond complicated and tiny, that to this day, I cannot comprehend anyone finishing it at all. It was like being issued the dumb-dumb constellation prize for failing the beginner maze – a larger maze that no one can complete, and you lose points.

Regardless, that maze was a real mistake. At the end of the test, the proctor spent around five minutes doing calculations. In the meantime, I debated whether to know my score or not, and as the title indicates, I choose to know.

For reference, the ‘genius’ level for IQ is considered to be 150 (gifted is 130), while the average is 100.

————

I’m neither genius or gifted, but I am slightly above average. When I learned of my score, I was partially shocked, since I guess I grew up with people telling me that I’m a genius (it still happens to this day).

Since then, I’ve always struggled trying to understand why my talents and abilities do not correlate to scores. As stated in my previous posts, all of this changed for me when I had to take a required class at my university called, Creating a Meaningful Life. On first glance, you would think that the one unit class would be one of those joke classes, that have no real or intrinsic value to your education.

However, I strongly have to disagree. It was probably one of the most important classes in my life. My professor was Kelly Bloom, and she like most of us, was working towards a higher goal in life, which was obtaining her Ph.D, and the book she used for the class was Creativity: Flow and the Psychology of Discovery and Invention by Mihaly Csikszentmihalyi.

Funny thing about the book – at the same time, when I worked at Stanford and ran the Emotion Lab, we were running experiments on inducing a psychological state called Flow. Guess who developed the concept of flow? Csikszentmihalyi.

I was pretty stoked knowing that what I was doing in class actually applied to what I was currently doing at work. We weren’t running experiments in the class though, but we were exploring the concept of flow, how people achieved that state, and what can one to do achieve it themselves.

A lot of emphasis was on flow in the class because Csikszentmihalyi believed flow and creativity had large correlations to success.

Although I never finished the book completely, there was one specific passage that closed my confusion with respect to my own identity as someone perceived to be a genius, smart, but when it came to numbers, there was nothing to show. Despite that, I was able to do many things that no one else can that would earn me such titles:

———–

“The earliest longitudinal study of superior mental abilities, initiated at Stanford University by the psychologist Lewis Terman in 1921… children with high IQs do well in life, but after a certain point IQ does not [matter with success]. Later studies suggest the custoff point is around 120; it might be difficult to do creative work with a lower IQ, but beyond 120 an increment in IQ does not necessarily imply higher creativity.

Why a low intelligence interferes with creative accomplishment is quite obvious. But being intellectually brilliant can also be detrimental to creativity. Some people with high IQs get complacent, and, secure in their mental superiority, they lose the curiosity essential to achieving anything new. Learning facts, playing by the existing rules of the domain, may come so easily to a high-IQ person that he or she never has any incentive to question, doubt, and improve on existing knowledge. This is why Goethe, among others, said that naivete is the most important attribute of genius.”

- Creativity / Csikszentmihalyi p.59/60

——–

That entire passage cleared everything for me – it explained to me that I didn’t need to be a complete genius to be successful. I have enough ’smarts’ and curiosity that allowed me to be creative and look at things differently than everyone else. It’s that combination that leads to success. In the class, we explored the ways we were all or can be creative, and the different types of creativity that existed, and which one suited us best.

And as noted before, I learned about how to address the “What will you be doing in 10 years?” question.

Because of this class, I learned that scores can’t tell the full picture about someone. Someone with a 150 IQ or a 2400 SAT doesn’t necessarily equate to success. What matters more is one’s ability to apply their intelligence, or what they know towards the real world. You can be the ’smartest’ person in the world with the Library of Congress in your head, but it’s useless if you don’t do anything, or know how to do anything with it.

By the end of it, I was much more confident with who I am. Kelly pulled a smooth one on us when we exited our finals for the class, and handed each of us a large rubber ball which had the entire earth embossed on the surface, and told us, “The world is now in your hands.”

It was also the week where she successfully defended her Ph.D thesis, so I replied, “Thanks, Dr. Bloom.”

All in all, we all accomplished something in that class, and learned a significant amount about ourselves.

———-

Expected entitlement is actually a common problem of college graduates. Lots of them think that graduating college will equal this ticket to a job, but what many find out is college isn’t just about the courses you take, but it’s also about connecting with others, developing and obtaining experience from the things you’ve learned. Without the networking capacity or having experience under your belt, one can at most expect getting an internship, or going back to school after graduating  to develop the skills they couldn’t during undergrad because they could not find a job. The bachelor degree is essentially the new high school degree.

I wish that there was some way to properly evaluate someone on their ability to lead, to come up with creative solutions (or problems!), etc. Overall, what society needs is not necessarily IQ, but  also curiosity and the ability to apply knowledge.

Regardless, I’m proud to say that I’m Theo Chakkapark, the person who had a 1040 SAT, and (five SATs later, managed a 1280) with a 123 IQ, who is as curious as a newborn chimp, and has managed to find his way into places like NASA and Stanford, was a 6th grade science and health teacher, developed programs that connected hundreds of people together and has become even more successful and inspired since then.

When someone says I’m smart or I’m a genius nowadays, I reply,

“You’ve got that wrong. I’m just creative.”

——————

Dying To Live – Jonny Lang
Johnny Lang – Dying to Live

You know I’ve heard it said there’s beauty in distortion
By some people who withdraw to find their head
And they say there is humor in misfortune
No, I wonder if they’ll laugh when I am dead

[Chorus]
Why am I fighting to live
If I’m just living to fight
Why am I trying to see
When there ain’t nothing in sight
Why am I trying to give
When no one gives me a try
Why am I dying to live
If I’m just living to die

You know some people say that values are subjective
But they’re just speaking words
That someone else has said
And so they live and fight and kill with no objective
Sometimes its hard to tell the living from the dead

[Chorus]

You know I used to weave
My words into confusion
And so I hope you’ll understand me
When I’m through
You know I used to live my life as an illusion
But reality will make my dream come true

So I’ll keep fighting to live
Till there’s no reason to fight
And I’ll keep trying to see
Until the end is in sight
You know I’m trying to give
So come on
Give me a try
You know I’m dying to live
Until I’m ready to die

Asprin and Acne

Posted in Chemistry, Math, Random by Personalife on the May 6th, 2009

While studying for my chemistry midterm today, I encountered this question:

————-

Aspirin is produced by the reaction of salicylic acid (molar mass = 138.1 g/mol) and acetic anhydride (molar mass = 102.1 g/mol).

C7H6O3(s) + C4H6O3(l) → C9H8O4(s) + C2H4O2(l)

If you mix 10.0 grams of each reactant, how many grams of aspirin (M = 180.2 g/mol) can theoretically by
obtained?

a. 7.30 g
b. 7.66 g
c. 9.32 g
d. 12.7 g
e. 13.0 g

————

Reading that, I went to myself, Waitaminute, isn’t salicylic acid one of the main active ingredients in acne medication? So, if asprin contains salicylic acid, is there a way to use it for acne treatment?

And apparently there is.

“The active ingredient in aspirin is acetylsalicylic acid. In the presence of water at a neutral pH, this compound will hydrolyze to salicylic acid and acetic acid to a very small extent. It is likely that aspirin masks are only safe because this hydrolysis is very minimal in water of a neutral pH.

It is precisely because salicylic acid is lipid-soluble that it is so effective treating acne at very low concentrations. The acid is able to dissolve in the sebum and penetrate into pores to exert its exfoliating effects. ” – Anon (General consensus found in various places says this)

—————–
So there you go. Asprin can be used to treat acne. I guess I should work out the problem since it’s here:

1) Find grams of asprin with 10.0g C7H6O3 (molar mass = 138.1g/mol)

10.0g C7H6O3 * (1 mol C7H6O3 / 138.1g C7H6O3) * (180.2g asprin / 1 mol C7H6O3)

= 13.05 g asprin = 13.1 g asprin

2) Find grams of asprin with 10.0g C4H6O3 (molar mass = 102.1g/mol)

10.0g C4H6O3 * (1 mol C4H6O3 / 102.1g C4H6O3) * (180.2g asprin / 1 mol C4H6O3)

= 17.65g asprin = 17.7 g asprin

3) Which produces the least amount of asprin?

C7H6O3. So, 10.0g of C7H6O3 and 10g of C4H603 will only give 13.1g of asprin.

Answer E.

Stupid Chemistry I: I know, I’m a chem major.

Posted in Chemistry, Random by Personalife on the May 5th, 2009

http://answers.yahoo.com/question/index?qid=20081007173812AAlybKT

Q: Which element, isotope, or ion has 33 neutrons and 27 electrons and how do you know?
———–

Best Answer – Chosen by Voters
ibuprofen
commonly known as advil

Source(s):
chemist for 27 years
majored at university of michigan

———–

The funny thing is, the actual answer was the first real response:

———–

it is cobalt-60.
in order to find this:

the number of electrons in an atom = the number of protons
thus, since this isotope has 27 electrons, it also has 27 protons. The number of protons in an element is always constant. The element with the atomic number of 27 is cobalt.
in a ‘normal’ element, the number of protons usually equals the number of neutrons; however, when it does not an isotope forms.
thus the atomic mass is 33+27 = 60

——————-

I hope if I’m a chemist for 27 years, I’ll know that Ibprofen isn’t an isotope, an element (its a composition of), nor is it an ion.

Do you use analytic functions?

Posted in Math, Oracle, Programming, mySQL by Personalife on the May 4th, 2009

I’m currently programming a who’s online for leads at work, and was having lots of difficulty in getting the results I needed to properly display the most recent activity.

We have three tables that need to be looked up due to the way the schema was designed. The primary table is a user_log table that stores all actions that a user performed along with a timestamp. However, this log table does not include any user information aside from a user_id. So, to get the information about a user, we need to join that user_id to the user_id in a users table.

But, here’s where it gets really messed up – the users table doesn’t contain the information we need. Instead, it has a contact_id field in the users table, which must be then joined to a contacts table.

So it goes like this:

.. WHERE user_log.user_id = users.user_id AND users.contact_id = contacts.contact_id

Yeah, three tables just to get contact information.

I was finding that the standard SQL Distinct/Group By keywords were proving ineffective in getting the results I needed, which would be to just give me one user_id and the most recent created timestamp in the user_log table. Instead, I was getting multiple rows for the same user_id.

Fortunately, I found out about analytic functions in Oracle, which helped me isolate out unique user_ids and get the latest timestamp for that user by using ROW_NUMBER( ) where the sequence_number = 1 (giving me the topmost result for each user_id).

Unfortunately, I also learned that mySQL does not have analytic functions built in, but it can be emulated in native SQL (Part 1) (Part 2).

The best explanation I can give about the common aggregation functions that most people tend to use like SUM(), AVG(), etc vs analytic functions is:

Assume you have a set of rows.

The aggregation function will take that set of rows and output only one row with the results, while an analytic function will output that set of rows with the results appended.

The analytic functions do not have to work this way, but it’s useful for performing ranking analysis or sorting rows into individual sets of results.

This year’s goals I

Posted in Favorites, Projects, Thoughts by Personalife on the May 3rd, 2009

“Brick walls are there for a reason. They let us prove how badly we want things.” – Randy Pausch

Well, it’s almost the half-year mark in terms of my goals. What are the goals for this year? I’ve broken them down into mental and physical goals.

Mental
1. Take three chemistry classes.

To get my chemistry degree, I need seven classes total. I only have enough time to do three in one year due to being a full-time employee. So far I’m in the second Chemistry class, and am going to do the third in the fall, since I cannot do the tight schedule required for a summer session.

2. Be more normal.

What I mean by normal is being able to have some kind of common grounds with people in general. Lots of the people I know like to talk about sports, movies and/or music. So far I’ve tried having a Netflix account, and I watched around six movies which I can now barely recall what I watched, but I found myself struggling to force myself to do it, and it just didn’t work out in the end, so I canceled the subscription.

Now, I’m trying music by purchasing a Zune Pass, which lets me access pretty much almost any song/album, and that’s going a bit better. I’ve found that I like Erasure, P!nk, Lily Allen, Miley Cyrus (it seems like anything that comes out of Radio Disney, I’ll like), and The Veronicas, just to name a few. I think this will be more successful because I can do other tasks while listening to music, whereas with movies, I have to pay complete attention or I just won’t get it at all.

Physical
1. Get my teeth aligned.

As with many asians, I have crowded teeth, and have wanted to do something about it for the longest time. Now that I can actually afford it, I’ve spent money on getting Invisalign. So far, my orthodontist has installed a Rapid Palette Expander, which should expand my upper jaw, but it seems to be having issues. I’m not surprised since once you’re past 18, the suture between the two halves of your jaw fuse together, making expansion difficult without surgery. I’m thinking I’ll have to get some teeth extracted since the RPE doesn’t seem to be doing what it should be. Also, having the RPE in has left me with a slight lisp which is annoying at times when I speak to new people because it makes me sound a bit ‘off’.

Overall, this is on track, like Chemistry.

2. Use summer to engage in more physical activity.

Although I’m thin as a stick, I’m not toned, and would like to be, or at least not have a belly. I haven’t decided how this will play out, but I’m leaving the summer open for these things.

Other
1. Buy a home.

My goal is to save $50k by November, but it seems that it’s going to be $40k based on my expense rate. I’m halfway towards that goal, and spoke to a real estate agent yesterday who instructed me to be serious about looking for a place to by in August (90 days from intended purchase). After lots of evaluation, it seems that I would be living in San Jose in southern bay area, since housing is the cheapest there. I’d like to be more closer to Palo Alto, but I think that’s as good as it’s going to get.

2. Pull out a v1.0 of BlueJot by end of Summer.

Going to try my best, but it’s a low priority.

Rationale

The beginning of the year left me with trying to figure out what to do next now that I’ve established myself in my field, having a successful job, and missing school. I thought about how I’ve felt not ready for many things despite these successes, and what I can do about them.

Things I don’t feel ready for:
1. Relationships
2. Having a place I can call “Home”; a place where I can be creative and do my mad science
3. Being a mad scientist / geneticist

Powered by WordPress .::. Designed by SiteGround Web Hosting