Quadratic equations using 2 different approaches

I am reading Mark Newman’s Computational Physics and at chapter 4 page 133 in Exercise 4.2 he asks

a) Write a program that takes as input three numbers, a, b, and c, and prints out the two solutions to the quadratic equation $ ax^2 + bx + c = 0$ using the standard formula $ x = −b± (b^2 − 4ac)^{1/2}/2a$ . Use your program to compute the solutions of $ 0.001x^2 + 1000x + 0.001 = 0$ .

b) There is another way to write the solutions to a quadratic equation. Multiplying top and bottom of the solution above by $ -b∓ (b^2 − 4ac)^{1/2} $ , show that the solutions can also be written as $ x = 2c/−b∓(b^2 − 4ac)^{1/2}$ . Add further lines to your program to print these values in addition to the earlier ones and again use the program to

I tried both ways and a) gives me

[-9.99989425e-13 -1.00000000e+00] and

b) [-1.00000000e-06 -1.00001058e+06]

how can I understand which one is correct ? Or why is this happening ?

Solution to Diophantine equations

I am trying to solve a problem that boils down to finding the number of solutions of a linear Diophantine equation with restrictions. To be precise for equations :

$ ax + by + cz = k$ and $ x + y + z = n$

Refer the solution under “Diophantine Systems with Restrictions” on this page. How do I code this mathematical solution? My constraints include $ k$ ranging from $ 10^{-9}$ to $ 10^9$ and $ n$ from $ 1$ to $ 10^5$ . Also, what would be the run time. I can code this but in a very haphazard and inefficient manner. Is there a neat or maybe a standard solution to this?

Complex solutions of a system of polynomial equations

Suppose we have a system of $ n$ polynomial equations over $ \mathbb{C}$ in $ n$ unknowns and we know that it has more solutions in $ \mathbb{C}^n$ than its Bezout’s bound and, consequently, that it has infinitely many solutions. Can we conclude that the set of solutions (i.e. the associated affine variety) is not bounded in $ \mathbb{C}^n$ ?

I believe the answer is YES and I have some rather muddy arguments to justify it, but I expect there must be a short clear proof.

pari/gp “bnfisintnorm” as poor man (quadratic) Thue equations solver?

For simplicity explaining only the quadratic case.

Given integers $ n,m$ , pari/gp “bnfisintnorm” finds $ X,Y$ such that $ X^2+n Y^2=m$ working in the number field with defining polynomial $ x^2+n$ and needs to call initialization of the number field.

This continue work correctly when we declare $ n$ as prime while it is composite and requires factoring of only $ m$ . Initializing the number field is very slow experimentally.

If necessary assume $ n$ is positive, since $ n<0,m=1$ is computing the fundamental units.

When solving $ a x^2+b y^2=c z^2$ , in general the factorizations of $ a,b,c$ are necessary according to papers.

Q1 How comes the factorization of $ n$ is not needed?

Q2 What is the minimal information for the number field for this to work.

pari/gp session:

p=nextprime(2^40);q=nextprime(p+1);n=p*q;addprimes(n);K=bnfinit(x^2+n) ? bnfisintnorm(K,2^2+n) %10 = [-x - 2, -x + 2] 

complexity of system of equations defining affine variety

Say you have an affine variety $ X$ in $ n$ -dimensional affine space. (You can even assume we are over $ \mathbb{C}$ , but I believe the nature of my question is algebraic).

I want to bound from above the complexity of a system of equations defining $ X$ . My guess is that the following parameters should be enough:

  1. $ n$ – dimension of ambient space.

  2. $ \mu$ – dimension of $ X$

  3. $ d$ – degree of $ X$ in say the standart projective compactification of $ \mathbb{A}^n$ .

I don’t mind what concept of complexity to take, say the max power in which any variable is taken from any equation.

Thank you very much!

A closed form of mean-field equations

Assume that a system at time t, for example number of costumers in a line at time $ t$ which is denoted by $ q(t)$ , follows a Markov chain with these dynamics (probabilities)

$ $ P(q(t+\Delta t)-q(t)=1)=\alpha \Delta t$ $ $ $ P(q(t+\Delta t)-q(t)=-1)=\beta\hspace{0.1cm}v(q(t)) \Delta t$ $

for some known constant rates $ \alpha$ and $ \beta$ . where $ v(x)$ is piecewise function

\begin{equation} \label{v} v(q)=\begin{cases} 0 & q \leq 0 \ \frac{q}{q_{*}} & 0\leq q\leq q_{*}\ 1 &q\geq q_{*} \end{cases} \end{equation}

Where $ q_*$ is a constant. Using Dyknin formula we can find that the density, $ E[q(t)]$ =the expected number of customers at time $ t$ , can be obtained from this differential equation: \begin{equation} \frac{d}{dt} E[q(t)]=\alpha-\beta E[v(q(t))] \label{eq:1} \end{equation}

I was wondering if there is any way to find a closed form above differential equation which means to find an expression for $ E[v(q(t))]$ in terms of $ E[q(t)]$ .

Some efforts: In above equation replace $ E[v(q(t))] = v(E[q(t)])$ . Clearly this is not a good assumption because $ v(x)$ is a concave function so according to Jensen’s inequality we have $ $ E[v(q(t))] \geq v(E[q(t)])$ $

So replacing $ E[v(q(t))]$ by $ v(E[q(t)])$ may not give us a good estimation of exact solution of above ODE. I’ve done simulations for $ E(q(t))$ = the exact solution of differential equation (non-closed one), and the solution of closed form differential equation where $ E[v(q(t))]$ is replaced by $ v(E[q(t)])$ and this solution is not close to the exact solution. There are some other suggestions like using a quadratic equation in form of
$ $ E[v(q(t))]= a\hspace{0.1cm}E[q(t)]^2+b\hspace{0.1cm}E[q(t)]+ c$ $ and then trying to find coefficients $ a$ , $ b$ and $ c$ , but this effort also fails in some cases! I think any effort should use the nature of function $ v(x)$ but till this moment I don’t know how to find it. So please let me know if you have any idea.

Polynomial equations parametrized by binary forms

Consider the equation $ $ \displaystyle Ax^p + By^q = Cz^r, A,B,C \in \mathbb{Z}, \gcd(x,y,z) = 1, p,q,r \geq 2.$ $

When $ p^{-1} + q^{-1} + r^{-1} > 1$ , the above equation is called spherical and satisfies an identity of the form

$ $ \displaystyle x = f(u,v), y = g(u,v), z = h(u,v)$ $

where $ f,g,h$ are binary forms with complex coefficients. Beukers showed that all solutions to the equation are parametrized by a finite family of such binary forms with integer coefficients.

We now consider the equation

$ $ \displaystyle x^r + y^2 = Cz^2, \gcd(x,y,z) = 1, C \in \mathbb{Z}, r \geq 3.$ $

This equation is spherical, and if it has one integer solution then it will have infinitely many due to the existence of a polynomial parametrization (by binary forms). Suppose that it does indeed have a solution and we have a parametrization $ x = f, y = g, z = h$ as above. What can we say about the discriminants of $ f,g,h$ ?

Riccati equations for dealing with stiffness of ODEs

Early texts [Forman Acton, Numerical Methods that Work; Numerical Recipes, first edition] suggested that for integrating a stiff linear ODE it was very helpful to integrate the associated Riccati equation instead. This point was made specifically for using shooting methods, i.e. algorithms that use an initial value method to solve a boundary value problem. I have not seen any followup on this point in the literature — the statement does not appear in later editions of Numerical Recipes, for instance — and I’m wondering whether this Riccati methodology is no longer considered a useful way to deal with stiffness.

Tseytin transformation for equations with more than 2 inputs

My goal is to transfer logical equations, such as $ x_1=x_2\ NAND \ x_3$ into CNF form. From the Wikipedia page of Tseytin transformations, I learned that a direct translation exists for equations with 2 inputs.
My goal is to create these equations for $ N$ inputs, such as $ x_1=x_2\ AND\ x_3\ AND\ x_4$ .
I know I can transform an $ N$ input equation into $ N-1$ 2-input equations, with helper-variables, but I am coding this and it will complicate my code very much. I am looking for a method to transform these N-input equations into CNF using only the given input/ouput variables.
Any direction on how to perform this would be greatly appreciated.