# Complicated Algebra Using Circuits

Discussion in 'The Projects Forum' started by magikal, Nov 24, 2008.

1. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
How does one do complicated mathematical operations with input/output voltage such as ln, e^x, division and multiplication with micro processors? Is there a chip that does it?

2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
You might have to write your own routines, but they can all add and subtract. The definition of computer is that it is a numeric engine, which is to say: a machine that runs on numbers.

Get the data sheet for one and look at the instruction set. Remember that if there is no explicit instruction to take a square root, you can write a routing that follows an algorithm and get that result.

3. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
sorry, I meant to say without a micro controller. Is it still possible?

4. ### steveb Senior Member

Jul 3, 2008
2,433
469
Yes, it's possible to do all of the functions you mention. There are logarithmic amplifiers and multiplier chips; even division. As you might imagine, the multiplication and division can be done with logarithmic amplifiers combined with adders and subtractors. It's tricky stuff though. There are dynamic range limits and temperature sensitivity issues.

5. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
Could you give me some examples of such chips? My range does not need to be very big.

6. ### steveb Senior Member

Jul 3, 2008
2,433
469
I'm not up on this stuff. I used a multiplier chip years ago, but can't remember which one. I think it might have been an Analog Devices chip. I recommend looking at the Analog Devices web site and read through the data sheets. If I remember right, these parts aren't cheap. Nowadays, you would be much better off with a digital approach. Maybe the only advantage of analog parts (for this type of application) could be high bandwidth. Since we don't know your application, it's hard to say much more.

7. ### John Luciani Active Member

Apr 3, 2007
477
0
Analog Devices published a book called the "Non-linear Circuits Handbook" which has
many examples of computational circuits.

(* jcl *)

Apr 20, 2004
15,815
283
9. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
What is the difference between a digital and analogue approach? Also, around how much do these chips typically cost?

10. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
Also, how easy is it to use the four quadrant multiplier? How reliable and accurate is it? And how can addition and subtraction be done?

11. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
Please get the data sheet for one and see how those functions are performed.

For that matter, reviewing the history of analog computing is about the only way to get into the accurate and reliable area.

My experience is that analog computation can be very accurate. Our ship had a Mark 119 analog fire control computer. We hit a drone once with an unguided missile at a distance of 20 miles (the missile was launched with only a correct solution off the rail).

They took a lot of upkeep,though. I was constantly adjusting the Fire Control Data Converter, essentially a digital to servo and servo to digital converter. The full alignment took 20 hours. But it worked fine when you had it tweaked up!

Digital computers work with values whose accuracy is limited by the precision of the A to D converter. But when you're up above 16 bits, the external circuitry is the source of any errors.

12. ### dude521 Active Member

Nov 1, 2008
37
0
Op-Amps can do all of this. Search google for op-amp integrator, differentiator. They both use capacitors to integrate or differentiate a given signal. For multiplication, you need to use a standard inverting configuration and adjust the values of the input and feedback resistors. For addition, you need to use two input resistors in parallel on the input, so the signals get added by superposition.

I don't have a lot of time to go into details right now, but these are common op-amp configurations with lots of info on the net. Note, this will all be done with analogue, not digital.

13. ### steveb Senior Member

Jul 3, 2008
2,433
469
Certainly these linear operations you speak of can be done with OPAMPs, but the original question was about nonlinear operations (log, exponential, multiply divide etc). When you say multiply with OPAMPs, what you really mean is multiply by a constant which is a linear operation.

In principle you can use OPAMPS with transistors to make log-amps and exponential amps, multipliers and dividers. However, temperature effects make this not practical with discrete components. You really need an integrated chip solution using the most advanced temperature compensation techniques. Analog Devices, seems to be one of the few companies that have stayed up on this technology.

However, the OP has not provided any information on the application, nor any critical specifications such as bandwidth. So, who knows what he really needs.

Last edited: Nov 25, 2008
14. ### leftyretro Active Member

Nov 25, 2008
394
2
Yes, virtual any programmable microprocessor could be programmed to perform those kinds operations. If you can perform it with a handheld calculator you can be performed with a microprocessor, but only with the proper programming. So in reality the microprocessor is not really solving the problem, but rather the software language you use to tell the microprocessor what basic steps to perform to reach the end solution.

It's much like how you were taught how to do long division by hand, it's a bunch of little basic steps that ends up giving the final answer. The microprocessor performs those little basic steps but it's up to the person programming the micro to know what steps are needed to find the final answer. Some programming languages make it easier to write such programs as many already have built in high level math functions that will then convert to the instructions needed by the micro.

15. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
Could somebody show me how to add two or more input voltage signals using an OpAmp?

16. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
TI has a nice article - focus.ti.com/lit/an/slaa068a/slaa068a.pdf.

17. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
it shows addition of two signals. Is it possible to add more than two using one OP AMP?

18. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
The principle is the same as for two. Remember that there is a practical limit to the op amp output. Adding 10 volts to 8 volts with a supply voltage of 15 volts means that the voltages have to be scaled down. The magnitude of the errors remains the same, but their effect is increased with scaling.

That is just one of the many reasons why it's easier to do the manipulations in digital form.

19. ### magikal Thread Starter Active Member

Nov 23, 2008
31
0
So how can it be done it digital form? What chips are required other than ADCs?

20. ### DickCappels Moderator

Aug 21, 2008
2,779
674
A microcontroller would be a great start.