gsm – How to select a menu option received from an operator using AT Commands

I am currently playing with a Siemens MC35i terminal with a vodacom sim installed.
After running the Command : “AT+CUSD=*111#” on Hyper Terminal, I receive an interactive menu that waits for the response and looks like the following :

1]Balances
2]Buy
etc…

What would the appropriate response be to receive the balance?
I have tried to send back a 1 or 2, however this does not work.

mysql – Can I use assignment operator `:=` on a local variable in a SELECT statement?

From my understanding the only difference between user variables @var and local variables like var is the latter are scoped between the BEGIN and END statements of a procedure whereas user variables exist for use in the connection as long as the connection remains open. So I would like to use local variables since I don’t care if the variables exist after the procedure is done. Actually I would prefer they didn’t exist outside of the procedure.

I am trying to use the following query:

DROP TABLE IF EXISTS my_test_table;
CREATE TABLE my_test_table(var INT DEFAULT 0);
INSERT INTO my_test_table VALUES (3);

DELIMITER //
DROP PROCEDURE IF EXISTS my_sp_test_function;
CREATE PROCEDURE my_sp_test_function() 
BEGIN
    DECLARE localVar INT DEFAULT 1;
    #SET @userVar = 1; ### If we swap this line for the one above the query works. ###

    SELECT
        localVar := t.var + 1 AS return_var
        #@userVar := t.var + 1 AS return_var
    FROM my_test_table AS t; 
END; //
DELIMITER ;

CALL my_sp_test_function();

but getting a syntax error near “:= t.var + 1”. If we change the DECLARE localVar line to SET @userVar this exact query works. So is there a syntax fix I can make or a different technique I can use to save off a variable from a select statement while using local variables?

fa.functional analysis – Estimate the matrix element of a self-adjoint operator with square root

I have a unbounded self-adjoint operator $hat{A}$, I consider the positive semi-definite self-adjoint operator $hat{B}=left(hat{A}^2right)^{1/4}$. I hope to estimate the matrix element $langle psi_1|hat{B} |psi_2 rangle $, $forall~psi_1, psi_2inmathcal{H}$ using matrix element of a polynomial operator. My idea is: at least formally we can expand

begin{equation}
hat B=left(hat{A}^2right)^{1/4}=lambda^{1/4}left(1+frac{hat A^2-lambda}{lambda}right)^{1/4}=lambda^{1/4}left(1+frac{1}{4}frac{hat A^2-lambda}{lambda}-frac{3}{32}left(frac{hat A^2-lambda}{lambda}right)^2+cdotsright)
end{equation}

Can we approximate the matrix element $langle psi_1|hat B|psi_2rangle$ by the matrix element of the above expansion truncated at certain order?

Can this approximation valid at least in certain regime?

Exact relation between kernel and invertibility of a differential operator

Let’s assume we have a differential operator $D$ and a differential equation
begin{equation}
Df=j
end{equation}

What is the connection between invertibility, the kernel of the operator and the initial conditions we have to provide.

Example: Let’s look at the general Maxwell equation
begin{equation}
square A^{mu}-partial^{mu}left(partial_{nu} A^{nu}right)= j^{mu}
end{equation}

Fourier transformation yields
begin{equation}
left(-k^{2} eta^{mu nu}+k^{mu} k^{v}right) tilde{A}_{v}(k)=tilde{j}(k)^{mu}
end{equation}

On physics (https://physics.stackexchange.com/questions/640440/gauge-invariant-greens-function-for-electrodynamics) it was said that this equation is non invertible because the differential operator vanishes on $k_{nu}$. However fixing the gauge, i.e. imposing $partial_{nu} A^{nu}$ makes it invertible. This leads to the retarded and advanced potentials. What is the exact reason why this differential operator is non invertible. I thought it is because its kernel is not zero.

But looking at the equation
begin{equation}
square A^{mu}=j^{mu}
end{equation}

the operator $square$ also has nonzero kernel because it vanishes on harmonic functions. Nonetheless the equation above is invertible.

So when is a differential operator invertible and what has it to do with its kernel?

sql server – What does Nested Loops join operator has to do with a Scalar?

As far as I understand the docs, the Nested Loops operator is a join operator, i.e., it requires two tables as input.

If that’s correct, then why the Nested Loops operator is used with a Scalar input?

For example, take the following query (from Paul White’s website) and its execution plan.
You can see that the inputs for the Nested Loops operator are (1) a Scalar, and (2) a table (the result of the Index Seek).

I know that a scalar can’t be joined with a table, then what that actually means? What’s actually being joined?

USE AdventureWorks2019;
DECLARE @Like nvarchar(50) = N'D%';
SELECT p.(Name)
FROM   Production.Product AS p
WHERE  p.(Name) LIKE @Like;

enter image description here

BTW, I presume that it’s a pretty basic question, but I couldn’t find a good resource that goes through such basics methodologically, so a recommendation would be much appreciated.

Is my custom operator for sorting in python correct?

  1. Python has a style guide PEP 8 which explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.

    For instance shortesJobFirst(id, arrival, burst) appears (it is hard to know) to be a function, but functions in python are – according to PEP 8 – written in lowercase seperated by underscores. E.g shortesJobFirst -> shortest_job_first. However if shortesJobFirst is a class, you are good =)

  2. You should use the if __name__ == "__main__": module in your answer.

  3. Your naming practices are somewhat lacking, what does Pair mean? A better name would perhaps have been Job.

  4. It is tough suggesting better names, as you lack a short explanation of what your code does. This is done by using docstrings

  5. The printing could be improved by using pythons awesome formating options

  6. Why use a class at all when a namedtuple() can do the same job?

  7. Why implement a sorting function when you can use attrgetter from operators?

  8. Use a basic linter for your code, this ensures you have correct spacings and indents. As mentioned it is common to have two spaces between classes and functions.

from collections import namedtuple
from operator import attrgetter


def sort_jobs_by_attributes(jobs, attributes):
    """
    This functions sorts the jobs (namedtuples) according to the attribute_lst. If

             attribute_lst = ("arrival_time", "burst_time", "id")

    We then first sort by arrival_time, on tie we
                  sort by burst_time, on tie we
                  sort by id
    """
    for attribute in reversed(attributes):
        jobs.sort(key=attrgetter(attribute))
    return jobs


JOB_ATTRIBUTES = ("arrival_time", "burst_time", "id")
Job = namedtuple("Job", JOB_ATTRIBUTES)


if __name__ == "__main__":

    job_ids = (1, 2, 3, 4)
    arrival_times = (4, 1, 4, 1)
    burst_times = (3, 4, 2, 4)

    jobs = (
        Job(*job_details) for job_details in zip(arrival_times, burst_times, job_ids)
    )

    sort_jobs_by_attributes(jobs, JOB_ATTRIBUTES)

    for job in jobs:
        print(job)

Side note: you don’t need to provide any key function. The default behavior of tuples (and by extension, namedtuples, since they are a subclass) is to sort element-wise. That means that the first elements of the two tuples are compared, and if there’s a tie then the second elements are compared, and so on. Since the name is the first element, all you need is sorted(jobs).

from collections import namedtuple

JOB_ATTRIBUTES = ("arrival_time", "burst_time", "id")
Job = namedtuple("Job", JOB_ATTRIBUTES)


if __name__ == "__main__":

    job_ids = (1, 2, 3, 4)
    arrival_times = (4, 1, 4, 1)
    burst_times = (3, 4, 2, 4)

    jobs = sorted(
        Job(*job_details) for job_details in zip(arrival_times, burst_times, job_ids)
    )

    for job in jobs:
        print(job)

Note that implicitly sorting the tuple can be a bit spooky if you later decide the change around the order. In addition to make it harder to see exactly what is being sorted. I will leave it up to you to make the final call on which version is the best.

functional analysis – Spectrum of Right shift minus Left shift operator on ā„“2(Z)

$A:ell^2(mathbb Z) longmapsto ell^2(mathbb Z)$ A defined as following $A(x)_{n} = x_{nāˆ’1} āˆ’ x_{n+1}$

Find A’s spectrum. $sigma(A)=sigma_c(A)=sigma_{ess}(A)=(-2i,2i)$

Operator is not self-adjoined, $A=S_r-S_l$ and $||A||=2$.

The space $ell^2(mathbb Z)$ is isomorphic with $L^2(mathbb T)$, via the identification $delta_nlongmapsto (tmapsto e^{inpi,t})$.

$S_r$ mapped to $M_z$, $S_l$ mapped to $M_z^{-1}$
So the spectrum of $S_r-S_l$ is the same as that of $M_{z^{-1} – z}$.

I don’t understand why $$sigma_c(M_f)=sigma(M_f)=overline{f(mathbb R)}.$$ Why for a multiplication operator, its spectrum is the closure of the range? And spectrum continuous?

$$sigma(S_r-S_l)=overline{{z-z^{-1}: zinmathbb T}}
=overline{{z -bar z: |z|=1}}=overline{{2 text{Im},z: |z|=1}}$$

How to prove from that that $sigma_c=(-2i;2i)$?

functional analysis – For a compact operator $T in K(X, H)$ and H an Hilbert space, $overline{T(X)}$ is separable

Let X be a normed space, H be a Hilbert space, and let $T in K(X, H)$ the set of compact operators. Show that T(X) is separable. I tried to use the fact that the set of finite rank operators $F(X,H) = K(X,H)$ when H is an Hilbert space, to show that $T(x)$ is countable (since we need to show that $overline{T(X)}$ is separable, that is, that it contains a countable dense subset)