complex numbers – Is $T : mathbb{C} rightarrow mathbb{C}: a + bi mapsto overline{a + bi} = a – bi$ a linear image?

So a question in my handbook for linear algebra is the following; Is the image T
$$T :mathbb{C} rightarrow mathbb{C}: a + bi mapsto overline{a + bi} = a – bi$$

an linear image if:

  • $mathbb{C}$ is interpreted as a real vector space
  • $mathbb{C}$ is interpreted as a complex vector space

I know how I would solve the question itself (I would check the axiom of linear image: if $L: V rightarrow W$ is a linear image then $L(lambda_1v_1 + lambda_2v_2) = lambda_1L(v_1) + lambda_2L(v_2)$) but I’m stuck at what they mean with the interpretation.

homotopy theory – Elementary proof of the exactness of Čech complex associated to a hypercovering (“Illusie’s Conjecture”)

Let $mathcal{E}$ be a sheaf of abelian groups on a topological space (or a site). For an open covering $mathfrak{U} = (U_i)_i$, it is well known that the augmented Čech complex $0 to mathcal{E} to mathcal{check C}^bullet(mathfrak{U}, mathcal{E})$ is a resolution of $mathcal{E}$. (Depending on the sheaf cohomology of $mathcal{E}$ on the intersections of the members of $mathfrak{U}$, this resolution might compute $mathbb{R}Gamma(mathcal{E})$, but this need not concern us here.)

A simple proof runs as follows: Let $s in mathcal{check C}^{n+1}(mathfrak{U}, mathcal{E})(V)$ such that $ds = 0$. Then $t = (s_{i_text{fix},i_0,ldots,i_n})_{i_0,ldots,i_n} in mathcal{check C}^{n}(mathfrak{U}, mathcal{E})(V cap U_{i_text{fix}})$ is a local preimage of $s$ under $d$, as $(dt)_{i_0, ldots, i_{n+1}} = s_{i_0, ldots, i_{n+1}} – (ds)_{i_text{fix}, i_0, ldots, i_{n+1}} = s_{i_0, ldots, i_{n+1}}$. As $V = bigcup_{i_text{fix}} (V cap U_text{fix})$, that’s all what’s needed.

I’m looking for a similarly elementary proof in the case that $mathfrak{U}$ is a hypercovering. Apparently this fact is sometimes referred to as Illusie’s Conjecture. A proof involving trivial Kan fibrations and an induction reducing to the case of ordinary covers is in Section 01GA of the Stacks Project, but I’d prefer either a more direct proof or some insight as to why a much simpler argument isn’t likely to exist.

python – Parsing overly complex JSON

The Merriam-Webster Dictionary API at some point discontinued the use of XML in favor of exclusively returning JSON. This had the unfortunate effect of making finding a definition listed by sense number (i.e. definition 1 a (2)) much more complicated because they’re trying to force a semi-arbitrary document based model into nested json.

After reading through the documents I was able to figure out the object nesting hierarchy they return but never directly explain. The relevant nestings I believe go:

(arrows show what an object can be nested in i.e. dt is in a sense or sdsense 
 which can in turn be inside another sense. Sorry for the unclear names, thats
 just what the api calls everything)

dt ============> sense ===========> sseq ========> def
  ==> sdsense ==/               /  ^  ==> vd ==/
                       ==> bs ==    |
                                    |
                        ========+> pseq

Most fields can be either arbitrarily long arrays like (('sense', {...})) or objects {'sense': ({...})} depending on context which is a pain especially because sometimes they’re nested, sometimes they’re flat. Objects can also contain any combination of nested objects repeated any number of times. For example, an sseq can contain a pseq which contains a bs, a bs of it’s own, another pseq, and then a few sense objects. Not every one is that complex but there are no restriction stopping them.

To make matters more complicated the sense number (a property of either sense or sdsense) can be explicit: 1 a (2) or implicit: a or (3) which means it depends on a previous sense or sdsense that could be nested in a completely different object. They can also change between implicit and explicit as you go up and down the hierarchy.

And lastly that vd field means that instead of def being an array of sseq it is of the form def: ({'vd': "(verb type)", "sseq": (...)}, {'vd': "(verb type)", "sseq": (...)}) and that sense numbers can suddenly either explicitly or implicitly reference the verb type as well which is never actually nested inside anything relevant.

Check the offial API at the Merriam Webster website for all the quirks and exceptions.

TLDR: json an api returns is a hot mess and there’s no easy way to reference the definition 1 a (2) of a dictionary entry. Since a project I’m working on depends on referencing definitions directly by that number I wrote the python parser below to reform the json into a well nested object that can be accessed like parse_resp('word')('1')('a')('(2)')('def').

My approach writing the code was to start with parsing the dt object and then work my back through each layer, creating a better structured object as I go. lists and dicts are still mixed together inside the object because the relationship between implicit sense numbers needs to be preserved.

Finally, once that object is completely built, there’s an admittedly gross method unpack_defs that uses a couple global variables to track the last well-formed sense number while it recursively pulls the entire object inside-out into one well-nested dict.

I’m sure I could rewrite at least that piece better but given this was supposed to be a simple API request in a larger project that the lack of xml support greatly complicated, once it was working for all the exceptions of the API I called it a day and moved on.

Code:

import urllib.request
import json
import os
import re


# TO-DO: GET RID OF GLOBAL STATE
curr_num = ''
curr_let = ''


def reset():
    global curr_let
    global curr_num

    curr_num = ''
    curr_let = ''


# parse_resp is the main function called from other packages and accepts a Merriam Webster api response
# parse_resp defaults to returning only the definitions referenced in the first-use 'date' field because that's what the overall project is interested in
def parse_resp(resp, all_defs=False):
    reset()
    entries = (parse_entry(entry) for entry in resp)
    
    if all_defs == True:
        return (non_empty for non_empty in entries if non_empty)
    
    for entry in entries:
        entry('def') = get_sense_by_sn(entry('sn'), entry('def'))
    
    entries = (e for e in entries if e('date') and e('def'))

    return entries


def get_sense_by_sn(sense_number, entry):
    def loop_entry(entry):
        x = entry
        for sn in sense_number:
            x = x(sn)

        return x('def')

    try: return loop_entry(entry)  
    except: pass

    # check for implicit references to transitive / intransitive verb if explicit path fails
    try: return loop_entry(entry('t'))
    except: pass

    try: return loop_entry(entry('i'))
    except: pass

    return ''


def parse_entry(defs):
    (date, sn) = parse_date(defs)
    entry = unpack_defs(parse_defs(defs))

    if entry is None:
        return

    return {
        'date': date,
        'sn': sn,
        'def': entry
    }


def unpack_defs(defs):
    global curr_num
    global curr_let

    if isinstance(defs, dict):
        (key, value) = next(iter(defs.items()))
        key = str(key)

        if is_verb(key):
            return {key: unpack_defs(value)}
        else:
            return fmt_def(key, value)

    if isinstance(defs, list):
        def_dict = dict()

        for d in defs:
            if isinstance(d, list):
                def_dict.update(unpack_defs(d))
            if isinstance(d, dict):
                (key, value) = next(iter(d.items()))
                
                if is_number(key):
                    curr_num = key
                    def_dict.update(fmt_def(key, value))
                elif is_paren(key):
                    
                    def_dict(curr_num)(curr_let).update(fmt_def(key, value))
                else:
                    keys = key.split()
                    
                    def nest_keys(keys):
                        global curr_num
                        global curr_let

                        key = keys(0)

                        if len(keys) > 1:

                            if is_number(key):
                                curr_num = key

                            if is_letter(key):
                                curr_let = key

                            return {key: nest_keys(keys(1:))}
                        else:
                            return (fmt_def(key, value))

                    if not curr_num or (is_number(keys(0)) and curr_num != keys(0)):
                        def_dict.update(nest_keys(keys))

                    elif curr_num:
                        def_dict(curr_num).update(fmt_def(key, value))

        return def_dict


def fmt_def(key, value):
    key = str(key)

    return {key: {'def': value}}


def is_number(string):
    try:
        int(string)
        return True
    except:
        return False


def is_paren(string):
    return '(' in string(0)


def is_letter(string):
    return string.isalpha()


def is_verb(string):
    return string == 't' or string == 'i'
        

# First Known Use: date
# Hierarchical Context
#   Top-level member of dictionary entry
# Data Model
#   "date" : string
def parse_date(entry):
    if isinstance(entry, dict):
        if 'date' in entry.keys():
            return clean_date(entry('date'))

    return ('', '')


def clean_date(date_string):
    date = int(re.search(r'(0-9)+', date_string).group())
    sn = re.findall(r'(?<=|)(w())*', date_string) or ('1')
    sn = (non_empty for non_empty in sn if non_empty)

    # quick and dirty conversion of centuries 
    if date < 100:
        date = (date-1) * 100

    return (date, sn)


# Definition: def
# Hierarchical Context
#   Occurs as top-level member of dictionary entry and in dros.
# Data Model
#   array of one or more objects
def parse_defs(defs):
    if isinstance(defs, dict):
        defs = defs('def')

    for entry in defs:
        if is_vd(entry):
            return parse_vd(entry)

        elif is_sseq(entry):
            return parse_sseq(entry)


# Verb Divider: vd
# Hierarchical Context
#   Occurs in def, preceding an sls (optional) and sseq (required)
# Data Model
#   "vd" : string
def is_vd(vd):
    if isinstance(vd, dict):
        return 'vd' in vd.keys()
    
    return False


# Verbs can be transititive or intransitive and referenced as 'i' or 'v' in date
def parse_vd(vd):
    verb_type = 't'
    if 'intransitive' in vd('vd'):
        verb_type = 'i'

    return {verb_type: parse_sseq(vd('sseq'))}


#
# Shared logic for sseq and pseg
#
def parse_array(array):
    sense_list = ()

    for sense in array:
        if is_sense(sense):
            sense_list.append(parse_sense(sense))
        elif is_bs(sense):
            sense_list.append(parse_bs(sense))
        elif is_pseq(sense):
            sense_list.append(parse_pseq(sense))
        elif isinstance(sense, list):
            sense_list.append(parse_array(sense))

    if len(sense_list) == 1:
        return sense_list(0)

    return sense_list


# Sense Sequence: sseq
# Hierarchical Context:
#   Occurs in def
# Data Model:
#   "sseq" : array
def is_sseq(sseq):
    if isinstance(sseq, dict):
        return 'sseq' in sseq.keys()

    return False


def parse_sseq(sseq):
    if isinstance(sseq, dict):
        sseq = sseq('sseq')

    sense_list=()

    for array in sseq:
        sense_list.append(parse_array(array))

    if len(sense_list) == 1:
        return sense_list(0)

    return sense_list


# Parenthesised Sense Sequence:
# Hierarchical Context:
#   Occurs as an element in an sseq array.
# Data Model:
#   array consisting of one or more sense elements and an optional bs element.
def is_pseq(pseq):
    if isinstance(pseq, list):
        return pseq(0) == 'pseq'
    
    return False


def parse_pseq(pseq):
    sense_list = ()

    for sense in pseq(1:):
        sense_list.append(parse_array(sense))

    return sense_list


# Binding Substitution: bs
# Hierarchical Context
#   Occurs as an element in an sseq or pseq array, where it is followed by one or more sense elements.
# Data Model:
#   array of the form ("bs", {sense})
def is_bs(bs):
    if isinstance(bs, list):
        return 'bs' == bs(0)
    
    return False


def parse_bs(bs):
    return parse_sense(bs(1))


# Sense: sense
# Hierarchical Context
#   Occurs as an element in an sseq array.
# Data Model:
#    object or array consisting of one dt (required) and zero or more et, ins, lbs, prs, sdsense, sgram, sls, sn, or vrs
def is_sense(sense):
    if isinstance(sense, dict):
        return 'sense' in sense.keys()
    elif isinstance(sense, list):
        return 'sense' == sense(0)
    
    return False


def parse_sense(sense):
    if isinstance(sense, dict):
        sense = sense('sense')
    elif isinstance(sense, list):
        sense = sense(1)
    else: return

    sn = 1
    if 'sn' in sense.keys():
        sn = sense('sn')

    sn = str(sn)

    dt = parse_dt(sense('dt'))
    if 'sdsense' in sense.keys():
        dt += parse_sdsense(sense('sdsense'))

    return {sn: dt}


# Divided Sense: sd
# Hierarchical Context
#   Occurs within a sense, where it is always preceded by dt.
# Data Model:
#   "sdsense" : object with the following members:
#   "sd" : string   sense divider (required)
#   et, ins, lbs, prs, sgram, sls, vrs  (optional)
#   dt  definition text (required)
def parse_sdsense(sdsense):
    return parse_dt(sdsense('dt'))


# Defining Text: dt
#Hierarchical Context
#   Occurs as an element in an sseq array.
# Data Model:
#   "dt" : array consisting of one or more elements:
#   ("text", string) where string contains the definition content (required)
#   optional bnw, ca, ri, snote, uns, or vis elements
def parse_dt(dt):
    for elem in dt:
        if elem(0) == 'text':
            ### Implement text cleaning
            return re.sub(r'{(w)*}', '', elem(1)).strip()

boolean computation – How can I use Mathematica to solve a complex truth-teller/liar logic problem?

I have a logic puzzle I want to convert to Mathematica to solve:
Person A states, “Exactly two people are truth-tellers,”
Person B states, “I and Person C are truth-tellers.”
Person C states, “Person A is a liar or Person B is a liar.” (here this is a use of inclusive or)
Each person is either a truth-teller or a liar.
The full first-order logic formulation of this is as follows:

  • A↔((A∧B∧¬C)∨(A∧¬B∧C)∨(¬A∧B∧C))
  • B↔(B∧C)
  • C↔(¬A∨¬B)

I was hoping someone could help me figure out how to create a truth table in Mathematica for this problem and/or solve using Mathematica’s logic functions for who is a truth-teller and who is a liar. I tried using Boolean Table but couldn’t get the right input. How can I use the solving features in Mathematica to input logical statements and figure out who is telling the truth and who is lying?
For a helpful similiar problem, see How to solve the liar problem?

complex analysis – Inequality of $left|int_C f(z) Bbb dzright|$

I’m asking about concept. Please see the picture below:
enter image description here

What is the difference between Ineq. $(1)$ and $(2)$? Notice that i use variable $z$ because this integral is evaluated over a complex plane. Which should i use when dealing with integral inequality? for example if in half way I want to perform the transformation variable $z = -u$. Then the $Bbb dz$ must be $-Bbb du$. Which one should i choose? If i just ignore the negative term and turns out the evaluation after taking the maximum value is $<0$ that makes the inequality invalid even though i can assuming the positive term would $>$ than the last expression.

Many books use the first Inequality and not explaining about this condition. And now i’m thinking it’s “maybe” important to use $lvert Bbb dzrvert$ for convenient reason. What is the meaning of $lvert Bbb dzrvert$ actually? And what is the difference with first inequality?

complex analysis – Does there exist a holomorphic function $f$ such that $f(0) = 0$ and $|f(z)| > 1$ for $z = (x,y)$ and $|x|,|y| > 1$?

The exercise says:

Does there exist a holomorphic function $f$ such that $f(0) = 0$ and
$|f(z)| > 1$ for $z = x+iy$ with $|x|,|y| > 1$?

I tried to construct such a function but couldn’t find a way. I suppose no such function exists and I think there is some basic theorem which would contradict the existence of such a function but I couldn’t find anything in my notes. Any ideas on how to start?

cv.complex variables – Describing the set of common zeros of two complex functions

Let $f(x),g(x)$ be complex functions with infinitely many common zeros.

Is there a simple way to describe the set of their common zeros,
preferably something like $F(f(x),g(x))=0$?

As a special case of interest
take $f(x)=sin(pi x)$ and $g(x)=sin(pifrac{2^{x-1}-1}{x})$

Partial results: over the reals we can take $f(x)^2+g(x)^2=0$
and the union of the zeros is $f(x)g(x)=0$.

Display and editing complex data

I am looking for suggestion how to display complex data for reading/editing.

Data will be key-value, example:

string-val: “v12”,
int-value: 99,
boolean: true

I these types I think simple table will do the trick (with editable rows).

I will also have to support the following:
array-val: (1, 2 ,3), object-value: {name: “bp”, amount: 4}, array-object-value: ({name: “bp”, amount: 4}, {name: “bp”, amount: 4})

I am considering using: https://material-ui.com/components/tables/#collapsible-table (just an example because we use material-ui), where the dropdown V will have an embedded table.

I am open for any suggestion, this is the only solution I can think of.

materialized view – What is the correct way to do a computed column with complex logic with performant sorting and filtering at scale in MS SQL Server?

I have the Quantity indexed on both tables because I obviously wish
to sort and filter on this column, but of course the index doesn’t
help if I want to sort and filter on vwThingAugmented.

Based on your view and the comment on filtering I am going to assume queries like this:

SELECT * 
FROM  dbo.vwThingAugmented
WHERE Quantity = 5;

Where there is a filter operator late in the execution plan:

enter image description here

One of the things you could try, depending on the size of the tables and the type of filters you do would be to create a view with a UNION an INNER JOIN and a NOT EXISTS instead of a LEFT JOIN

CREATE VIEW dbo.vwThingAugmented_2
AS SELECT t.ID
, Quantity = t.Quantity + a.Quantity
, AdditionGroupID
FROM dbo.Thing t
INNER JOIN dbo.AdditionGroup a ON  t.AdditionGroupID = a.ID
UNION ALL
SELECT t.ID
, Quantity = t.Quantity
, AdditionGroupID
FROM dbo.Thing t
WHERE NOT EXISTS (SELECT * FROM dbo.AdditionGroup a WHERE  t.AdditionGroupID = a.ID);

You do get two accesses to dbo.Thing and dbo.AdditionGroup in this case, YMMV depending on the type of query you run against the view. You could try running the same query again:

SELECT * 
FROM dbo.vwThingAugmented_2
WHERE Quantity = 5;

This removes the filter operator but you do have double index access with a concatenate.
enter image description here

And you still have residual predicates on both parts of the query,

Because the nonclustered index is not covering:

DROP INDEX IX_Thing_Quantity ON dbo.Thing;
CREATE INDEX IX_Thing_Quantity ON dbo.Thing (Quantity, ID) 
INCLUDE (AdditionGroupID);

Where now the bottom part is improved to use the nonclustered index (without a key lookup) instead of the clustered index :

enter image description here

Lastly, as mentioned by you, you could add an indexed view to the first part of the view. Remember to use NOEXPAND for best performance, even in Enterprise edition.