Re: What atoms ought to be!
- Posted by Rolf Schroeder <r.schroeder at BERGEDORF.DE> Jul 04, 1999
- 525 views
Bernie Ryan wrote: > > Yes complex numbers are used in the analysis of alternating current > circuits. Mathematicians use letter i to represent the value of the sqrt -1 > In electronics we use the letter j because i is used to represent current. > But, My whole point is this. > Euphoria is not a universal langauge. There is no universal computer Only if atoms would be algebraically closed! > langauge. Ada was suppose to be a universal language but I think > any Ada expert will tell you that there things that are not supported. > The Euphoria computer langauge was designed to be easy to learn and > easy to use for certain applications but it can't have features added > unless they benifit the majority of the users. Hwo knows the majority? One has to offer interesting features! > The Application should dictate which computer language to use not > how can I change a computer langauge to fit my application. > If you have an application that needs to use complex numbers then > you should be using Fortran ( a formula tranlation language ). > That is why there are many languages with so many different features. > If your writing a application the secret is to select the computer lanaguge > designed to perform the job. Indeed: why I need Euphoria if a lot of things could be done with existing languages? What is for you so 'euphorian' that could not be solved with other labguages? > > If someone really wants to use complex numbers in Euphoria then maybe one > of the Mathematicians on the list can write a library for complex numbers > using assembler in an include file because it would be easier > than having Rob rewrite the language. The Mathematicians could work on it > just like the EE editor or any other project, but how many users will use > it. > > Thanks Bernie Bernie: I guess you would even be happy with integer atoms only. Real number handling could be supplied by a mathematician writing a real number library! Here I wrote an example from the real world: Calculate reactance and phase shift of the parallel resonance curcit. -- unproofed (and impossible) code ahead! ----------------------------------------- with complex -- if necessary at all include misc.e -- PI constant R = 100 -- [ohm] constant L = 0.001 -- [Henry] constant C = 0.001 -- [Farad] constant lf = 10 -- [Hz] constant uf = 1000 -- [Hz] constant np = 1000 -- number of values to calculate/plot atom omega -- angular frequency atom gR, gL, gC -- reverse of R, L, C atom Z -- complex reactance of curcit sequence z_array -- Absolute value of reactance sequence p_array -- angle (phase) of reactance sequence x_points -- x-coordinats for plotting gR = 1.0 / R -- reverse resistance [moh] z_array = {} -- to keep ans. value of reactance p_array = {} -- to keep phase for f = lf to uf by (uf - lf)/(np-1) omega = 2.0 * PI * f gL = 1/( 0, omega*L) -- complex reverse inductive reactance gC = ( 0, omega*C) -- complex reverse capacitive reactance Z = 1/(gR + gL + gL) -- reactance of whole curcit Z = polar(Z) -- (abs(Z),angle(Z)), a most important function! z_array &= real(Z) -- the real part of Z = abs(Z) p_array &= imag(Z) -- the imaginary part of Z = angle(Z) x_points &= f -- plot-points end for plot(z_array, x_poinnts) -- plot abs. value of reactance plot(p_array, x_poinnts) -- plot phase shift of reactance ------------------------------------------------------------------ I would like to ask you, Bernie, what you are using any computer language for? I hope it's a real world application! Please let me know. There are many other applications from science and engineering, not only handling of alternate currents. One needs complex numbers to compute the 'real' world, the real numbers are not sufficient! By the way: the scientific pocket calculators of HP even are capable of calculating with complex numbers! Also, there are possibly more people handling algebraic equations then you might think off! If you exclude all scientists/engineers who need complex numbers, they would not be much interested in Euphoria. So you may indeed conclude that they are a minority in the world of Euphoria and therefor there would be no necessity of complex atoms in Euphoria ..... . Have a nice day, Rolf