Skip navigation

As promised in my tweet, I am doing some of ProjectEuler now. I first started it some time ago, doing problem #1 using Scheme, but now I’m going through them, in order of “difficulty” (the more people who have finished, the easier) In various programming languages. For today I have my solution to problem #2 in Ruby.

Find the sum of all the even-valued terms in the sequence which do not exceed four million. Sounds simple enough, right? Well it is.

At the time of my tweet, I had the following solution, it was on the right track, but it was ever so slightly off.

counter = 0

fibo = 1

fibo2 = 1

while (fibo + fibo2) < 4000000

	if (fibo2 % 2) == 0

		counter += fibo2

	end

	fibo2 += fibo

	fibo = fibo2 - fibo

end

print counter

So I decided to first write out plainly a function that would plainly compute fibonacci

def fib(a,b)
	c = b
	d = a + b
	return c,d
end

So when I did it for getting the answer I ended up using that function, with the following code for execution:

counter,num1,num2 = 0,1,1
32.times do |i|
	num1,num2 = fib(num1,num2)
	if num2%2 == 0
		counter += num2
	end
end
puts counter

Which admittedly isn’t fair, since you have to know that the 32nd Fibonacci is the last one below 4,000,000.

But this got me thinking, and I started cutting and shortening, cutting and shortening until I was able to reduce it quite a bit. I took out the function definition, and left that to a single line of logic, as well as compounded it so it would calculate three at a time, since every third number in the Fibonacci sequence is even. The end result:

counter, a, b = 0,0,1
while b < 4000000 do
	a, b = a+2*b, a+2*b, 2*a+3*b
	counter += a
end
puts counter

I’m fairly certain I can cut it down some more, but I feel like I’ve already done a fair job of it so far, so I will move on to either implementing this in another language, or Euler #6.

In my present study of German, as happened while I was learning Spanish, I became more aware of certain features of English, things that I just did because that’s what I knew to do. This is just what happens with familiar languages, particularly someone’s native language. They think in that language, and have a brain wired to put the component parts together.

Evidence of this can be seen by using a very simple rule to determine if the grammar of a phrase is correct. Does it sound natural? If it does, it’s probably right, if it doesn’t, it’s usually wrong.

Last night I stumbled on this page about adjectives in English. The first part talked about adjective order, to which I responded, “I don’t remember learning anything about that in school!” While this may have been the case, or I might have just forgotten, because without studying the proper order, I was able to take some online quizes testing this at 99% accuracy just by judging if it was natural or awkward.

One example I found that appears to be related is from a commercial put out by Sprint for its mobile broadband product. (you can hear it if you want http://audio.wwl.com/m/audio/22435241/6-5-9am-jim-hawthorn.htm?pageid=238910&seek=179) The annoying part is a certain word choice at “Your crew gets what’s most important to them whenever they need it. Practically instantaneously

My problem is the bold portion. When I first heard it while in the car, I stopped listening after that point due to the awkwardness. I tried to think of better constructions and came up with two alternatives. “Practically instantly” which is a slight improvement, and “Practically in an instant” which sounds much more natural. On top of that, my second solution emphasises the immediately following words “an instant internet…”

Another aspect of language that is intuitive are the existance of certain common elements to similar words in languages developing separately. Like how the term for “Mother”/”Mom”/”Mama” in American English, particularly the equivalents of the last, are typically represented by “easily pronounced syllables”, because that’s what babies first learning to talk are able to do. While not enough to divine the key to translation between the two, it gives insight on how concepts are formed in the mind and how a language develops into existance.

If there is any one thing I like, it’s books. I love just having a book. It’s my favorite gift to receive(though I don’t really like gift cards to book stores) or give. It’s the reason I got my Sony Digital Reader. One of the great things now is the networking that exists through books.

My Library as it is now

My Library as it is now

About one and a half years ago, I joined goodreads, and it’s so great. It’s main use is for communicating books you’ve read, want to read, and mainly what you’re reading now and then network with others based on the books.

More recently I found LibraryThing. It’s different in that it’s oriented towards books you have, which is how I use it. It has a limit for a free account to 200 books, which is more than my current library, but if it comes to it, you can get a monthly or lifetime membership at a reasonable, variable rate. The great thing is you choosing how much, $1-20 per month, or $19-55 for lifetime.

My current profiles for those are located here for LibraryThing and here for goodreads, which will soon be placed in my links section, as well as links to my Amazon Wishlist, Picasa gallery and other similar things.

While I’m actually writing something on the ElementalComputing blog, I might as well give some news about myself. I have been mulling for a little bit recently(you would know if you follow me on twitter) about foreign languages, and for at least a year I have always wanted to get started learning a language for the purpose of reading literature in said language. Well, I’ve finally decided on which to learn. The final three contestants were Latin, Italian, and German with German winning. I remember starting this mini German course in the 6th grade, which I dropped out of after a week due to it conflicting with participating in Mock Trial. This past week of teaching myself has been interesting and fun. One thing I decided to do just today was to start writing/speaking bits of my journal in German.

Overall it should be a fun experience. Auf Wiedersehen!

For now I’m taking my multi-blogs and reducing it down to this one.

To start this I’m going to talk about copyright law. My biggest issue with the lengthened terms of copyrights in the United States deals with translation of works into other languages in relation to social relevance. Take this scenario:

I write a moderately succesful novel when I am about 35 years old. My publisher or I decide that we will retain the rights to translating this into other languages and do not translate it ourselves. I die 45 years later. Now, assuming someone in France is waitng for the copyright to expire 70 years after my death and immediately publishes a translation, and the translator just happes to be 35 at this time as well.(and similar people are around the world, translating), and also die 45 years after the translation. It would come into public domain in French 230 years later. 230 years ago, my great-great-great-great-great-granfather(7 generations back) was giving supplies to revolutionaries in the American Revolution.

By the time my novel arrives into public domain in other languages, it has lost significant relevance. You tell me, does this sound reasonably “limited”. Proponents of copyright extentions in the U.S. claim it’s up to congress to decide how to define “limited”, but my claim is there has to be reasonability, which is not the case. I even remember once reading someone suggesting it should last forever minus one day. This to me is scary.

The second factor with translations is the difficulty of creating quality translations. Many classic books that have been translated have multiple available translations, each having a different quality, if there is a licensed translation, there is only one quality available, which should be questioned.

Obviously I think there should be translation competition, as well as opportunity of the translators to communicate to the original author to understand their mind while retelling their story in another language, and while authors decide to be unaware of this issue in this, the supposed “Age of Information, but you can’t use it yet”, we will continue to not use a fraction of the potential of the technologies available. Movable type revolutionized the spread of information in the time of Gutenberg, while copyright laws try and take a step backwards.

With that said, if I ever write something, I plan to open it to translating, as long as the translator is willing to negotiate some sort of shared license between me and them, and in addition arrange for my works to move to completely open licenses when I die.

So I managed to locate my math notebook and I figured I would just transcribe it, and since I’ve described the solution in Math Problems already, I’ll give it directly.

If a part of an equation becomes such as x^x=c; where c is a non-zero, complex number, you can determine x with a manipulation to the form x = c^(1/x), x can then be solved by reforming this equation into a method such as :

c^(1/x0)=x1, c^(1/x1)=x2, c^(1/x2)=x3…c^(1/(xInfinity-1))=xInfinity

It is determined that, lim n->Infinity c^(1/xn), which can be manipulated to the form c=xn^xn and c=x^x where x=xn. This method works as long as the initial x value, x0 is any non-zero, complex number.

For Example. If x^x=9 => 9^(1/x)=x => 9^(1/x0)=x1, where 2 is assigned x0. 9^(1/2) = 3, 9^(1/3) = 2.08008, lim n->Infinity 9^(1/xn) = 2.450953928 where 2.45…28^2.45…28=9

So its been a little bit since I’ve posted that math problem. Unfortunately I’m having trouble finding my notebook that I have my personal formal answer for the problem, so I’ll try to do it from memory.

Like I said, when I tried to use logarithms, at least with my knowledge, I could never get x solved for. There is one way though.

As long as y is a complex, non-zero number this should work. First make an estimate(also complex, non-zero), preferably one that is reasonable, as that improves accuracy, we will call this X0. Now take the X0 root of y, this answer we will call X1. Now take the X1 root of y. You can stop here and take the mean of X0 and X1 to get a fairly good estimate(usually), or you can continue the process as I like to say, lim n->infinity of Xn root of y where Xn= X(n-1) root of y.

Hopefully that all makes sense, and if I ever find my formal definition, I’ll post it.

Okay, so this one is a little different, so let me explain something first. Back when I was still in high school and was taking Calculus, I would frequently just mess around with my calculator, a reliable TI-83 plus. I was messing with powers in a way that I *thought* would eventually lead whatever I put in to 0, but I misentered it.

I found that it would eventually come to a certain other number, depending on the starting value. I checked it and realized my mistake, but I was curious as to what exactly was happening, so I fiddled some more.

It turns out that I had figured a way to solve for an interesting equation by accident. To this day I don’t know of a better way to solve it, though one may very well exist.

So to start this off, for now I will just put up a challenge for coming up with a non-graphical solution (that is, one that doesn’t rely on guesstimating off of a graph.)

The equation is simple. In TI notation its x^x=y, solving for x. (that is, for clarification, “X to the X power equals Y”). Y can be any number, as long as it is complex and non-zero.

Good luck! In a couple days I’ll post my solution.

I program, that’s what it is that I’ve been doing. For the past two years I thought programming would be my future and now I’m not so sure. So I’m pushing the concept of “Elemental Computing” to a new level and at the same time splitting it up.

I introduce, Elemental Thinking (http://elementalthinking.blogspot.com), an additional blog created by me.

Now I know I don’t post on Elemental Computing much, so I’m making a new blog? Well, I’m also creating a third one as well, but we wont get there.

What has been happening is a period of my life, at the young age of 20, of deep reflection. What have I accomplished thus far? Where do my talents lie? What do I really enjoy doing?

So what does this have to do with my “Elemental” blogs?

I’m expanding the computing side to a more broad definition, one that more overlaps thinking than just “those electronic computers”. The more logical side to be precise, while the more creative, emotional side for the thinking half.

The final part to look at is the shared component “Elemental”. Everything is composed of component elements. Whether the classical Fire, Earth, Air and Water of Greece — which describe four states of matter — or the periodic table of elements, or even the quarks that make up sub-atomic particles and beyond.

Each expresses that everything is made up of something smaller, something simpler. Elemental looks at finding the simplest way to express the concepts, and in terms of this blogging network, the simplest expression of logic and thought.

As for programming, it looks like I may end up dropping it as a profession. This is good for me, because happiness is the trump, bad for the programmers, because you lost a good one. But don’t worry too much, I won’t abandon it completely.

I’ve been hearing in some news somewhere recently concerning the advancements of emotion in Artificial Intelligence. This was mainly in the direction of questioning whether us humans would ever begin to have meaningful relationships in the future with robots. Read More »

Last semester while attending my university I worked as an evening janitor, not something I would consider “aiming towards my future job”. Fortunately, this semester I was able to get a programming related job, as a Flash Programmer/Designer. While I had never worked with Flash prior to this, because I was studying Computer Science, and I had shown that I had taught myself in the past, they hired me.

However, most of my time hasn’t been spent doing Flash or ActionScript. There is a pet project in the works to create an in-house development tool using Flash and mdm Zinc. This requires the ability to generate as well as import existing SWF files in order to work on them. For this we are looking towards the Ming SWF library, and converting that into a DLL that is compatible with mdm Zinc 3.0. Thus, almost everything I’ve done to this point has been in C working on getting that library turned into a DLL. Which has also proven to be more difficult than I thought, particularly since I’ve done so little with DLLs.

However, now I’m working more with ActionScript while that project gets put on hold for a bit. Now I get to work on revisiting and enhancing an older project, a flash Math Lab, where you can practice math from some lessons. The primary component of the revamp is integrating the ability to render mathematical equations.

All in all, I enjoy it, particularly the fact that I am closer to programming that I was before.

Follow

Get every new post delivered to your Inbox.