Finite Element Method – DirichletCondition must be linear

Based on the PDE model proposed by @Alex Trounev, I test the following multi-field benchmark in MMA 12, but this problem can not be solved; H. Many mistakes look like:

DirichletCondition (…) must be linear.

I have attached the code here:

ClearAll("Global`*");
PDE1 = (s(t, x))^2 D(u(t, x), x, x) == D(u(t, x), t);
PDE2 = 2 (Epsilon) D(s(t, x), x, x) + 0.5 (1 - s(t, x))/(Epsilon) - 
    s(t, x) (CapitalEpsilon)1 (D(u(t, x), x))^2/(ScriptCapitalG) == 
   D(s(t, x), t)/1000;

lr = 25;
ll = -25;
(CapitalEpsilon)1 = 1;
(ScriptCapitalG) = 1;
u0 = 10;
(Epsilon) = 0.125;
bcs1 = {u(t, ll) == -u0 t, u(t, lr) == u0 t};
bcs2 = {s(t, ll) == 1, s(t, lr) == 1};
bcs3 = {Derivative(0, 1)(s)(t, ll) == 0, 
   Derivative(0, 1)(s)(t, lr) == 0};
ic = {s(0, x) == 1};
{uu1, vv1} = 
 NDSolveValue({PDE1, PDE2, bcs1, bcs2, bcs3, ic}, {u, s}, {x, ll, 
   lr}, {t, 0, 10})

{Plot3D(uu1(t, x), {x, ll, lr}, {t, 0, 10}, Mesh -> None, 
  ColorFunction -> Hue, AxesLabel -> Automatic), 
 Plot3D(vv1(t, x), {x, ll, lr}, {t, 0, 10}, Mesh -> None, 
  ColorFunction -> Hue, PlotRange -> All, AxesLabel -> Automatic)}
{Plot(uu1(10, x), {x, ll, lr}), 
 Plot(vv1(10, x), {x, ll, lr}, PlotRange -> All)}

In this benchmark test Input parameters and BCs are fixed.

When I remove BCS3, then errors:

FindRoot :: sszero: The step size in the search is smaller than the
Tolerance prescribed by the PrecisionGoal option, but the function
Value is still greater than the tolerance after
AccuracyGoal option.

FindRoot :: nosol: The found linear equation has no solution.

Thanks in advance!

linear algebra – curve of the matrix $ A ^ { ast} A $

Accepted $ n times n $ matrix $ A $ with complex entries. And $ A ^ { ast} $ represents the conjugate transpose of $ A $.Then

  • If $ left | tr { left (A ^ { ast} A right)} right | <n ^ 2 $, then $ left | a_ {ij} right | <1 $ for some $ i, j $

  • If $ A $ is thus invertible $ tr { left (A ^ { ast} A right)} $ $ neq0 $

Solution I tried the matrix $ A ^ { ast} A $ is a Hermitian matrix, so all its eigenvalues ​​are real.

but further on I do not get anything to do, as I think about this question, other questions come to my mind as it is $ A ^ { ast} A $ is a positive definitely? like eigenvalues ​​of $ A $ refers to eigenvalues ​​of $ A ^ { ast} A $?

please help

Many thanks?

Hash Map – Custom HashMap implementation in Java with linear testing

I tried to implement a HashMap in Java. To deal with collisions, I implemented a kind of LinkedList with a dataNode. I am not very confident about my implementation and ask for feedback.

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class MyHashMap implements SampleMap{

    private double loadFactor;
    private int size;
    private int capacity; // Number of elements in the HashMap
    Set hashSetKeys = new HashSet<>();

    //
    private dataNode() hashTable;

    // Constructor: Default values for instance variables
    public MyHashMap() {
        this(16, 0.75);
    }

    // Constructor: starts with an initialSize for the Map
    public MyHashMap(int initialSize) {
        this(initialSize, 0.75);
    }

    public MyHashMap(int initialSize, double loadFactor) {
        hashTable = new dataNode(initialSize);
        this.size = initialSize;
        this.loadFactor = loadFactor;
    }

    // Removes all the mapping from this map
    @Override
    public void clear() {
        if (size != 0) {
            hashTable = new dataNode(size);
            capacity = 0;
            hashSetKeys.clear();
        }
    }

    public int capacity() {
        return capacity;
    }

    // Returns true if this map contains a mapping for the specified key.
    @Override
    public boolean containsKey(K key) {
        return hashSetKeys.contains(key);
    }

    /*
     * Returns the value to which the specified key is mapped, or null if this
     * map contains no mapping for the key.
     */
    @Override
    public V get(K key) {
        if (this.containsKey(key)) {
            int tableIndex = (key.hashCode() & 0x7fffffff) % (size - 1);
            return get(hashTable(tableIndex), key);
        }
        else {
            // the hashtable does not contain the key
            return null;
        }
    }

    // Helper function for the get method to get the value of a specified key
    private V get(dataNode node, K key) {
        if (node == null) {
            return null;
        }
        else {
            if (node.getKey().equals(key)) {
                return (V) node.getValue();
            }
            else {
                return get(node.getNextNode(), key);
            }
        }
    }

    // Returns the number of key-value mappings in this map
    @Override
    public int size() {
        return this.size;
    }

    /**
     * Associates the specified value with the specified key in this map.
     * If the map previously contained a mapping for the key,
     * the old value is replaced.
     */
    @Override
    public void put(K key, V value) {

        if (((double) capacity / size) >= loadFactor) {
            copyAndIncreaseSize(size);
            this.put(key, value);
        }
        else {
            int tableIndex = (key.hashCode() & 0x7fffffff) % (size - 1);
            if (!hashSetKeys.contains(key)) {
                capacity += 1;
            }
            hashSetKeys.add(key);
            if (hashTable(tableIndex) == null) {
                hashTable(tableIndex) =
                    new dataNode(key, value, key.hashCode());
            }
            else {
                dataNode tempNode = hashTable(tableIndex);
                for (dataNode node : tempNode) {
                    if (node.getKey().equals(key)) {
                        node.setValueData(value);
                        return;
                    }
                }
                hashTable(tableIndex) = new dataNode(key, value,
                    key.hashCode(), hashTable(tableIndex));
            }
        }
    }

    // Helper function to increase the size of the table
    private void copyAndIncreaseSize(int currentSize) {
        dataNode() tempTable = hashTable; // temp table
        hashTable = new dataNode(currentSize * 2); // new hashTable

        this.size = currentSize * 2;  // Updating the size

        // since the hashmap only allows unique keys hence iterating through
        // the keyset
        for (K key : this.keySet()) {
            int currentIndex =
                (key.hashCode() & 0x7fffffff) % (currentSize - 1);

            dataNode tempNode = tempTable(currentIndex);

            // if there is no next node, it is only one node
            if (tempNode != null) {
                if (tempNode.getNextNode() == null) {
                    this.put(key, tempNode.getValue());
                } else {
                    for (dataNode node : tempNode) {
                        if (node.getKey().equals(key)) {
                            this.put(key, tempNode.getValue());
                        }
                    }
                }
            }
        }
    }

    /** Returns a Set view of the keys contained in this map. */
    @Override
    public Set keySet() {
        return hashSetKeys;
    }

    /**
     * Removes the mapping for the specified key from this map if present.
     */
    @Override
    public V remove(K key) {
        throw new UnsupportedOperationException();
    }

    /**
     * Removes the entry for the specified key only if it is currently mapped to
     * the specified value.
     */
    @Override
    public V remove(K key, V value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Iterator iterator() {
        return new HashMapIterator(hashSetKeys);
    }

    private class HashMapIterator implements Iterator {
        K() keyArray;
        int keySetSize;
        int counter = 0;

        HashMapIterator(Set hashKeySet) {
            keyArray = (K()) hashKeySet.toArray();
            keySetSize = hashKeySet.size();
        }

        @Override
        public boolean hasNext() {
            return keySetSize > 0;
        }

        @Override
        public K next() {
            counter += 1;
            size -= 1;
            return keyArray(counter);
        }
    }
}

dataNode.java

import java.util.Iterator;

public class dataNode implements Iterable{

    private int hash;
    private dataNode next;
    private K keyData;
    private V valueData;

    // Constructor for nodes which will store the data
    dataNode(K key, V value, int hash) {
        this.keyData = key;
        this.valueData = value;
        this.hash = hash;
        this.next = null;
    }

    dataNode(K key, V value, int hash, dataNode next) {
        this.keyData = key;
        this.valueData = value;
        this.hash = hash;
        this.next = next;
    }

    // Function to assign the next node
    public void nextNode(dataNode next) {
        this.next = next;
    }

    dataNode getNextNode() {
        return this.next;
    }

    K getKey() {
        return this.keyData;
    }

    V getValue() {
        return this.valueData;
    }

    void setValueData(V valueData) {
        this.valueData = valueData;
    }

    @Override
    public Iterator iterator() {
        return new dataNodeIterator(this);
    }

    private static class dataNodeIterator implements Iterator {
        private dataNode current;

        dataNodeIterator(dataNode node) {
            current = node;
        }

        public boolean hasNext() {
            return current.getNextNode() != null;
        }

        public dataNode next() {
            dataNode nextNode = current.getNextNode();
            current = nextNode;
            return nextNode;
        }
    }
}

Many thanks

Linear programs with strict inequalities and highest goals

Linear programming can only solve problems with weak inequalities such as "maximize" $ c x $ so that $ A x leq b $"This makes sense because problems with strict inequality often have no solution, for example," maximize " $ x $ so that $ x <5 $"has no solution.

But suppose we want to find supremum instead of maximum. In this case, the above program has a solution – the supreme one is $ 5 $,

Is it possible to solve a linear program with strict inequalities and a subordinate or subordinate goal by reducing it to a standard linear program?

Determine the transformation matrix of the linear map with respect to the monomial basis.

It is difficult for me to understand the following task.

Consider the function: $ ell: mathcal {P} _ {2} rightarrow mathbb {R} ^ {2 times 2} $
begin {equation}
begin {array} {ll} { qquad ell left ( sum_ {k = 0} ^ {2} a_ {k} m_ {k} right): = left ( begin {array} {cc } {2 a_ {0} +0 a_ {1} +0 a_ {2}} & {-2 a_ {0} +0 a_ {1} +3 a_ {2}} \ {-2 a_ {0} +0 a_ {1} -6 a_ {2}} & {0 a_ {0} +0 a_ {1} +0 a_ {2}} end {array} right)} end {array}
end {equation}

Determine the transformation matrix $ ell _ { mathcal {B} leftarrow mathcal {M} _ {2}} $ for the monomial basis: $ mathcal {M} _ {2} = left ( mathbf {m} _ {0}, mathbf {m} _ {1}, mathbf {m} _ {2} right) $ and the standard basis:
begin {equation}
begin {array} {l} { qquad mathcal {B} = left ( left ( begin {array} {cc} {1} & {0} \ {0} & {0} end { array} right), left ( begin {array} {cc} {0} & {1} \ {0} & {0} end {array} right), left ( begin {array} {cc} {0} & {0} \ {1} & {0} end {array} right), left ( begin {array} {cc} {0} & {0} \ {0 } & {1} end {array} right) right}} end {array}
end {equation}

So I sit first $ mathcal {M} _ {2} $ in $ ell $,

Then we get this for $ ell left (m_ {0} right) $:
begin {equation}
ell left (m_ {0} right) = ell left (1 m_ {0} +0 m_ {1} +0 m_ {2} right) = left ( begin {array} {cc} {2} & {-2} \ {-2} & {0} end {array} right)
end {equation}

and for $ m_ {1}, m_ {2} = $ $ left ( begin {array} {cc} {0} & {0} \ {0} & {0} end {array} right), left ( begin {array} {cc} {0 } & {3} \ {-6} & {0} end {array} right) $

That's probably trivial, but I just do not understand what's going to happen next. The solution to this problem is:

begin {equation}
ell _ { mathcal {B} leftarrow mathcal {M} _ {2}} =
left ( begin {array} {ccc} {2} & {0} & {0} \ {-2} & {0} & {3} \ {-2} & {0} & {-6 } \ {0} & {0} & {0} end {array} right)
end {equation}

Can anyone explain why I can write the matrices I received to vectors (ie $ left ( begin {array} {cc} {2} & {-2} \ {-2} & {0} end {array} right) $ as $ begin {equation}
left ( begin {array} {c} {2} \ {-2} \ {-2} \ {0} end {array} right)
end {equation} $
)?

Linear algebra – normalization of discrete data against a second variable

I recorded data on flow and temperature in a tube for a couple of hours. (See the attached photo, the horizontal axis should represent the time, but here I replace it with counters.) Before I started recording, I expected a constant flow over time. When the recording is finished, I noticed that the flow time has changed somehow with the temperature. Now I'm suspicious that the temperature changes lead to flow fluctuations. So, I'd like to mathematically remove the effects of temperature changes from flow measurement in some way I have no idea how. Or, if possible, find some correction factors that compensate the measured flow for temperature fluctuations.
I'm sorry if my question is too basic, I've been far from math for 15 years.
Thank you in advance.

Flow and temperature fluctuations

linear algebra – Lax-Milgram lemma, alternative proof in finite-dimensional case

I wonder if we would weaken the assumptions of the Lax-Milgram lemma to the finite-dimensional case

Lax Milgram Lemma
To let ($ V $. $ ( cdot, cdot $. $ Vert cdot Vert $) be a (real) Hilbert space. To let $ mathcal {A}: V rightarrow V ^ * $ Be a linear, strongly positive, bounded operator, then it follows $ mathcal {A} $ is bijective, d. H. for all $ f in V ^ * $ There is a unique solution $ u in V $ to the problem $ mathcal {A} u = f $ in the $ V ^ * $,

How would the proof be simpler?
Since we are finally dimensional, we get a linear system of equations. So we have to show that $ A = mathcal {A} $ is invertible. But how can you show that? $ det A neq 0 $?

Thank you for the answers!

Reference request – almost linear ODE

To let $ A, B $ His $ n times n $ Matrices. I am interested in the following ODE in $ mathbb {R} ^ n $

$$ frac {dx_t} {dt} = Ax_t + Bx ^ + _ t $$

from where $ x_t ^ + = (x ^ + _ {1, t}, …, x ^ + _ {n, t}) $ and $ ( cdot) ^ + $ is the rectifier: $ r ^ + = max {0, r }. $

Does this type of ODE have a name? And are there any known stability criteria? Was it generally examined by anyone?

The next thing I found are the "threshold linear networks" we are looking at here. I appreciate every hint that is similar to this system.

linear algebra – closing the intersection under projection

To let $ Z = {(x, y) in R ^ d times R ^ l: a leq Ax leq b, y = Bx } $ from where $ A, B $ are matrices and $ a, b $ are vectors.

Then $ Z = Z_1 cap Z_2 $ from where

$ Z_1 = {(x, y): Ax leq b, y = Bx } $.

$ Z_2 = {(x, y): Ax geq a, y = Bx } $,

I want to show that the projection of the intersection of the projections of $ Z_1 $ and $ Z_2 $ on to $ y $-space corresponds to the projection of $ Z $ on to $ y $Space, i.

$$ Proj_y (Z_1) cap Proj_y (Z_2) = Proj_y (Z). $$

Thank you in advance.

Inequality – Linear function $ f $ and existence of the constant M as a function of $ f $

If $ f: mathbb {R} ^ m rightarrow mathbb {R} ^ n $ Is a linear map, show that there is one $ M $, so that $ | f (x) | leq M | x |, $ for all $ x in mathbb {R} ^ m. $

I guess $ M $ depending on the matrix associated with it $ f $but I tried it like this.

It is trivial, though $ x = 0 $, Eigenvector, or $ f = 0 $, For otherwise

To let $ y neq 0 $. $ y not in Kerf $ exists because $ f neq 0) $ then

$ | f (x) | = | f (x + | x | y – | x | y) | = | f (x) + | x | f (y) + (- | x | f (y)) | leq $

$ leq | f (x) | + || x | f (y) | + | – | x | f (y) | = | f (x) | + | x || 2f (y) | = | x | left | frac {f (x)} {| x |} + 2f (y) right |. $

Call $ M = left | frac {f (x)} {| x |} + 2f (y) right | $,

It's okay?