9 ms·
Scipy - the embarrassing way to code
- scott_s 18y agoThe bottleneck in writing code isn’t in the writing of the code, it’s in understanding and conceptualising what needs to be done. Good observation, succinctly stated. Most of my days are spent trying to figure out what I need to do, not how to do it.
- noahlt 18y agoException: interfacing with 3rd-party libraries.
- brent 18y agoThis is exactly why I have urged people to learn Matlab (on this forum and others). Specifically, I'm sick of seeing hundreds of lines of code written in Java that are essentially a poor (slow) implementation of a one liner in Matlab that uses a 20 year old fortran library. I have to go back all of 8 days to find the following quote in response to my plea: "...and I question the usefulness of learning MATLAB unless you actually need it." The problem is, most people don't realize they need it and just plod along writing hundreds of lines of python, perl, ruby, java, etc. implementing a decade old numerical computation.
- ejs 18y agoWhen you write a lot of matlab it becomes a different way of thinking. Instead of the for loops multiple levels deep you can write it all as operations to multi-dimensional matrices. I would agree that many problems people spend time on can be found as single commands in matlab.
- ivankirigin 18y agoI've done lots of Matlab development, and this is too true. Python is going to replace Matlab, but the pattern in the same. People aren't really used to thinking about matrices and vectors as primitive types and operations. By the way, this is an excellent resource for learning Matlab. http://www.andrew.cmu.edu/course/16-720/handouts.html http://www.andrew.cmu.edu/course/16-720/handouts.html Look at the "working with images" section. If you manually touch every pixel in an image, you're doing something wrong. You code will be 5X as long, and 100X as slow.
- edw519 18y agoThis is a familiar story, regardless of technology. The more you work, the less you appear to have. The efficiency paradox.
- bridgetroll 18y ago"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -Antoine de Saint Exupéry
- edw519 18y agoBulletin board material.
- bridgetroll 18y agoI have it posted at my desk in a nameplate frame. I try to adhere to it. I often fail.
- deleted 18y ago[deleted]
- ola 18y agoThe article seems to have two messages: one that it's better to fully comprehend the problem before you start coding; the other that learning a powerful library will save you pages of code. Both well rehearsed truths of computer programming. As for myself I often find that I have to fully explore the problem on my own terms before I can maturely optimize my source.
- mhartl 18y agoit's better to fully comprehend the problem before you start coding Often the best way to understand a problem is to try to implement a solution.
- ola 18y agoThat's a very true observation mhartl and I try to touch on it in my last sentence although it is enigmatically worded as I was trying to sneak a "Premature optimization is the root of all evil" reference into it. Alas not all wordplay is destined for upmods!
- Prrometheus 18y agoWould it be advisable to try to implement a solution on a chalkboard first? Mathematical notation and diagrams can be amazingly succinct.
- carterschonwald 18y agoI think the deeper idea to take away from this is that knowing more theory is always a good thing
- carterschonwald 18y agowhich begs the question of why it seems that even in pretty technical domains, theres still an aversion to aggressive use of theory tools?
- brent 18y agoWhat does this have to do with theory?
- carterschonwald 18y agoif you don't know any of the theory behind a problem, you don't even necessarily know if theres a solution thats useful in practice. A good example in Computer Science is the various reductions (efficient or not )between different problems, where you relate the difficulty of the problem to any other computational problem which you find you're able to encode within the structure of the orginal problem.
- gruseom 18y agoThe comments here on Matlab have me intrigued. I'm ignorant and have a few newb questions. How does it compare to the APL family of vector languages (J/K/Q)? How does it compare to Mathematica? What roughly are the licensing terms for commercial use (i.e. if you want to build a product with it)?
- carterschonwald 18y agoin terms of interface, it has more in common with mathematica (both good and bad) than do the APL style languages, basically the language semantics are C style with dynamic shape checking for array operations and a nice syntax for many different linear algebraic operations. It'd be nice if there was a nice type system to aid in getting comfortable with matlab's semantics, in my opinion
- tokipin 18y agoit's an algol language with array manipulation. APL languages start with array manipulation as a primitive in the design of the language, so they are much better at these sorts of things Matlab is for engineers, Mathematica is for scientists. Matlab is designed for speedy matrixy stuff. Mathematica uses a lisp-like structure 'replacement' pattern matching evaluation scheme, and intrinsically supports symbolic mathematics and is the the only language i would really call multiparadigmatic
- gruseom 18y agoThanks. My project is calculation-intensive and performance is important. I would love to use kdb. Arthur Whitney's work is stunning. Unfortunately, their licenses are draconian. Can you offer any insight about these various options from the standpoint of building a commercial product on top of them?
- tokipin 18y agotruthfully, i have no idea. it's certainly unfortunate that these languages/environments are not widely usable. i don't know of a more powerful scratchpad than Mathematica have you looked at R? it's an open source matlab. though i don't know what kind of database options it might have
- tokipin 18y agogive J (an APL descendant) a try, it has some good tutorial thingies that appear right in the console thingie: http://www.jsoftware.com/stable.htm http://www.jsoftware.com/stable.htm and here's a post about it: http://www.squidoo.com/jprogramming http://www.squidoo.com/jprogramming
- scott_s 18y agoThe introduction to J that peaked my interest: http://prog21.dadgum.com/14.html http://prog21.dadgum.com/14.html Haven't done anything with it yet, but it's on my radar.
- plinkplonk 18y ago> give J (an APL descendant) a try, J is not open source. Might be a factor to consider. From the J site, "Jsoftware licenses source for all the Jsoftware binaries. There are several factors in determining the cost of source licenses. Primary is the source itself: J Engine (portable C); Windows GUI support (C++); and Unix GUI support (Java). Secondary is the scope of use: internal; distributed products; and competitive (to Jsoftware) products. And finally the platforms: Windows; Unix; PocketPC; etc. The price range is from $10,000 to $400,000. Regular updates to our current source levels are available for separate update fees."
- mooneater 18y agocareful, not free: http://www.jsoftware.com/source.htm http://www.jsoftware.com/source.htm
- rapind 18y agoGreat article. Learn the hard way and it'll stick. Plus it's fun.
- bsaunder 18y agoI've noticed a similar conceptual pattern while investigating meta-programming. I think there's something fundamental going on here. Something that conventional programming constantly misses. Something remarkably simple, consistent and powerful. It's where code is data along a continuous path of transformations.
- ambition 18y agoRead Godel Escher Bach. Given the comment above, you'll like it.
- JulianMorrison 18y agoI can't believe nobody has mentioned Sage Math (http://www.sagemath.org/ http://www.sagemath.org/). It's sort of a set union of every good free math program.