Skip to main content
23-Emerald V
October 23, 2024
Question

Expression Type Function Additions and Nested Mixed Unit Array Unit Operations

  • October 23, 2024
  • 1 reply
  • 1678 views

TBD - finger trouble.

1 reply

25-Diamond I
October 23, 2024

@StuartBruff wrote:

TBD - finger trouble.


TBD ???

 

You use "complex" not in the mathematical meaning (complex numbers include the reals) but rather in the sense of "non-real while still a number".

 

Werner_E_0-1729722188060.png

Or is this the reason you withdrew the file?

 

Not sure about IsImag vs IsComplex ??

Or is IsImag supposed to test for 'pure' imaginary numbers?

I recall two definitions for them.

The first one defines them as the product of a real number and the imaginary unit. Using this definition, zero must be considered pure imaginary.

A second definition states that it is a number whose square is a negative real number. According to this definition, zero would not be included.

A third definition (yes, its the third of the two I recall) is similar to the second but uses "non-positive" instead of "negative" and so is equivalent to the first one.

Even if it looks strange on first sight that the 'normal' number zero should be pure imaginary, but nonetheless there is a logic in the first (and third) definition as it includes all points (including zero) in the Gauß plane lying on the imaginary axis.

And thats exactly what your IsImag is checking for. The description has to be modified as it was obviously copied from IsReal and is partially not changed to fit the new function.

So you may have 0 included in your IsComplex on purpose? I'm still struggling with the name, since every real number is automatically a complex number.

23-Emerald V
October 24, 2024

Yes, major finger trouble. Starting at the distant end of the finger’s nerves. I believe it’s called the “brain” in humans. Not sure what mine’s called. 😕

 

I was a bit sleepy when I “completed“ the worksheet and, idiot that I am, decided to post it whilst nodding off over the keyboard. Consequently, I didn’t notice that I was looking at a slightly earlier version of the worksheet or that the units functions weren’t showing the correct results (I’d been playing with an alternative, unsuccessful method of recursion). 

And, of course, the “earlier” version turned out to be the latest version because I’d accidentally not saved the “correct “ version.  A truly bad hair day, as they say. Shortly after posting the topic, I was fast asleep with my fingers still on the keyboard, and stayed that way for a couple of hours.

 

Not only did the posted worksheet not work, it didn’t include my further observations on the incomplete support for ranges. In particular, and this has been a long standing annoyance, one can’t get at the elements of a range … ISTR you could do this in M11 using the symbolic undocumented function ops(?).

 

Anyway, although you can assign units to a range (subject to it being defined as a 3-part range) and SIUnitsOf will tell you what those (SI) units are you can’t divide a range rng by SIUnitOf(rng). The only workaround I know of is to convert the range to a vector, and then reconstruct the range … which can be computationally expensive for “large” ranges. And I needed this for UnitsOf and removeUnits.

 

While I’m on the topic of ranges, another shortcoming is the lack of support for string ranges, ie “a”,”c”..”k”. Yes, it requires a bit of thought about how to interpret them (eg, “a”..”zz”) but it can be done (eg, look at last letter of the end string (”z”) and use the characters in “a”..”z” as the basis for the sequence. Ask me how I know).  


Oh, and simple arithmetic operations on ranges. That would make it far easier to scale integer ranges and to generate a matching “index” range for non-integral ranges. That would help with a lot of the problems people have with ranges. Still, as usual, I digress. I’m reconstructing the correct and missing parts of the worksheet and abnormal service will be resumed shortly.

 

As I’m dropping off over my artisanal, strength 7 coffee, I suppose I’d better go to bed and put on an audiobook I want to listen to, before I do too much further damage.  Nothing better guaranteed to send me to sleep.!  If I want to stay awake, I listen to one that is boring me to tears with its tediousness.

 

Thanks for the comments. I shall read them when sufficiently restored.

 

Stuart