From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9b0810d3106d9b8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!dr5g2000vbb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Fun with C Date: Thu, 28 Apr 2011 00:02:36 -0700 (PDT) Organization: http://groups.google.com Message-ID: <724c7fd3-046b-42ee-9dff-5606b8ca1048@dr5g2000vbb.googlegroups.com> References: <4b5748dc-60fa-4cec-a317-054626e9a1ca@d19g2000prh.googlegroups.com> <1hnl95prvrt6i$.1s675gncbjxsu$.dlg@40tude.net> <5d44db50-ceff-4f4d-8bc7-714f31fbca06@hd10g2000vbb.googlegroups.com> <1uthrsrabx8di$.8i74uk28axo0.dlg@40tude.net> <84b83223-e191-4912-8f73-318deb4dd783@d19g2000prh.googlegroups.com> <1j2bi0982bjcs.1beq9xn9za9yb$.dlg@40tude.net> <9j18r6hrlf06adfv4rdothhdrjmfdrmeno@4ax.com> <1qe52ny88vlk9$.hcf0wgd0xcmh.dlg@40tude.net> <117x5uepxzqrn$.zu65rz3wdey9.dlg@40tude.net> <10wrcep2z88z3$.1q3jmf2y5a0qn.dlg@40tude.net> <356b1c5c-9b6e-488b-a31a-6e1d15082f2c@k22g2000yqh.googlegroups.com> <5l0ijm901fhp$.3f2xu562o6ri$.dlg@40tude.net> NNTP-Posting-Host: 83.3.40.82 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1303974157 9197 127.0.0.1 (28 Apr 2011 07:02:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 28 Apr 2011 07:02:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: dr5g2000vbb.googlegroups.com; posting-host=83.3.40.82; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19066 Date: 2011-04-28T00:02:36-07:00 List-Id: On Apr 27, 10:00=A0am, "Dmitry A. Kazakov" wrote: > >>> What? A simple hanging spring can oscillate while being purely linear= . > No, I mean that x(t) =3DA sin(2Pi f t) + x0 is not a linear function of t= ime. You got it backwards. Completely. The above equation does not define the spring mechanics. It only describes the *observable effect* of this mechanics. In other words, harmonic oscillation is not a cause of spring movement, it is a consequence of the spring being a linear system. The spring itself has no idea that it should oscillate at all. Let's bring some Ada back to this discussion: with Ada.Text_IO; procedure Spring is Initial_Position : constant :=3D 0.0; Initial_Velocity : constant :=3D 10.0; Spring_Rigidity : constant :=3D 1.0; Mass : constant :=3D 1.0; Time_Unit : constant :=3D 0.1; Position : Long_Float :=3D Initial_Position; Velocity : Long_Float :=3D Initial_Velocity; procedure Show_Position is P : Integer :=3D 40 + Integer (Position); Off_Screen : Boolean :=3D False; begin if P <=3D 0 then P :=3D 0; Off_Screen :=3D True; end if; if P >=3D 79 then P :=3D 79; Off_Screen :=3D True; end if; for I in 1 .. P loop Ada.Text_IO.Put (' '); end loop; if not Off_Screen then Ada.Text_IO.Put ('*'); else Ada.Text_IO.Put ('!'); end if; Ada.Text_IO.New_Line; end Show_Position; procedure Compute_New_Position is Force : Long_Float; Acceleration : Long_Float; Shift : Long_Float; begin Force :=3D -1.0 * Position * Spring_Rigidity; Acceleration :=3D Force / Mass; Velocity :=3D Velocity + Acceleration * Time_Unit; Shift :=3D Velocity * Time_Unit; Position :=3D Position + Shift; end Compute_New_Position; begin loop Show_Position; delay Time_Unit; Compute_New_Position; end loop; end Spring; The above program is a discrete simulator of a purely linear system. The sine function is never used there and the program has no freaking idea that it should oscillate in a harmonic way. Yet it does. Enjoy! I don't care about the exact math, but as far as I understand it, purely harmonic oscillations (that is, a single component in the spectrum) come from purely linear systems. If the underlying system is not linear, then the resulting oscillation (if it exists at all) will include additional harmonics. Try to mess with the equations in the above program, like make the force a square function of position or make force dependent also on velocity, etc. and the oscillation will become less pure. I leave to math geeks to come up with exact Fourier spectrum for each such tweak. In which case I still don't understand what you have failed to prove. But hey, at least the discussion is related to Ada again. :-) -- Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com