Category Archives: Personal Rantings

Reading Nonfiction Books Quickly

I like to read books and I also like to read nonfiction books and in particular nonfiction books that I do not agree with.

Speed Reading

For this I’ve decided to look into speed reading. It is an umbrella term for methods that increase your reading speed while keeping a satisfactory comprehension level. A usual reading speed is 200-300 wpm (words per minute). Speed reading advertises increasing your speed to > 600 wpm.

I’ve searched around for a bit and read lots of blog posts and articles and here are my favorites:

http://www.fourhourworkweek.com/blog/2009/07/30/speed-reading-and-accelerated-learning/ is a good introduction to the main techniques of speed-reading. It also includes some exercises and is a short read.

http://noahfleming.com/blog/speed-read-like-rain-man-75-increased-reading-speed-in-20-minutes describes the author’s personal experience with fourhourworkweek’s article.

There is also speed-reading software available. The idea is your eye movement is the main hindrance to reading really fast, so this software displays the text for you to read in groups of several words in the center of the screen. This way you can read everything at once without having to move your eyes at all.
As crazy as it sounds, it works to a great degree.

http://www.spreeder.com/ is  an online reader that works this way. Give it a try! You can make it display the introduction text at 600 wpm or 800 wpm and see how you’ll understand – you’ll be surprised!

‘The Speed Reading Workbook’ is what I’ve been using to practise it. It’s okay written and has plenty of exercises and includes timing and evaluation sheets, which are really useful for measuring your progress.

A good summary of many concepts can be found in the PowerPoint Presentation ‘Double your Reading Speed in 25 Minutes’.

About Reading in General

http://www.matthewcornell.org/blog/2006/2/26/how-to-read-a-lot-of-books-in-a-short-time.html is a good read and http://pne.people.si.umich.edu/PDF/howtoread.pdf has many good suggestions about how to increase your reading productivity.

Own Expierence

I’ve been exercising with the workbook now and then for the past weeks and I’ve become faster but this is still an ongoing process for me, so I’m going to blog about it later (or rather update this post).

For what it’s worth: my reading speed was 300 wpm and now it is around 550 wpm :-)

ANTLR Stupidity (Warning 209)

I’ve been playing around with a Java grammar for ANTLR that was supposed to work straight-away but it did not, with very strange warnings and errors, that made it look like ANTLR only supports lexers with a lookahead of 1 character:

while STAR matches only ‘*’ and STAREQ only matches ‘*=’. This is a huge w-t-f, especially if you have worked with ANTLR before and didn’t have issues with this. This also contradicted all documentation you can find about ANTLR and its lexer rules.

I’ve spent a considerable amount of time with Google trying to find how to fix it. First I’ve found lots of posts on the ANTLR mailing list [antlr-interest] from people who had the same issue and no replies to them (really helpful, eh?). People had issues with replacing character ranges with unicode ranges (or rather a huge list of unicode characters), which probably caused the problem in my grammar, too. Others found that ANTLR suddenly behaved as if it only had a one character lookahead, but only if more than 300 lexer rules were used in the grammar.

After searching for a long time and almost giving up on the mini-project I’ve wanted to use ANTLR for, I’ve found this post: http://www.antlr.org/pipermail/antlr-interest/2009-September/035954.html (which matches my problem more or less but with additional insight)
and someone even replied (someone being the guy who maintains the C runtime of ANTLR):
http://www.antlr.org/pipermail/antlr-interest/2009-September/035955.html

If you are sure that the messages are not correct and the lexer rules
are not ambiguous, then you probably need to increase the conversion
timeout:

-Xconversiontimeout 30000

if that does not work, then there is a conflict in your rules.

Jim

And that turns out to be the right advice and the remedy to my problems and the problems of lots of other people probably.
However, no warning or error message I encountered mentioned that ANTLR’s internal processing actually timed-out and there was no ambiguity in the grammar itself…

This comes to show that any good tool like ANTLR can quickly degrade to a piece of crap and a major source of annoyance, if error and warning messages aren’t clear and helpful.

On further investigation, you can trigger warnings that the conversion times out:

but not consistently. I guess this is a bug – either in ANTLR or in ANTLRWorks… :-|

Limbo

Limbo is a game that has been released on Xbox Live Arcade some time ago, but I’ve only now found time to play it.

It is a very nice game – albeit a bit on the short side: it took me about 5 hours to finish it. But this is the only negative bit I can think of. Everything else about the game is very nice. It is very polished and it’s a charm to play. You have to think about the puzzles for some time but the learning curve is okay and there were no unfair bits.

The game is black-and-white only (with shades of gray) and you play a boy that apparently got lost in a forest (this is how it starts) and you want to get out.<

The game mechanics are very simple: you can only move around, jump and hold on to things to drag them around (or press buttons, etc). In this regard the game is very similar to Another World (another very good game worth playing).
The puzzles are all phyiscs-based and because of this the aforementioned fairness is achieved: sometimes you just have to think a bit longer how to solve a puzzle but it is always logical.

The game is somewhat violent because it works using the “learning by dying” principle and if you don’t enable the gore filter, you’ll see the poor boy being halved, stabbed, squashed,… many times. However, since he is only a black shape, it’s okay and won’t put you off playing. The game uses many (and only) auto-saves to track your progress and you never feel punished for dying because you’ll get another try straightaway without having to replay more than a few seconds.

“Learning by dying” works really well (and is also used in Another World): You don’t have to worry about a “health bar” or rewind time or…

The difficulty of the game is just right and it gets harder as you progress through the world: you get to use more objects to solve the puzzles or will have to think of new ways to use physics to achieve your goals. However, one annoying bit is that also autosave points get moved further apart even when there is no need for it. This only happens in the last few “chapters” of the game though.

All in all it is very much a game worth playing and a very polished experience – kudos to the developers!

Panorama Stitching

I’ve finally come around to “clean-up” some old project I’ve had lying around for a few months and upload it.
I’m talking about some Panorama Stitching code I wrote for our participation in Microsoft’s Imagine Cup.
I’m suppressing all memories of it since it was an epic fail, but at least I still have learnt quite a bit about computer vision and image processing – enough to know that it’s incredibly hard to come up with stable algorithms and kudos to anyone working in the field.

Here is the code dump: PanoramaStitching.zip

It contains many small projects which usually use multiple pictures as inputs or multiple webcams (depending on code or chosen preprocessor macros).

The most advanced prototype is the SnapshotHomographyConfigurator, which allows you to determine homographies between multiple cameras at once by marking shared points between the images.

Another one which works okay is the PanoramaStitching project. It creates panoramas using spherical or cylindircal projections of the input images. However, it is very sensitive to translations of the viewpoint. It works quite well with optimal/artificial images:

(Note: the small misalignment on the right stems from moving the player position slightly. Usually you use a deghosting algorithm to remove such misalignments.)

I’ve used OpenCV for image processing and yaml for loading and storing settings (and also rapidxml). OpenCV’s C++ wrapper is pretty awesome. It’s not perfect but it makes life a lot easier.

Stay tuned for more code/project uploads soon :-)

PS: Here are the links to some papers which proved useful to me (I didn’t implement most of them though, and some are implemented in OpenCV already):

Random Things

It’s been a while since the last update. Here’s a small update on what I’m thinking about various stuff.

Prototype

Gameplay is okay I guess. Nothing I would spent too much time on though. It looks a lot worse than GTA 4 though (same as Crackdown).

Resident Evil

Seems to be lots of fun and some nice graphics, too.

Red Faction: Guerrilla

Some weird texture filtering issues and the presentation doesn’t knock off my chair (terrain popping and other ugliness), but multiplayer is loads of fun with friends. Physics isn’t completely stable though. I played the game for one hour in MP with friends and there were quite a few cases where geometry dropped through the floor with enough pressure from above (after destroying a building).

Brüno

A bad and quite stupid movie (Ali G in Da House is probably the only movie I kinda like that stars Cohen). If you haven’t watched it already, don’t >_<

Shadow Complex

I bought shadow complex a few weeks ago and I have to say that it is an awesome game. I read somewhere that the developer used the Metroid series as inspiration and it shows. It’s really fun to play and quite addictive. The graphics are pretty awesome (it is using the Unreal 3 engine) and the whole presentation is pretty polished. It certainly is worth its 1200 gamerpoints

Summing Formulas

A month ago I was doing some exercises in an analysis book (Königsberger) and found a nice/interesting problem:

Prove that if we denote of the sum of the numbers 1 to n to the p-th power by $$ S_n^p = 1^p + 2^p + … + n^p $$, then the following equation by Pascal holds: $$ (p+1) S_n^p + \binom{ p + 1 }{ 2 } S_n^{p-1} + \binom{ p + 1 }{ 3 } S_n^{p-2} + … + S_n^0 = (n+1)^{p+1} – 1 $$

It can be used to get recursively/iteratively get formulas for sums of higher powers of numbers.

This is interesting because the proof doesn’t need any advanced maths (like eg the Euler-MacLaurin formula, which can be used to show this, too).

You can download the proof and a few examples here.

Cheers

Extracting Information from StudiVZ

Some time ago somebody stole 1 million data records from StudiVZ, the German Facebook clone. I’m not exactly sure why people call the person a hacker who stole data, because it appears he simply wrote a tool that harvested the publicly available data from StudiVZ (which everyone with an account can view).

People on StudiVZ share all their data by default—contrary to Facebook which values a person’s private data a lot more. Thus by simply opening each profile from a dummy user and processing the HTML data from StudiVZ one can extract a lot and some more information from random people who probably don’t even know about it or don’t care.. so I’m not sure about the stealing part.

Apparently there are some captcha’s when you start browsing searches beyond a few pages. I guess that is where the hacking part comes in, because getting around a captcha probably constitutes hacking—maybe?

Anyway I think part of the media coverage is a bit ridiculous because anyone can write a simple harvester in an hour or two. It took me one and half hours, so I think I’m on the safe side with this estimate and I didn’t really have a clue about this stuff before either.

Since I don’t want to “hack”, I’ve only written a very tame harvester. It connects to your personal StudiVZ account, and retrieves the name and profile ID (and thus profile URL) of all your friends in the “Meine Freunde” pages.

It could do a lot more with that like retrieving everybody’s birthday or random pictures, but I’m too lazy to code that because you use the same pattern for extracting data over and over again and it stops being interesting quite fast.

You can download the project here. It is a one file C# project. I’m releasing it under GPL (whatever).

It’s really easy to explain how it works:

  • It uses System.Net‘s HttpWebRequest and HttpWebResponse to get (and post) web pages.
  • StudiVZ (like every other portal) uses cookies, so I create a CookieContainer and use it in every http request.
  • There are a few hidden values that StudiVZ expects during login. I’m retrieving them from the main page using custom built regular expressions. I’ve found a handy AJAX tester for .NET regular expressions. It was really useful for building the expressions and debugging them. (BTW you can find all URLs I used in the comments.)
  • After login I use the same pattern: get page & parse using regex for everything.
  • Visual Studio has an awesome “HTML Visualizer” for strings. It displays the content of a string as HTML page, which is really nifty if you’re doing anything related to HTML processing.

The code is quite ugly. Well, it’s not production code and this is only meant as a proof of concept.

Also note that I have at most violated the AGB of StudiVZ and not committed any criminal acts and I’m not planning to sell my friend’s profile IDs or data either :-)

Maybe someone can extend the code and make it more useful. I guess it would be fun to automatically download all your pictures (including tags) and feed them into flickr or picasa… but someone else can do that.

Cheers,
Andreas

My Bachelor Thesis

Screenshot of Utah

Screenshot of Utah

For the last two months I have been working on my bachelor thesis at the Chair of Computer Graphics and Visualization. It is about “Multi-Tile Terrain Rendering with OGL/Equalizer”´.
The chair has a very nice Direct3D 10 terrain rendering engine and they want to run it at the newly founded KAUST (King Abdullah University of Science and Technology´) in a massive CAVE environment. A CAVE is a room whose walls are actually screens.
The CAVE at KAUST even supports stereoscopic rendering. Thus in total 12 views can be rendered to.

My job was to port said terrain engine from Direct3D to OpenGL and afterwards to the Equalizer framework, which is an open-source framework for parallelizing OpenGL applications.

You can find/download an online version of my bachelor thesis here. I’ll upload the LaTeX at a later date and update this post.

I’ve spent the last months writing about all this, so I don’t feel like talking about the thesis itself anymore. Instead the remainder of this post will contain a post-mortem of it.
Continue reading

More Book Reviews and re: Design Patterns

Pattern-Oriented Software Architecture – A System of Patterns (PoSA I)

I’ve finally finished Pattern-Oriented Software Architecture – A System of Patterns and I want to say a few words about it.
First I don’t think, it’s a must-buy. It’s okay to read (but more about that in a minute) and certainly it can come in handy to look up patterns while developing, but if you have small budget, it’s better to get it from a library.

The book can be roughly divided into 4 parts: architectural patterns, design patterns, idioms, “trivia”.

The chapter about architectural patterns is the most interesting,  where as the chapter about design patterns is okay, too, but also borrow or expands upon lots of concepts from the GoF book. The idioms chapter only contains one idiom (think small, language-specific “design pattern”, e.g. reference counting in C++).
The “trivia” part contains information what pattern are, who came up with the idea, influences, the community, yada yada. The most interesting topic being the community and links in there.

The book itself is quite boring to read and the patterns are described in endless detail, which is good, if you want to look things up and avoid common mistakes. On the other hand this makes it a book, you should not read front to back, because it doesn’t really make sense and you won’t get a lot out of it either. (I actually read it front to back, and from that experience I draw my advice :-|) Just skim over the patterns, until you find something you don’t know and then read the paragraphs that are interesting until you think you understand the pattern and then read some more to verify that you really understand it, but you can probably skip 40% (or more) of the text, if you just want to learn about new patterns and not go into all the details.

Next I’ll try to write a few words about each pattern (so I´ can look up the pattern here instead of in the book)´.

Note: I just found an awesome page, http://vico.org/pages/PatronsDisseny.html, that contains information about all patterns in the book, so it doesn’t make sense for me to write about each and every one of them.

Architectural Patterns

  • Layers
    To sum up 20 pages: it’s good to use a multi-layered architecture in your software.
  • Pipes and Filters
    This is something Pragmatic Programmer mentioned, too: Use and support the usage of your tools through pipes and filters. This is mainly something that is common on Unix, but it’s incredibly useful and if you support some standard text I/O helps interoperability with little cost.
  • Blackboard
    Finally an interesting pattern, it’s also described in Pragmatic Programmer, but you can read the description here, too, because it’s a quite interesting pattern.
  • Broker
  • Model-View-Controller
  • Presentation-Abstraction-Control
    This one is interesting and worth having heard of. It’s similar to MVC above, but more general.
  • Microkernel
  • Reflection

Design Patterns

  • Whole-Part
  • Master-Slave
    Anyone who has ever done parallel programming with MPI has used this pattern extensively
  • Proxy
  • Command Processor
    expandable:more#A more elaborate version of the Command patten in the GoF book
  • View Handler
    The pattern describes how to design a document/view manager
  • Forwarder-Receiver
  • Client-Dispatcher-Server
  • Publisher-Subscriber

Idioms

  • Counted Pointer

Now that I’m done with this, I want to share a few useful resources mentioned in the book:

Personally idioms are very interesting for me, too, because the day-to-day coding work is in a specific language and idioms are exactly about that.
A little googling already turns up lots of useful sources. For example:

There are a few more pattern books that I plan to read, so let’s see how that turns out..

A Manual for Writers of Research Papers, Theses, and Dissertations

This is an awesome book, that explains a lot about how to write research papers and also about all the little details you should pay attention, too. It’s a good read – I spent 1.5 hours a day for a bit more than a week to read through it – and I think it’s going to be quite useful, when I start writing my Bachelor Thesis in a few days.

I’m currently writing some ANTLR grammar and StringTemplate stuff and I might write something about that, too, on the weekend.
I’m not sure I’m really happy with ANTLR, but it’s probably the best thing out there at the moment, but I’m totally in love with StringTemplate, even though you might say it has some rough edges, too.
But more on that on another day.

Over and otu,
Andreas

Fast Forward

I’ve quite a few things I’ve wanted to write about a long time ago and I actually started working on them and taking notes, etc. but never found time for one reason or another to write and publish the actual posts.
So this is meant as fast forward of all these text bits.

Movies and Games

Memento

One awesome movie. I’ve seen it twice already and I still love the movie and its plot. I don’t want to spoil too much of the story, but some will probably inevitable.

A few bullet points:

  • Telling a story in reverse is pretty cool in itself and perfect for the movie
  • I wonder if one could use this kind of plot for a game, too, but it would make the plot quite linear because the player could only do things that won’t change the outcome of the future (i.e. what he has already played).
  • If the game is linear though and goal based it could be possible easily because you would replay it like a movie. If it’s plot-centric, it could be fun and create a kind of suspense similar to Memento.
  • Fahrenheit would be a game that is plot-centric like that..
  • The movie depicts a chaotic system: small imprecision leads to huge consequences (“Don’t believe his lies”).
  • One of the impressions I liked most is the way you have to constantly reevaluate everything you have seen so far because of some new piece of information from the past which totally changes the whole movie a whole time.
  • It’s kind of difficult to remember the movie at first because the human brain is not used to this presentation of causality (seeing the effect before the cause).
  • The movie gets you thinking about what defines yourself – what are you if you can’t remember things anymore and how do you define yourself through your memory.
  • A few weeks ago I read a psychology case book that contained a case similar to Memento. Alcoholics sometimes damage their brain through alcohol abuse and lose all ability to memorize anything new. Their long-term memory only works up until some point of time and after that they won’t remember anything. They constantly live at that moment and will be lost forever.

Fahrenheit

Fahrenheit is a pretty cool. Like many movies it is excellent for 90% of the playtime and then it suddenly starts to suck and/or becomes very weird story-wise.

It’s not a typical game as more a cinematic experience that does a good job at combining gaming aspects with a very advanced plot and some pretty awesome action scenes.

I’ve really enjoyed the game and just like Omikron: The Nomad Soul (an earlier game by developer Quantic Dream) it’s positively refreshing and different.

Some random notes:

  • Vista compatibility sucks. I had to download a hacked binary to make it start at all on Vista. Otherwise it ran fine except for one crash that was due to my notebook overheating slightly.
  • Like in many other games you can’t skip cut scenes or dialogs easily which is annoying if you just want to replay a chapter up to a certain point
  • More annoyingly it seems that if you replay an earlier chapter, you have to replay the ones following it, too. Be careful with that :-|
  • As said – the story is awesome until you have played 90% of the game then it turns a bit into being on the bizarre side of things´.
  • Also “Hiding at Tiffany’s” is awful. If you ever play the game be ready to replay it a few times:
    You have to hide at Tiffany’s place from someone who is searching for, and you have 30 seconds or so to find a hiding place, after which the person starts searching for.
    The problem is that you don’t know where the person will search for you and if you are caught, you obviously won’t see where he would search afterwards, so you have to replay the same part quite a few times if you have bad lack and I think it was one of the more frustrating parts.
  • Zero Punctuation has a good review of the story issue of Fahrenheit hidden in his review of Condemned 2, it is also funny, so it’s certainly worth watching :)
  • The way the controls work in Fahrenheit is also pretty interesting. The wikipedia article about Fahrenheit has a good description of it in its Gameplay section.

Books

The Pragmatic Programmer

Last year I think I wrote that I had started reading “The Pragmatic Programmer“. I actually finished reading it quite a while ago, but here are a few remarks about it:

  • It’s a good and nice read and the book contains lots of helpful suggestions and things to keep in mind when coding or designing software or even just when you want to communicate with co-workers, etc.
  • It’s a “common sense” book – similar to Code Complete – and when you read it, you’ll often think “that’s straight-forward” or “that’s the logical thing to do”, but it still valuable to have all that common sense written down somewhere and to be able to look at it now and then in search for inspiration.
  • It’s not as useful as Code Complete though, which was a real eye opener (and still is) and it’s not going to improve your coding style a lot or the way to think about code design.

OpenGL Superbible

I’ve bought the “OpenGL Superbible” and it’s a pretty good book if you want to learn OpenGL or read a light text about certain advanced OpenGL features before rolling up your sleeves and digging around in the extension specs. It’s written like a big and pretty complete tutorial and the latest edition is a lot better suited for the new features than, say, the latest edition of the OpenGL Programming Guide (which is pretty horrible – I’ve read through the sixth edition and it’s pretty much the second edition plus a paragraph tacked on here and there and long explanations of deprecated features).

The only part of the book that is really, really weak and totally useless is the part about GLSL and shader programming. It contains a short description about GLSL and while the chapter summary mentions functions like glUniform and co, the function is not mentioned anywhere in the chapter nor does it provide even one example on how to set or access vertex attributes or uniforms, which is essential.

If you want to learn about GLSL and shader programming in OpenGL I can only recommend the OpenGL Shading Language and the GLSL language specifications.

Multi-Core Programming

First don’t buy this book. It’s from Intel Press (you can read the book description here) and it’s ridiculously expensive for the content it provides.

I got it for free at university presentation from Intel and have read through most of it in the last weeks and really – if you want to learn about OpenMP and threading techniques and tools, there are better sources available online for free.

Real-Time Rendering

This book on the other hand is awesome – buy it if you are interested in computer graphics and want to understand the underlying principles better.
It’s well-written and presents lots of advanced computer graphics topics in a very understandable way. Especially the chapters about local and global illumination and the physical base of them are very good. It is good starting point to look for resources and papers and the book’s homepage is also pretty useful: http://realtimerendering.com/.

Analysis, Cauchy-Schwarz and Reciprocal Sums

Konkrete Analysis

First I want to share some solutions for the exercises of a Maths book. The book is called Konkrete Analysis by Folkmar Bornemann and is written in German as are my solutions for some of the exercises. (I think I cover about 70% of all exercises in the book and pretty much every easy one :-))

I don’t claim that my solutions are correct and there are probably quite a few (uncorrected) mistakes, but right now I haven’t been able to find any other openly available solutions. Although the book claims to be easily readable without attending the lectures of Professor Bornemann, I doubt that it is possible to do so successfully without being able to do the exercises and while doing so being able to get help or look at possible solutions to find new ideas.

I did all the exercises as way to prepare myself for the exam (it was very successful alas probably not in the most time efficient way), so it also contains solutions for old exams (but those are appended at the end and probably not interesting at all).

You can download the PDF konkrete-analysis-solutions here.

Cauchy-Schwarz and a Problem

The book is quite useful though as was the lecture “Analysis for Computer Scientists” which was based on the book (or vice-versa) and it is probably the single one lecture that has taught most since I started attending Computer Science at university.

One of the many topics (we covered a lot which was one of the nice things) was inequalities and the useful things you can do with them. Especially the Cauchy-Schwarz inequality turns out to be quite useful while being pretty basic:

\( < a,b > \leq ||a|| \cdot ||b|| \) with \( < a , b > = || a || \cdot || b || \) when \( \exists \lambda: a = \lambda b \)

Interestingly enough this can already yield results that are quite difficult to obtain otherwise. For example we can easily prove some lower or upper bounds by applying it. That is, we can show the existence of a maximum or minimum of some functions.

To do this, we first obtain a lower or upper bound (for the right or the left side respectively) and then we can use the equality case to prove the existence of the a minium or maximum.

For example, let’s take a look at the following problem:

We have $$ x \in \mathbb{R}^n, 0 < x, \sum_{i=1}^n {x_i} = 1 $$ and want to minimize $$ \sum_{i=1}^n { \frac 1 x } $$.
We simply set $$ a_i := \sqrt{x_i}, b_i := \sqrt{ \frac 1 x_i } $$.

With Cauchy-Schwarz we then get:

$$ \sum_{i=1}^n { a_i b_i } = \sum_{i=1}^n { \sqrt{ x_i } \frac 1 {\sqrt{ x_i }} } = \sum_{i=1}^n 1 = n $$
$$ \leq \sqrt{ \sum_{i=1}^n \sqrt{x_i}^2 } \sqrt{ \sum_{i=1}^n \frac 1 {\sqrt{x_i}^2} } = \sqrt { \sum_{i=1}^n x_i } \sqrt{\sum_{i=1}^n \frac 1 x_i } = 1 \cdot \sqrt{\sum_{i=1}^n \frac 1 x_i } $$

That is: $$ \sum_{i=1}^n \frac 1 x_i \geq n^2 $$.

Now we know an lower bound for the reciprocal sum.
To determine the minimal x vector, we remember to start with:

$$ a = \lambda b \Leftrightarrow \sqrt x_i = \lambda \frac 1 x_i \Leftrightarrow x_i = \lambda $$

We use that with the constraint: $$ 1 = \sum_{i=1}^n x_i = \sum_{i=1}^n \lambda = n \cdot \lambda $$,
resulting in: $$ x_i = \lambda = \frac 1 n $$.

Generalization

The nice thing is you can go and generalize this finding to more interesting minimization problems as there also exist more advanced versions of the Cauchy-Schwarz inequality´ adding degrees of freedom to play around with´.

Thus it is possible to solve the following class of problems using a slightly more advanced Cauchy-Schwarz inequality:

$$ x,q \in \mathbb{R}^n; 0 < x, q$$
$$0 < \alpha, \gamma < \infty; \beta > 0 $$
$$\large\sum_{i=1}^n {x_i}^\gamma = \beta $$
$$\min \sum_{i=1}^n \frac {q_i} {x_i^\alpha} $$

by utilizing

$$ \large \sum_{i=1}^n { a_i b_i } \le \sqrt[p]{ \sum_{i=1}^n {a_i^p}} \sqrt[{p}']{ \sum_{i=1}^n {b_i^{p’}}} $$ with $$ \frac 1 p + \frac 1 {p’} = 1 $$

Equality requires the same linear dependence condition as the normal Cauchy-Schwarz inequation.

I’ve only deduced the solution for \( \gamma = 1 \) but it shouldn’t be difficult to adapt it once you get the idea how it works (it’s fairly straight forward).

You can find the whole deduction in the PDF “Minimum of a Generalized Reciprocal Sum”.

For completeness’ sake here are the results for an optimal solution \( x^{*} \):

$$\large x_i^{*} = \beta \cdot \frac { \sqrt[1 + \alpha]{q_i} }{\sum_{k=1}^n \sqrt[1 + \alpha]{q_k}} $$

$$\large \frac { \left ( \sum_{i=1}^n \sqrt[{1 + \alpha}]{q_i} \right )^{1 + \alpha}} {\beta^\alpha}=\sum_{i=1}^n {\frac {q_i} {{x_i^{*}}^\alpha}}$$

Epilog

Coming up with the solution was actually a lot of fun and quite interesting because I didn’t know it was possible to deduce it this way nor did I know how to do it before. If you read the PDF, I think it’s quite nice how you can play around with the formulas and come up with new things from the Cauchy-Schwarz inequality.
If you are only interested in \( x ^ {*} \), you can shortcut everything by immediately skipping to the equality case once \( p \) and \( p’ \) have been determined and solve for that.
I mainly wrote it all out because I wanted to make sure that it actually was correct.

If it wasn’t for my Analysis lecture last term, I probably wouldn’t have found this.

Footnotes    (↵ returns to text)