## Setting a complex DataRange for a defined function

Hello i am relatively new to mathematica and i have a a problem regading my model.
I have following function:

P(t_) := P(t) = P(t – 1) + a* (df(t – 1) + dc(t – 1));

(df & dc are defined and not so important for this question.)

Now i want to restrict this function following the expression:

P(t)(1-i) < P(t+1) < P(t)(1+i)

i is supposed to go from 0 up to 0.13 for each period t.

For context, this function is supposed to represent prices in a market and i want to set up a price restriction.

Posted on

## linear algebra – Given a chain of commuting matrices over the complex numbers, can we build one over the real numbers?

Suppose we have two $$ntimes n$$ matrices $$A$$ and $$B$$ with entries in $$mathbb{R}$$, and two non-scalar matrices $$X$$ and $$Y$$ with entries in $$mathbb{C}$$, such that $$AX=XA$$, $$XY=YX$$, and $$BY=YB$$.

Is it necessarily the case that there exist non-scalar matrices $$X’$$ and $$Y’$$ with entries in $$mathbb{R}$$ such that $$AX’=X’A$$, $$X’Y’=Y’X’$$, and $$BY’=Y’B$$?

(Here “non-scalar” just means that the matrices aren’t scalar multiples of the identity matrix.)

Posted on

## complex analysis – Extending a root of a holomorphic action

Consider a holomorphic C*-action $$Phi$$ on a complex algebraic variety $$X.$$ If it has a square root, (that is, action $$Psi$$ such that $$Phi_t=Psi_{t^2}$$) on a Zariski open $$Phi$$-invariant subset $$U$$, is it true that one can extend this root on the whole $$X?$$

Posted on

## complex analysis – How to interpret evaluating L(f(t))(σ+jω) for a specific σ for a *system*

The following properties hold for the Laplace and Fourier transform:
f(t).e−γt=F−1(F(γ+jω))
F(f(t).e−γt)=F(γ+jω)

This question is related to: expand a function in exp(at) sin (wt)

The question is not about the mathematics, that part is clear.
I understand the relation between Laplace and differential equations and the multiplication/convolution.

I have a system’s impulse response f(t).

With a Fourier transform it is clear: if I want to know the frequency response of the system I calculate F(f(t))(ω) or L(f(t))(jω).

Evaluating F(f(t))(jω) is the same as applying the input signal sin(ωt)

Evaluating L(f(t))(jω) is the same as applying the input signal sin(ωt)

I want to complete the sentence below:
Evaluating L(f(t))(σ+jω) is the same as …
(What is the condition of the system I create by multiplying its impulse response with e−γt)

This is a new try for the closed question: interpretation of the relation between Laplace transform and Fourier transform

Posted on

## Complex conjugation inducing a trivial map on the fundamental group

Let $$V$$ be a smooth projective complex variety defined over the rationals such that $$G=pi_1(V)$$ is a non-abelian finite simple group. Can the map $$Gto G$$ induced by complex conjugation be trivial?

Posted on

## Simplify complex expressions – Mathematica Stack Exchange

How can I simplify this expression? I tried the functions simplify and FullSimplify. Also the expand function didn’t help me. I would like to know about solving such problems in more detail

``````((x^9 - x^6*y^3)^(1/3) - y^2*(8*x^6/y^3 - 8*x^3)^(1/3) + x*y*(y^3 - y^6/x^3)^(1/3))*(x + y)/(((x^8)^(1/3)*(x^2 - 2*y^2) + (x^2*y^12)^(1/3))*(1 + y/x + (y/x)^2)^(1/3))
``````

Posted on

## homological algebra – Is it ever useful to consider a long exact sequence as a chain complex?

Here are two common ways of obtaining chain complexes with vanishing homology:

1. Chain complexes that compute the reduced homology of a contractible space
2. Chain complexes that arise as a “long exact sequence in homology” induced by a short exact sequence of chain complexes

These two examples seem to be on different footing. It is easy to think of useful maps within a type:

• for 1), a continuous map of contractible spaces induces a chain map
• for 2), a map of short exact sequences induces a map on long exact sequences

but I cannot really imagine a map between these two types, mostly because the three-fold periodicity in type 2) seems utterly incompatible with the ethos of type 1). The two types seem like unrelated notions that happen to have the same mathematical definition.

So here is my precise question, trying to see if there is any crossover:

Suppose (X,A) is a pair of spaces, $$A subseteq X$$ so that there is a short exact sequence of singular chains $$0 to C_bullet A to C_bullet X to C_bullet(X,A) to 0$$. Is it possible to functorially construct a filtered contractible space $$Lambda = Lambda(X,A)$$ with $$Lambda_0 subseteq Lambda_1 subseteq ldots$$ so that

• $$H_bullet(Lambda_{3k},Lambda_{3k-1}) cong H_k A$$,
• $$H_bullet(Lambda_{3k+1},Lambda_{3k}) cong H_k X$$, and
• $$H_bullet(Lambda_{3k+2},Lambda_{3k-1}) cong H_k(X, A)$$,
so that the spectral sequence of the filtered space $$Lambda$$ recovers the long exact sequence of (X,A) as the $$E^1$$-page?

Motivation: I am writing a Macaulay2 package that makes it easy for the user to generate long exact sequences. I originally considered returning such a sequence as a “ChainComplex” object, since this data type already exists in M2 and can be used by other functions. Then I decided that this is not so convenient, actually, because it obscures the threefold periodicity. But now I wonder if it could ever be useful to consider a long exact sequence as a chain complex.

Posted on

## complex – Symplifying expressions with exponentials inside square root

I have an expression
$$exp (i k x) sqrt{y^2 exp (-2 i k x)}$$
When I put this in Mathematica and do `FullSimplift`, it gives

``````FullSimplify(Exp(I k x) Sqrt(Exp(-2 I k x) y^2))
``````

The output is
$$e^{i k x} sqrt{y^2 e^{-2 i k x}}$$
Even if I give all proper assumptions $${x,y, k} in mathbb R$$ and $$-pi < k leq pi$$ like this

``````FullSimplify(Exp(I k x) Sqrt(Exp(-2 I k x) y^2), {x, y, k} (Element) Reals && -(Pi) < k <= (Pi))
``````

The output comes as
$$left| yright| e^{i k x} sqrt{e^{-2 i k x}}$$
But the exponentials should not be there anymore, the result should be only $$left| yright|$$.

What simplification or assumptions to make, to get the desired result?

Posted on

## data structures – What’s the argument against complex type hinting in interfaces in PHP?

The more I write OOP, the more I realize that besides reasoning & structure, there isn’t much for me and things make more sense if I combine that with functional or just straight-up non-OOP. Not over-engineering is truly a blessing when working with large code-bases and in that case, your #1 goal should be to create clear & reliable code. My issue ties to both of these traits.

Assume I had an `IngestedInterface` which objects I’m working with need to implement so that my system can understand them:

``````interface IngestedInterface
{
public function getData() : string;
}
``````

Then, assume I had an ingester object `A` who worked with `IngestedInterface` `B` objects’ `getData`:

``````class Ingester
{
public function __construct( IngestedInterface \$ingested )
{
\$this->ingested = \$ingested;
}

public function doSomething()
{
\$data = \$this->ingested->getData();
}
}
``````

We can be 100% sure that `\$data` is a `string`. But the situation gets muddy when dealing with PHP’s most popular feature: arrays. Assume my `doSomething` changed to:

``````public function doSomething()
{
\$data = \$this->ingested->getData();

return ( \$data('some_key_1'), \$data('some_key_2') );
}
``````

We implicitly rely on `some_key_12` being returned from `getData` and depending on what you do with them, that they’re of a certain type as well. If they’re not, the script crashes since it’s looking for a key it cannot find and we’ve just created unreliable, unpredictable code.

There should be a newer, improved interface type that supports complex return types such that expressing a minimally viable (meaning you need these at the very least, but can add on top) array structure to return is possible:

``````interface IngestedInterface
{
public function getData() : ('some_key_1' => <int|string>, 'some_key_2' => <string>)
}
``````

This way, it naturally tells whoever wishes to build upon this `IngestedInterface` that they need to have a complex return for `getData`. I perfectly understand that I can just have 2 functions for each one of these and just use simple return types, but it makes absolutely 0 sense to separate two things (`some_key12`) that are closely related to each other and this case is very common. This is not what I’m looking for here.

Why do I want this? Because I don’t wanna write an `array_key_exists` and an `is_%scalar_type%` for each god-damn possible kv pair inside an array, in fact, ensuring that an array I’m working with has the right structure oftentimes implies even more checks, all of which could be easily solved with a complex return type.

So, what am I missing? Is this not a desired feature? It’d be a game-changer for me. I write extremely sensitive code that I, unfortunately, have to interface to WordPress infrastructure which runs on PHP and every time and API/endpoint is written, I want to shed a tear since I know that if a client’s developer who uses our API feeds the wrong thing, they’ll break a lot of things if these checks weren’t in place, it’s like it gets sour even before I start writing code knowing that I’ll have to write these checks for mission-critical endpoints. In other words, can I just write code that’s resistant to such bul**** by default instead of spending my time doing data validation and why don’t we have this already?

I don’t think anyone capable of directing the core development of a language is stupid, but I can’t seem to come up with an argument against this.

Posted on

## design patterns – What to do with a legacy code base with no unit tests and complex architectural structure

I have been working for my company for almost a year now and been primarily focused on adding features and maintaining two 15+-year-old WPF Projects and one 20+-year-old WinForms Project. The codebases have absolutely no unit testing, the philosophy is that every engineer should be able to write bug-free code. The WPF projects are big and follow DDD and try to follow MVVM unless it becomes inconvenient. It does not follow established design patterns so features are added any way the engineer sees fit. There are no code reviews so it’s not hard to see how new members of the team could struggle with the codebase as I have these last couple of months. So I wanted to what would be the most valuable course of action for me to do given the following metrics using Microsofts’ FxCop analyzers.

WPF Project 1 WPF Project 2 I’m overwhelmed by the numbers and don’t know what problem should be the main priority. We have some very high numbers of cyclomatic complexity that would make unit testing really challenging to do. We have some high coupling numbers which beg for refactoring. There are endless places where design patterns can be applied to clean up the code. My main priority now is to fix some of the codebase problems but don’t know what would bring the most value. I feel inclined to just start unit testing like a mad man.

What do you guys think should be the next step after looking at the metrics? Should I start unit testing before refactoring? Are unit tests overrated and adopt my company philosophy and just focus on addressing the cyclomatic complexity and coupling problems? I’m I even asking the right questions here?

Just looking for a bit of guidance as this is a huge challenge for me. I work with a team but taking this initiative on my own with only 6 years of experience, so there is not enough time or money to really address everything. I also realize that whatever the next step is it will include convincing my boss, so any tips on that would also be appreciated.

Posted on