Wikipedia:Reference desk/Archives/Computing/2016 February 9

= February 9 =

faster cube root calculation?
Is there a way to calculate the real cube root of a real number that is faster than the log and exponential method? Bubba73 You talkin' to me? 04:48, 9 February 2016 (UTC)
 * Sure, there are loads of options... what are your problem constraints? How accurate do you need to be?  Can you use look-up tables for some or all calculations?  Do you know that the input is centered around a particular value (suitable for a truncated Maclaurin series or other approximate method)?  May we assume you have conventional floating-point computer hardware, or do we need to work with some other type of machine?  Are we allowed to parallelize calculation work?
 * My first instinct was to formulate the cube-root of k as a zero of the equation $$x^3 - k$$, and then to apply (essentially) Newton's method to find the zero. You have the advantage of knowing, analytically, that the function is monotonic and that there is a single zero crossing; so you can use that fact to your advantage.  This is, basically, the Fundamental Theorem of Algebra.
 * Next I referred to my numerical analysis book, Numerical Analysis, Burden and Faires, which suggested applying Horner's method to accelerate convergence of Newton's method. This book actually provides code examples (in Maple), and works the numerical method for a few examples.  In this specific case, I'm not sure it will make any difference, as most of the polynomial coefficients are zero.  There are a lot of similar dumb tricks named for smart mathematicians; each one can shave off a couple of adds and multiplies.  This probably won't actually change the execution time in any significant way on modern computer hardware.
 * These are appropriate accelerations if you are solving numerically using an ordinary type of computer; but if you're working with weird computational equipment - like, say, using constructive geometry to analytically solve for the root - there may be faster ways of finding the answer.
 * Nimur (talk) 05:22, 9 February 2016 (UTC)


 * Here is a machine architecture enhancement to enable hardware-accelerated Taylor series expansion of the square root, for an IEEE-754 floating point multiply/divide unit: Floating-Point Division and Square Root using a Taylor-Series Expansion Algorithm, (Kwon et al, 2007). If you can follow their work, you can see how, by extension, one could build the same hardware for the cube-root polynomial expansion.
 * Is that kind of hardware worth the cost? Well, only if you really need to compute a lot of cube roots, and even then, only if you can convince the team who builds your floating-point multiplier into silicon.  Most mere mortals never get to provide such feedback to their silicon hardware architect.  But, once this type of enhancement is built and done, you get to compute cube roots in "one machine cycle," for the arbitrarily-defined time interval that is "one machine cycle."  Nimur (talk) 16:57, 9 February 2016 (UTC)


 * I think it's unlikely you'll get better results than the standard math library in your preferred language...UNLESS you know something that it doesn't. So if, for example, you know the range of the numbers you're giving it, or the precision of the results you're prepared to tolerate...or that you're doing a series of consecutive calculations...or that you're going to use the output in some subsequent calculation.  But if you don't have a more specific thing than "I want the cube root of absolutely any number with a full-precision result at any time" - then I doubt you'll beat the built-in library.


 * For example, you might consider a lookup table with linear interpolation between points in the table. That won't work unless:
 * You can constrain the inputs to a small range of numbers...and...
 * You will run the code in a tight enough loop that the lookup table gets into cache and stays there...and...
 * You can tolerate the errors in the result for a reasonable size of lookup table that'll fit into cache.
 * If any of those things aren't true - then the memory access time for the lookup could easily exceed the time for the FPU to do the log/exp thing. SteveBaker (talk) 18:55, 10 February 2016 (UTC)

Smart device flasher boxes/dongles
I know this sounds illicit or illegal, but upon seeing cracks, loaders or dongle emulators for certain software used on service boxes for mobile phones, it had me wondering if the dongles or boxes in question aren't any different from the ones used on high-end software like Pro Tools or Autotune for licencing enforcement, or if they do indeed contain actual circuitry to carry out any operation like removing SIM locks on phones and the like. Blake Gripling (talk) 05:31, 9 February 2016 (UTC)


 * Wikipedia is not censored, so feel free to ask about illicit/illegal subjects. Wikipedia is also public, so in some cases you might want to create a new username just for asking the question (See WP:SOCK for things you should not do with the second username). In the case of dongles, circumventing them for purposes of backing up your software or for having a spare in case the dongle fails is generally considered to be ethical. I won't comment on the legality, and neither should anyone else -- Wikipedia does not give legal or medical advice.


 * Different dongles have different internals. In general, if the company is sending out thousands and thousands of them, you can usually assume that they are cheap to make and thus pretty simple inside. If they only send out a few, the dongle may be more sophisticated and may even use a Secure cryptoprocessor. --Guy Macon (talk) 19:14, 9 February 2016 (UTC)
 * Well, it's true that wikipedia is not "censored" but it is against the ref desk policy to provide legal or medical advice and it's generally frowned upon to give advice about illegal activities, such as harming people or explicitly breaking the law, such as committing software piracy etc... Vespine (talk) 00:55, 10 February 2016 (UTC)
 * Well basically this isn't necessarily about the cracks themselves, nor would I provide any advice or directly encourage them anyway. What I'm wondering is, since some of the boxes are necessary for SIM unlocks to be done, do they contain any actual circuitry for communicating with the device (which I'm sure it does especially with certain protocols), or are they reduced to just software protection dongles like in newer smartphones, as most of the functions provided with the likes of Sigmakey can be done using freely available tools anyway? Are they bespoke ASICs or just programmable FPGA chips? Blake Gripling (talk) 05:37, 10 February 2016 (UTC)

Buying digital cameras compatible with legacy analog lenses
My father has hundreds of dollars worth of (over $1000) cameras with special lenses bought in the 70's and 80's. He keeps asking me why they don't sell digital backs that are compatible with the fronts he has. My answer is prohibitive economics. (I can explain the economics, I just don't know the mechanics.) But I would like to confirm that there isn't such a thing for which he is asking, a way to take digital photos with his old lenses. Does such a thing exist? Thanks. μηδείς (talk) 18:50, 9 February 2016 (UTC)


 * The only technical reason I can think of is that older lenses would be manually adjustable, which interferes with a digicam's ability to do things like autofocus. StuRat (talk) 19:04, 9 February 2016 (UTC)


 * In the Nikon world, many lenses with the Nikon F-mount (which was introduced in 1959) can be used on even their most modern digital SLR cameras, although there are limitations and some incompatibilities. I don't know what the situation is for other camera or lens manufacturers, however the first sentence in the History section of the F-mount article gives a clue - "The Nikon F-mount is one of only two SLR lens mounts (the other being the Pentax K-mount) which were not abandoned by their associated manufacturer upon the introduction of autofocus, but rather extended to meet new requirements related to metering, autofocus, and aperture control."  Both cameras and lenses have had more and more functionality added over the years.  An older Nikkor lens on a Nikon D90 likely would not support autofocus or aperture setting.  Taking another approach, there have been various attempts to create a digital back for film SLRs, but none seem to have really taken off - search "Digipod" on your favorite search engine for one of the most recent attempts.  -- LarryMac  | Talk  19:07, 9 February 2016 (UTC)


 * Yes, that's perfectly possible. You will just need a lens adapter to be able to physically mount the lens onto the camera body. Note that, as StuRat says, you'll miss out on most of the focussing tricks that modern DSLRs offer, but it will certainly work and you'll be able to take pictures. There's a guide here that applies specifically to Canon EOS bodies, but the principles are the same for any manufacturer. - Cucumber Mike (talk) 19:13, 9 February 2016 (UTC)


 * Excellent. Now that I know this is possible, I will make him send me a detailed list, since I am not a camera buff, and have no idea what he owns. Thanks everybody! μηδείς (talk) 19:17, 9 February 2016 (UTC)
 * There IS even such a thing as a Digital camera back which you can get for cameras with lenses that don't have adapters for equivalent DSLR but they are quite expensive. NOW having said that, I actually had the very same issue, I had over $1000 worth of lenses bought over the years which fit my old Canon film camera. I Finally decided to take the plunge to a DSLR 2 years ago, I did a LOT of research and consulted with friends, a neighbour of mine had a Canon 6D with the gorgeous EF 24-105mm f/4L IS USM L series Lens. I confirmed my other lenses would fit on the body, waited until the Christmas sales and decided to get the kit with the lens for about $2000 instead of the body only would have been about $1400. Thing is, apart from some "playing around" early on, I've never used by old lenses anymore. The ONE lens that came with the kit, the L series, just blows all my old lenses out of the water. Now I know there's lenses and then there's "LENSES", but if you're saying that each lens is hundreds of dollars rather than thousands of dollars, I suspect you "might" be in the same boat as me. Lenses and cameras have come a LONG way over the last 20-30 years and unless you are a real "artist" and have antique zeiss glass:) I suspect if you spend $1000 on one lens these days, it will preform better and be more convenient than any of your old glass. Unless of course you mean he has fisheye and super macro or super wide lenses or something like that. Vespine (talk) 22:21, 9 February 2016 (UTC)


 * I'll sum it up: it's certainly possible using a modern camera - though possibly a bit cumbersome. For any manufacturer, it's possible on an adapter to a mirrorless camera like this Sony where the mount is quite close to the sensor - I can probably give you more detailed advice when you know what he has, but here's an article on using Leica lenses with it, and here with Olympus kit. Adapters tend to be made by Chinese manufacturers and sold third-party via eBay (there are some exceptions), and quality apparently varies a lot, so you'll want to look at guides and reviews. But do remember that modern lenses have modern features like image stabilisation, autofocus, automatic diagragm control and modern computer aided-design and refinements in manufacturing aspherical lenses - things photographers have got to take for granted for the last twenty years - plus will work more precisely than a lens bolted to an adapter, since the extra connection increases deviation from the ideal position. So modern lenses may give better results unless your dad's old lenses are truly excellent and your adapter good, and this is particularly true for any kind of 'action' photography where autofocus is a great aid. In addition, it may be cumbersome since you'll need to focus and set the aperture manually every time and then meter before taking a shot. I should stress that I just know about this for interest, I've never done this myself. On Nikon, things get much better: it's possible to use some of the modern Nikon cameras (though often the more expensive pro ones) with older equipment. See Ken Rockwell's website; I've seen him say that Nikon actually offers surprisingly good phone support in the US on users trying to make odd combinations of equipment work. An additional problem is that cheaper digital cameras use a sensor smaller than 35mm film, so unless your dad gets a more expensive prosumerish camera (like the aforementioned sony) he will have to deal with his images looking cropped compared to the same lens on film. But again, if you tell us what your dad has it should be possible to give you more advice. Finally: this only works with 35mm film cameras, the normal kind. If your dad has equipment for medium format film, getting less popular in the 70s but still often used by serious landscape and fashion photographers, or a huge view camera, he's probably stuck with film- you can't get digital sensors that size for any sensible amount of money. Blythwood (talk) 06:04, 10 February 2016 (UTC)

follow-up: Do they make a digital conversion back so film cameras can have the film mount back replaced?
My thanks, and my dad's for all the answers above. Again, I am acting as a proxy for my dad in asking this; I know nothing about the technology myself. μηδείς (talk) 19:42, 10 February 2016 (UTC)

In response to the answers up to Feb 9th, he asked me to repose the question as:

"Do camera manufacturers make a digital conversion back so that film type cameras can have the film mount back removed and an electronic receiver installed?"


 * See the Digital camera back article linked by Vespine - short answer, not at any affordable price point, and mostly for medium and large format cameras (i.e. not your typical 35mm SLR). The "Digipod" that I mentioned was to sell for around $370; it was an Indiegogo project that failed to reach any significant interest.  Understanding that you are a proxy, but knowing your father's camera brand and type would be helpful in providing more detail. -- LarryMac  | Talk  21:20, 10 February 2016 (UTC)


 * Exactly. The thing is, refitting a film camera to interface with a sensor, getting the alignment of the sensor right and so on...all very precise machining jobs. A whole new camera is actually easier (and cheaper, since it can be mass-produced as one module). Digital camera backs are almost without exception for medium format cameras, systems that cost five figures for which it might genuinely be worth upgrading the sensor but keeping the camera module every now and then. Blythwood (talk) 21:42, 10 February 2016 (UTC)


 * As a separate point, modern film scanners are very good and film development companies can often now do development from film and scanning in one go then send you images on a USB stick. If your dad doesn't want to take that many pictures, and doesn't fancy some kind of completely new camera setup, that might be a good option. Here's one blogger on it. But obviously you're stuck with the limitations of film (not great indoors, no instant replay, 36 photos at a time) and it would get expensive for many photos. Blythwood (talk) 21:50, 10 February 2016 (UTC)


 * Also, the availability of film and film developers could be an issue. Some models of cameras have already discontinued film support, and you can expect more to do so in the future.  The eventual fate of film is an interesting question.  Will it disappear completely or will some remain indefinitely, but in small quantities, like vinyl records ? StuRat (talk) 22:01, 10 February 2016 (UTC)


 * μηδείς Minolta AF mounted lenses from the 80s and 90s fit some of the decent Sony Alpha cameras. The latest Sony Alphas are using a new system, so its time to watch the second hand market for the best price point.  All the best: Rich Farmbrough, 01:56, 16 February 2016 (UTC).