Polynomials: I’ve just made a text-based UI, slightly user-friendlier.

One of the facts which I’ve written about before was, that I had written a C++ program which finds numerical approximations to the roots of polynomials, preferably difficult polynomials to which there can be no exact solution. And one of the facts about my program, which I was never completely satisfied with, had less to do with the actual algorithm that gets closer and closer to each root, but has more to do with how my code could be inaccessible to those readers, who do not already know how to use a compiler.

Specifically, I had written a version of the program which somebody executes from ‘the Command Prompt’, as it’s called under Windows, because under Linux, power-users access features with one-line commands often. Yet, if a user was not such a power-user, then what they might do under Windows could be, just to double-click on the .EXE-File (the Application icon), observe that a console window briefly appears, and then watch it disappear again. There could be users who do not know how to navigate their Command Prompt windows to the folder into which they unzipped the program, and then execute that program from within their Command Prompt / Terminal Window.

And so, even though I kept the code roughly the same – it’s still text-based – I changed it subtly, to help out potential readers who may have had that problem. You may try it and see if you like it. The compressed files can be found at the following location:

https://dirkmittler.homeip.net/binaries/

And, within the table of contents which gets displayed there, the reader would either be interested in the file ‘Roots_Dirk_Mittler.tar.gz‘, or the file ‘Roots_Dirk_Mittler.zip‘ – in either case, the file-name that begins with a single ‘R’.

Enjoy,

Dirk

 

Popular Memory of Vinyl Records Probably a Shifting Memory

One phenomenon known in Psychology is, that as the years pass, memories which we have of a same thing that once happened, will change, so that, 10 or 20 years later, it becomes hard to trust those memories.

A modern phenomenon exists, by which many Baby-Boomers tend to recall their old vinyl records as having had better sound, than so-called modern, digital sound. And in total I’d say this recollection is partially true and partially false.

When “digital sound” first became popular (in the early to mid- 1980s), it did so in the form of Audio CDs, the sound of which was uncompressed, 16-bit PCM sound, at a sample-rate of 44.1kHz. Depending on how expensive a person’s CD player actually was, I felt that the sound was quite good. But soon after that, PCs became popular, and many eager people were advised to transfer their recordings, which they still had on LPs, to their PCs, by way of the PCs’ built-in sound devices, and then to compress the recordings to MP3 Format for Archiving. And, a bit-rate which people might have used for the MP3 Files could have been, 128kbps. People had to compress the audio in some way, because early hard drives would not have had the capacity, to store a person’s collection of music, as uncompressed WAV or AIFF Files. Further, if the exercise had been, to burn uncompressed audio onto CD-Rs (from LPs), this would also have missed the point in some way. (:2)

What some people might be forgetting is the fact that many LPs which were re-recorded in this way, had strong sound defects before being transcribed, the most important of which was, frequent scratches. I think, the second-most-common sound defect in the LPs was, that unless the listener had a high-end turntable, with a neutrally counterweighted tonearm, and a calibrated spring that defined stylus force, if an LP was listened to many, many times, its higher-frequency sound content would actually become distorted, due to wear of the groove.

(Updated 3/02/2021, 18h05… )

Continue reading Popular Memory of Vinyl Records Probably a Shifting Memory

Power Failures Today, Downtime

I take the unusual approach, of hosting my Web-site, including this blog, on a private PC I have at home, acting as server. I’m not suggesting that everybody do it this way; it’s only how I do it. For that reason, the visibility of my site and blog, are only as good, as the quality of my Internet connection, as well as the continuity of my power supply.

Unfortunately, my immediate neighbourhood was subject to multiple power failures this evening, from 16h25 until 1815. For that reason, my Web-server was offline, until about 18h50. I apologize for any inconvenience to my readers.

BTW, This last server-session ran uninterrupted for over 60 days, as a sign of how rare such failures have been, in recent months.

Dirk

 

Guessing at the discretization, of the Sallen-Key Filter, with Q-Multiplier.

One concept that exists in modern digital signal processing is, that a simple algorithm can often be written, to perform what old-fashioned, analog filters were able to do.

But then, one place where I find lacking progress – at least, where I can find the information posted publicly – is, about how to discretize slightly more complicated analog filters. Specifically, if one wants to design 2nd-order low-pass or high-pass filters, one approach which is often recommended is, just to chain the primitive low-pass or high-pass filters. The problem with that is, the highly damped frequency-response curve that follows, which is evident, in the attenuated voltage gain, at the cutoff frequency itself.

In analog circuitry, a solution to this problem exists in the “Sallen-Key Filter“, which naturally has a gain at the corner frequency of (-6db), which would also result, if two primitive filters were simply chained. But beyond that, the analog filter can be given (positive) feedback gain, in order to increase its Q-factor.

I set out to write some pseudo-code, for how such a filter could also be converted into algorithms…

 


Second-Order...

LP:
for i from 1 to n
    Y[i] := ( k * Y[i-1] ) + ((1 - k) * X[i]) + Feedback[i-1]
    Z[i] := ( k * Z[i-1] ) + ((1 - k) * Y[i])
    Feedback[i] := (Z[i] - Z[i-1]) * k * α
    (output Z[i])

BP:
for i from 1 to n
    Y[i] := ( k * Y[i-1] ) + ((1 - k) * X[i]) + Feedback[i-1]
    Z[i] := ( k * (Z[i-1] + Y[i] - Y[i-1]) )
    Feedback[i] := Z[i] * (1 - k) * α
    (output Z[i])

HP:
for i from 1 to n
    Y[i] := ( k * (Y[i-1] + X[i] - X[i-1]) ) + Feedback[i-1]
    Z[i] := ( k * (Z[i-1] + Y[i] - Y[i-1]) )
    Feedback[i] := Z[i] * (1 - k) * α
    (output Z[i])


Where:

k is the constant that defines the corner frequency via ω, And
α is the constant that peaks the Q-factor.

ω = 2 * sin(π * F0 / h)
k = 1 / (1 + ω), F0 < (h / 4)

h   Is the sample-rate.
F0  Is the corner frequency.

To achieve a Q-factor (Q):
α = (2 + (sin^2(π * F0 / h) * 2) - (1 / Q))
'Damping Factor' = (ζ) = 1 / (2 * Q)


Critical Damping:
ζ = 1 / sqrt(2)
(...)
Q = 1 / sqrt(2)

 

(Algorithm Revised 2/08/2021, 23h40. )

(Computation of parameters Revised 2/09/2021, 2h15. )

 

(Updated 2/10/2021, 18h25… )

Continue reading Guessing at the discretization, of the Sallen-Key Filter, with Q-Multiplier.