ag.algebraic geometry – Quasi-plurisubharmonic function with polynomial decay

Let $(M, omega)$ be a compact Kähler manifold. An $omega$-quasi-plurisubharmonic function on $M$ is an upper semi-continuous function $varphi : M to mathbb{R} cup { – infty }$ such that $omega + dd^c varphi geq 0$ in the sense of currents. The prototype in the non-compact or quasi-projective setting is $log | f |^2$, where $f$ is a holomorphic function (e.g., the local defining section for a divisor $D subset M$).

Are there examples of quasi-plurisubharmonic functions with polynomial decay?

Here is a non-example:
Suppose we have a smooth divisor $D$ in $M$ with local defining section $s_D$. For $varepsilon >0$, we may consider $| s_D |^{-2varepsilon}$, where the norm is taken with respect to a Hermitian metric on the line bundle $mathscr{O}_D$ associated to $D$. A standard calculation gives $$sqrt{-1} partial overline{partial} | s_D |^{-2varepsilon} geq varepsilon | s_D |^{-2varepsilon} R_D,$$ where $R_D$ is the curvature form of the Hermitian metric on $mathscr{O}_D$. This example blows up at a polynomial rate, but in the wrong direction. I want a quasi-plurisubharmonic function which decays to $-infty$ polynomially. Of course, this is not quasi-plurisubharmonic either.

I apologise in advance for how trivial this is question is.

algorithm – Java Polynomial, while I know this works, help me make it better

As stated, I know this works but I want to improve this code! I don’t expect anyone to re-write this but if you have some “try this instead” then great!

import java.util.*;

public class Polynomial implements Iterable<Object>, Comparable<Polynomial> {
    Comparator<Polynomial> compare;
    private Term head = null;
    //A constructor that accepts a string that defines one polynomial in the same format 
    //as provided in the input file.
    public Polynomial(String file) {
        Scanner scan = new Scanner(file);
        try{
            while(scan.hasNext()){
                addTerm(scan.nextDouble(), scan.nextInt());
            }
        } 
        catch (Exception ex){
            System.out.println(ex.getLocalizedMessage());
            throw new InvalidPolynomialSyntax("Error: Invalid Polynomial Syntax, check input");
        }
    }

    public void addTerm(double coefficient, int exponent ){
        if (exponent < 0){
            throw new InvalidPolynomialSyntax("Error: Invalid Polynomial Syntax, Negative exponents, check input");
        }
        Term current = head;
        if(current == null){ 
            head = new Term(coefficient, exponent);
            head.next = null;
        } 
        else { 
            while(current.next != null){
                current = current.next;
            }
            current.next = new Term(coefficient, exponent);
        }

    }

    /*
     * A compareTo method that compares two polynomials.  If their highest exponents are the 
     * same, their coefficients are compared. If two polynomials have the same highest order exponent with the
     * same coefficients the next highest exponent is examined, and so on.
     */
    @Override
    public int compareTo(Polynomial otherPoly) {
        Term thisCurrent = this.head;
        Term otherCurrent = otherPoly.head;

        while (thisCurrent != null && otherCurrent != null){
            //If the two polynomials have different highest 
            //order exponents, the one with the highest exponent is the greatest.
            if (thisCurrent.getExponent() != otherCurrent.getExponent()){
                return thisCurrent.getExponent() - otherCurrent.getExponent();
            }
            else if(thisCurrent.getCoefficient() != otherCurrent.getCoefficient()) {
                if(otherCurrent.getCoefficient()> thisCurrent.getCoefficient()){
                    return -1;
                }
                else if(otherCurrent.getCoefficient()< thisCurrent.getCoefficient()){
                    return +1;
                }
            }
            thisCurrent = thisCurrent.getNext();
            otherCurrent = otherCurrent.getNext();
        }//if both are null they are equal
        if (thisCurrent == null && otherCurrent == null){
            return 0;
        }//If two polynomials have the same highest order exponent with the
         //same coefficients the next highest exponent is examined, and so on.
        if (thisCurrent == null){
            return -1;
        }else {
            return +1;
        }
    }
    //If the exponents are the same...
    public int compareExponents(Polynomial poly2) {
        Term thisPolyTerm = this.head;
        Term otherPolyTerm = poly2.head;
        while(thisPolyTerm != null && otherPolyTerm != null) {
            if (thisPolyTerm.getExponent() != otherPolyTerm.getExponent()) {
                return thisPolyTerm.getExponent() - otherPolyTerm.getExponent();
            }
            else {
                thisPolyTerm = thisPolyTerm.getNext();
                otherPolyTerm = otherPolyTerm.getNext();
            }
        }
        if(thisPolyTerm == null && otherPolyTerm == null){
            return 0;
        }
        if (otherPolyTerm == null){
            return +1;
        }
        else {
            return -1;
        }
    }

    public Polynomial() { 
        compare = (Polynomial poly1, Polynomial poly2) -> poly1.compareExponents(poly2); 
        }
    public Polynomial(Comparator<Polynomial> compare){ 
        this.compare = compare; 
        }

    @Override
    public Iterator<Object> iterator() {
        return new Iterator() {

            private Term current = getHead();

            @Override
            public boolean hasNext() {
                return current != null && current.getNext() != null;
            }

            @Override
            public Term next() {
                Term data = current;
                current = current.next;
                return data;
            }
        };
    }

    @Override
    public String toString() {
        StringBuilder expressionBuilder = new StringBuilder();
        //first check head to avoid +1x^3 +3x^2
        if (head.coefficient > 0){
            expressionBuilder.append(head.toString());
        }
        else {
            expressionBuilder.append(" - ").append(head.toString());
        }
        for(Term tmp = head.next; tmp != null; tmp = tmp.next) {
            if (tmp.coefficient < 0) {
                expressionBuilder.append(" - ").append(tmp.toString());
            } 
            else {
                expressionBuilder.append(" + ").append(tmp.toString());
            }
        }
        return expressionBuilder.toString();

    }

    static class Term{
        private double coefficient;
        private int exponent;
        private Term next;

        private Term(double c, int e) {
            coefficient = c;
            exponent = e;
            next = null;
        }

        private int getExponent(){
            return this.exponent;
        }
        private double getCoefficient(){
            return this.coefficient;
        }
        private Term getNext(){
            return next;
        }

        @Override
        public String toString(){
            String termString = String.format("%.1f", Math.abs(coefficient));
            if (exponent == 0) { 
                return termString;
            }
            else if(exponent == 1){ 
                return termString + "x";
            } 
            else{
                return termString + "x^" + exponent;
            }
        }
    }

    private Term getHead() {
        return head;
    }
}

I don’t think this part needs anything changed to it but open to suggestions(mainly providing this so the code compiles and runs)

OrderedList.Java

import java.util.*;

/*
 * The third class is OrderedList, which is a utility class 
 * that contains two overloaded implementations
 */
public class OrderedList {
    //Both methods should be class (static) methods.
    //The first of the overloaded methods should accept a list 
    //that contains elements that implement Comparable.
    public static <T extends Comparable<? super T>> 
    //two overloaded implementations of a method named checkSorted
    boolean checkSorted(List<T> list){
        boolean isSorted = true;

        for(int i = list.size()-1; i > 0 ; i--){
            T current = list.get(i);
            if(!checkSorted(list, current)){
                isSorted = false;
            }
        }
        return isSorted;
    }

    //The second should instead be supplied an additional 
    //parameter that is an object of a class that implements 
    //the Comparator interface
    private static <T extends Comparable<? super T>> 
            boolean checkSorted(List<T> list, T current) {

        
        T currentValue = list.get(list.indexOf(current));
        T nextValue = list.get(list.indexOf(current) - 1);

        if (nextValue != null) {

            return currentValue.compareTo(nextValue) >= 0; 
        }
        return true;
    }
}

Please ignore my notes, ha ha
Main.java

import javax.swing.*;
import java.io.*;
import java.util.*;

public class Main {

    private static List<Polynomial> polyList = new ArrayList<>();

    public static void main(String() args) {
        processPolyList();
    }

    public static ArrayList<String> fromFile() {
        //Create ArrayList and JFileChooser
        ArrayList<String> expressionList = new ArrayList<>();
        JFileChooser chooser = new JFileChooser();
        //Show directories and files
        chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        //user's current directory
        chooser.setCurrentDirectory(new File(System.getProperty("user.dir")));
        int response = chooser.showOpenDialog(null);
        if (response == JFileChooser.APPROVE_OPTION){
            File file = chooser.getSelectedFile();
            try {
                Scanner scan = new Scanner(file);
                if (file.isFile()){
                    while (scan.hasNextLine()){
                        String expression = scan.nextLine();
                        expressionList.add(expression);
                    }
                }
            }
            catch (NoSuchElementException a){
                JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"File is empty!");
            }
            catch(FileNotFoundException b){
                JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"404 File Not Found!");
            }
        }
        return expressionList;
    }

    public static boolean checkWeakOrder( List<Polynomial> polyList){
        boolean isWeakOrder = true;
        Polynomial previous = polyList.get(polyList.size()-1);
        for(int i = polyList.size()-2; i > 0; i--){

            if (previous.compareExponents(polyList.get(i)) < 0){
                isWeakOrder = false;
            }
        }
        return isWeakOrder;
    }

    public static void processPolyList(){
        try {
            ArrayList<String> a = fromFile();
            for (String element : a) {
                Polynomial p = new Polynomial(element);
                System.out.println(p);
                polyList.add(p);
            }
        }
        catch (InvalidPolynomialSyntax ex){
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),ex.getMessage());
        }

        System.out.println("This list is sorted by the strong order: " + OrderedList.checkSorted(polyList));
        System.out.println("This list is sorted by the weak order: " + checkWeakOrder(polyList));
    }
}

InvalidPolynomialSyntax.java


/*
 * The second class is InvalidPolynomialSyntax, which defines an 
 * unchecked exception that contains a constructor that allows a 
 * message to be supplied. It is thrown by the constructor of 
 * the Polynomial class should the supplied string contain 
 * coefficients or exponents of an improper type or should the 
 * exponents fail to be listed in strictly descending order.
 */
public class InvalidPolynomialSyntax extends RuntimeException {
    
    InvalidPolynomialSyntax(String message){
        super(message);
    }
}
```

python – Genetic algorithm to guess coefficient of a polynomial

I have tried to code a genetic algorithm to guess the coefficients of a degree 4 polynomial. The information initially provided is values of y = f(x) for different x using the original polynomial. I then generate 100 polynomials with randomly selected coefficients. These polynomials are then ranked based on the least square difference (LSD) and sorted such that lower LSD has higher rank. These ranks are then converted into nonlinear ranking and mapped to a line of unit length. Individuals are then selected and real valued crossover is used to generate progeny, who are also sorted according to LSD. The worst individuals in the starting pool are then replaced by progeny.
Please suggest improvements where possible. I am intermediate in Python.

"""
Genetic Algorithm implementation of finding coefficients of a polynomial
3.0 - 4.3 * x + 5.9 * x ** 2 - 5.2 * x ** 3 + 1.0 * x ** 4 = 0
"""

#%% import modules
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy

# np.set_printoptions(linewidth=np.inf)


#%% define a function to return the polynomial
def poly(x):
    return 3.0 - 4.3 * x + 5.9 * x ** 2 - 5.2 * x ** 3 + 1.0 * x ** 4


def gen_poly(array, x):
    return (
        array(0)
        + array(1) * x
        + array(2) * x ** 2
        + array(3) * x ** 3
        + array(4) * x ** 4
    )


#%% define function to measure fitness
### takes an array as input and fills the last column with fitness values
### take care to always keep one column for fitness values in starting array
### output is an array sorted by fitness
def fitness(array):
    # set initial values
    initial = np.array(
        (
            (-5, 1447.0),
            (-4, 703.4),
            (-3, 290.4),
            (-2, 92.8),
            (-1, 19.4),
            (0, 3),
            (1, 0.4),
            (2, -7.6),
            (3, -16.2),
            (4, 3.4),
            (5, 104),
        )
    )
    # score is the total square deviation from initial. lower is better
    for ind in array:
        fitness = 0
        for x, y in zip(initial(:, 0), initial(:, 1)):
            fitness += (
                (
                    ind(0)
                    + ind(1) * x
                    + ind(2) * x ** 2
                    + ind(3) * x ** 3
                    + ind(4) * x ** 4
                )
                - y
            ) ** 2
        ind(5) = fitness
    return array(array(:, 5).argsort())


#%% function to give non linear rank to sorted pool
def nl_rank(array):
    copy = deepcopy(array)
    # normalization factor for selection pressure 3 and individuals 50
    norm = 290.3359045831912
    # setting ranks based on position in the pool
    for i, j in enumerate(copy):
        j(-1) = 50 * 1.06 ** (49 - i) / norm
    return copy


#%% define function to carry out stochastic universal sampling
### takes non linear ranked array as input
### output is list of selected individuals
def sel_ind(nl_array):
    copy = deepcopy(nl_array)
    # normalize ranks
    norm = sum(copy(:, -1))
    copy(:, -1) = copy(:, -1) / norm

    # map intervals on range (0, 1)
    prob_list = list(copy(:, -1))
    intervals = ()
    start = 0
    for prob in prob_list:
        end = start + prob
        intervals.append((start, end))
        start = end

    # selecting 6 individuals from the intervals
    rng = np.random.default_rng()
    points = (rng.uniform(0, 1 / 5))
    for i in range(4):
        points.append(points(-1) + 1 / 5)
    index, i = (), 0
    for point in points:
        for j in range(i, len(intervals)):
            if intervals(j)(0) < point < intervals(j)(1):
                index.append(j)
                i = j
                break
    return index


#%% define function to carry out mating. only unique pairings are considered
### each mating gives 2 children
def crossover(array, individuals):
    rng = np.random.default_rng()
    progeny = np.empty((0, 6))
    for i in range(len(individuals) - 1):
        for j in range(i + 1, len(individuals)):
            mate1 = rng.uniform(-0.25, 1.25, (1, 5)).squeeze()
            mate2 = rng.uniform(-0.25, 1.25, (1, 5)).squeeze()
            mutation1 = rng.uniform(-0.025, 0.025, (1, 5)).squeeze()
            mutation2 = rng.uniform(-0.025, 0.025, (1, 5)).squeeze()
            baby1 = (
                array(i, :5) * mate1 + array(j, :5) * (1 - mate1) + mutation1 * mate1
            )
            baby1 = np.append(baby1, 0)
            progeny = np.append(progeny, (baby1), axis=0)
            baby2 = (
                array(j, :5) * mate2 + array(i, :5) * (1 - mate2) + mutation2 * mate2
            )
            baby2 = np.append(baby2, 0)
            progeny = np.append(progeny, (baby2), axis=0)
    return fitness(progeny)


#%% helper function to print arrays to log
def arr_print(arr, count):
    print(f"#loop_count = {count}")
    print(arr)


#%% main
if __name__ == "__main__":
    # create rng instance
    rng = np.random.default_rng()

    # create parent pool
    # parent pool has 5 columns for coefficients and one for fitness
    pool = rng.uniform(-50, 50, (50, 6))

    # measure fitness of each parent and sort in decreasing order of fitness
    pool = fitness(pool)
    starting_fitness = pool(0, 5)

    # plotting the original curve
    plt.ion()
    fig, ax = plt.subplots()
    x = np.linspace(-5, 5, 200)
    ax.plot(x, poly(x), "r", lw=1, label="Original")
    ax.set_xlabel("X axis")
    ax.set_ylabel("Y axis")
    ax.set_ylim(-1000, 1000)
    ax.set_title("Comparision of curves")
    ax.legend()

    loop_count = 1

    while True:
        # plotting
        if loop_count == 1:
            ax.plot(x, gen_poly(pool(0, :), x), lw=1, label=f"Iteration = {loop_count}")
            ax.legend()
            fig.canvas.draw()
            plt.pause(0.0001)
            # arr_print(pool, loop_count)
        elif loop_count % 100 == 0:
            ax.plot(x, gen_poly(pool(0, :), x), lw=0.25, ls="solid")
            fig.canvas.draw()
            plt.pause(0.0000001)
            # arr_print(pool, loop_count)
        # add termination condition
        elif pool(0, 5) < 0.005:
            ax.plot(
                x,
                gen_poly(pool(0, :), x),
                "k",
                lw=1.5,
                label=f"Iteration = {loop_count}",
            )
            ax.set_xlim(-2, 5)
            ax.set_ylim(-40, 75)
            ax.legend()
            fig.canvas.draw()
            plt.pause(0.001)
            # arr_print(pool, loop_count)
            break
        # rank parents based on non linear ranking
        ranked = nl_rank(pool)

        # select individuals
        individuals = sel_ind(ranked)

        # create progeny
        progeny = crossover(ranked, individuals)

        # remove 20 worst individuals from pool
        pool = np.delete(pool, np.s_(-20:), axis=0)

        # add progeny to the new pool
        pool = np.vstack((pool, progeny(:20, :)))

        # sort pool according to fitness
        pool = pool(pool(:, 5).argsort())

        loop_count += 1

    print(starting_fitness, pool(0, 5))

```

The shuffle algebra over the rationals is isomorphic to the polynomial algebra in the Lyndon words

On this wikipedia page is stated that over the rational numbers, the shuffle algebra (over a set $X$) is isomorphic to the polynomial algebra in the Lyndon words (on $X$). I was wondering if you can show me a proof of this or give me a reference. Ideally I am looking for an explicit isomorphism between these two algebras.

polynomial reduction within Np

If $A le_p B$ and $Bin NP$, does it necessarily follow that $Ain NP$?

A quick yes/no comment is enough, a proof would be nice :-]

Best way to simplify a polynomial before making it the body of a function?

So, I’m dealing with iterated polynomials of a single variable—say they’re anonymous functions labeled as $p_i$, i.e. p(1), p(2), etc., and that these have explicit definitions. I’d like to compose a list of these, collect the terms, and then make the result an anonymous function. So, one way I have of doing this, with some example polynomials, is

indexlist0 = {1, 3, 2};
p(1) = (#^2 + 1 &);
p(2) = (#^3 + 3 # - 1 &);
p(3) = (5 # - 2 &);

polycompose1(indexlist_List) := Construct(Function, Collect((Composition @@ p /@ indexlist)(#), #))

polycompose1(indexlist0)

(* Out: 50 - 210 #1 + 225 #1^2 - 70 #1^3 + 150 #1^4 + 25 #1^6 & *)

(* Contrast with Composition @@ p /@ indexlist0,
   which gives simply (#1^2 + 1 &)@*(5 #1 - 2 &)@*(#1^3 + 3 #1 - 1 &). *)

I’m a bit worried about whether the unbound Slot could “leak” somehow, or maybe get bound by some other Function in some contexts before it has a chance to get bound by the Function in Construct.

Another way I have of doing this is

polycompose2(indexlist_List) := Block({x}, 
 With({body = Collect((Composition @@ p /@ indexlist)(x), x)}, 
  Function(x, #) & @ body))

Block({a},
  polycompose1(indexlist0)(a) === polycompose2(indexlist0)(a))

(* Out: True *)

This seems safer, but again, I’m not sure if one is better than the other, especially if I’m doing this many times and want to avoid unnecessary Withs.

EDIT: Yet another way is

polycompose3(indexlist_List) := 
 MapAt(Evaluate, 
  Function(Collect((Composition @@ p /@ indexlist)(#), #)), 1)

polycompose3(indexlist0) === polycompose1(indexlist0)

(* Out: True *)

from this answer, which I like quite a bit, and feels “safe”.

So, my questions are:

  • Is there anything actually “unsafe” about polycompose1? (Or, for that matter, either of the other two options?) It seems there might be, but I’m not sure.

  • Are there any “safer” and more efficient ways to accomplish this, or are the given ways sufficient? (This part was more relevant before I found the other answer; I think polycompose3 is ok.)

This question is primarily about the safest way to do this, and more specifically whether the first option can be realized as unsafe, not about how to accomplish the task per se. (So, just to pre-empt it, I don’t think this is a duplicate.)

Thanks!

nt.number theory – Polynomial with many integer but no rational solutions?


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




fitting – Find order of polynomial approximation and LeastSquares for given datapoints

I have a set of data, where I’d like to find the order of the polynomial that approximates the data, and also know what the Least squares is.

My data:

mydata={{30., 330.579}, {30.1, 326.98}, {30.2, 325.764}, {30.3, 
  311.321}, {30.4, 284.364}, {30.5, 316.126}, {30.6, 298.781}, {30.7, 
  294.901}, {30.8, 272.735}, {30.9, 268.916}, {31., 289.105}, {31.1, 
  269.206}, {31.2, 264.915}, {31.3, 266.102}, {31.4, 247.691}, {31.5, 
  269.225}, {31.6, 237.507}, {31.7, 243.386}, {31.8, 244.549}, {31.9, 
  227.996}, {32., 219.76}, {32.1, 225.659}, {32.2, 213.498}, {32.3, 
  204.988}, {32.4, 209.632}, {32.5, 205.647}, {32.6, 196.185}, {32.7, 
  212.885}, {32.8, 190.335}, {32.9, 181.173}, {33., 180.167}, {33.1, 
  161.973}, {33.2, 172.964}, {33.3, 166.16}, {33.4, 158.963}, {33.5, 
  156.729}, {33.6, 165.902}, {33.7, 149.723}, {33.8, 153.449}, {33.9, 
  138.211}, {34., 149.906}, {34.1, 135.848}, {34.2, 121.235}, {34.3, 
  128.755}, {34.4, 112.94}, {34.5, 110.743}, {34.6, 126.014}, {34.7, 
  108.869}, {34.8, 120.106}, {34.9, 115.747}, {35., 104.896}, {35.1, 
  97.7707}, {35.2, 101.916}, {35.3, 106.835}, {35.4, 98.4623}, {35.5, 
  91.2834}, {35.6, 79.0194}, {35.7, 84.4551}, {35.8, 80.7674}, {35.9, 
  92.3399}, {36., 84.6718}, {36.1, 83.8532}, {36.2, 77.6169}, {36.3, 
  73.0614}, {36.4, 76.7545}, {36.5, 77.824}, {36.6, 54.9666}, {36.7, 
  72.2144}, {36.8, 61.6352}, {36.9, 58.8691}, {37., 71.0184}, {37.1, 
  59.047}, {37.2, 62.543}, {37.3, 50.5073}, {37.4, 50.0954}, {37.5, 
  51.4783}, {37.6, 49.1749}, {37.7, 44.4528}, {37.8, 57.2066}, {37.9, 
  52.8937}, {38., 51.6243}, {38.1, 50.2519}, {38.2, 42.1921}, {38.3, 
  43.7001}, {38.4, 36.1474}, {38.5, 54.591}, {38.6, 59.4826}, {38.7, 
  38.8052}, {38.8, 38.2085}, {38.9, 48.2973}, {39., 31.7328}, {39.1, 
  34.4054}, {39.2, 58.3053}, {39.3, 51.7763}, {39.4, 51.1076}, {39.5, 
  41.9908}, {39.6, 37.1393}, {39.7, 48.3501}, {39.8, 59.6842}, {39.9, 
  28.208}, {40., 36.0402}, {40.1, 37.8059}, {40.2, 43.7093}, {40.3, 
  59.0266}, {40.4, 41.977}, {40.5, 41.1998}, {40.6, 34.4874}, {40.7, 
  36.4598}, {40.8, 45.7132}, {40.9, 42.5813}, {41., 55.5001}, {41.1, 
  45.6231}, {41.2, 42.7797}, {41.3, 34.9816}, {41.4, 59.9555}, {41.5, 
  59.1558}, {41.6, 58.1503}, {41.7, 50.0516}, {41.8, 58.8706}, {41.9, 
  53.63}, {42., 64.3079}, {42.1, 73.0313}, {42.2, 50.954}, {42.3, 
  70.9397}, {42.4, 57.6454}, {42.5, 68.1575}, {42.6, 55.2259}, {42.7, 
  80.7216}, {42.8, 74.3722}, {42.9, 70.1185}, {43., 85.038}, {43.1, 
  69.8574}, {43.2, 98.6267}, {43.3, 72.675}, {43.4, 90.1846}, {43.5, 
  85.838}, {43.6, 89.8398}, {43.7, 87.8715}, {43.8, 96.5692}, {43.9, 
  94.8867}, {44., 93.2906}, {44.1, 107.817}, {44.2, 110.883}, {44.3, 
  113.482}, {44.4, 110.891}, {44.5, 125.85}, {44.6, 117.684}, {44.7, 
  120.996}, {44.8, 109.709}, {44.9, 123.845}, {45., 121.603}, {45.1, 
  133.1}, {45.2, 124.626}, {45.3, 157.}, {45.4, 128.777}, {45.5, 
  152.501}, {45.6, 141.194}, {45.7, 164.115}, {45.8, 158.063}, {45.9, 
  162.978}, {46., 167.955}, {46.1, 173.832}, {46.2, 175.932}, {46.3, 
  179.225}, {46.4, 194.457}, {46.5, 187.11}, {46.6, 184.621}, {46.7, 
  196.59}, {46.8, 193.341}, {46.9, 229.232}, {47., 217.943}, {47.1, 
  212.923}, {47.2, 214.198}, {47.3, 213.599}, {47.4, 228.405}, {47.5, 
  219.229}, {47.6, 227.861}, {47.7, 236.055}, {47.8, 251.976}, {47.9, 
  244.459}, {48., 263.105}, {48.1, 258.907}, {48.2, 276.987}, {48.3, 
  260.376}, {48.4, 273.986}, {48.5, 285.245}, {48.6, 282.607}, {48.7, 
  280.599}, {48.8, 299.848}, {48.9, 312.727}, {49., 309.721}, {49.1, 
  302.612}, {49.2, 325.601}, {49.3, 318.055}, {49.4, 330.583}, {49.5, 
  336.413}, {49.6, 332.563}, {49.7, 357.118}, {49.8, 356.767}, {49.9, 
  351.579}, {50., 378.437}}

I started with plotting:

data:

My idea was then to create a Table containing exponentials (1, x, x^2, x^3…), and fit a function using the Fit method.


expo(n_) := Table(x^k, {k, 0, n})
approx = Fit(mydata, expo(5), x) #example using order 5

Visualizing my result (here with order=5):

Show(dataplott, Plot(approx, {x, 30, 50}))

Order=3

If my approach is correct, I don’t know how to incorporate a range of evaluation numbers and see which is the best.

I also have been looking a bit at the Interpolation method:

interapprox = Interpolation(mydata)
interplot = Plot(interapprox((FormalX)), {(FormalX), 30., 50.}, 
  PlotStyle -> Gray)
Show(dataplott, interplot)

This gives me an approximation output that looks pretty nice, but the InterpolationOrder seems to be default=3, so I’m not sure if this actually works (or perhaps how it works).

Output:

outputplot

Preferably I’m seeking a solution that also lets me get the Least Squares.

I might add that I’m rather new to linear algebra & mathematica, so apologies for any blunders.
Ciao.

calculus – Find the second Taylor polynomial of f

I want to find the second degree Taylor polynomial of
begin{equation}
f=
left{
begin{array}{lr}
exp{frac{-1}{x^2+y^2}} & , (x,y)neq(0,0) \
0 & ,(x,y)=(0,0)
end{array}
right.
end{equation}

I know the first step is to calculate the first partial derivatives at 0.
However, $frac{e^{frac{-1}{h^2}}}{h}toinfty$ as $h to 0$
and I don’t know how to proceed.

functional analysis – Norm of a polynomial and its polar

I’ve been struggling so hard with this problem and I can’t find a solution. The problem says:

Let $(H,lVertcdotrVert)$ be a complex Hilbert space, and let $Hoplus_inftymathbb{C}:=Htimes mathbb{C}$ with the norm $lVert (x,lambda)rVert_infty:=max{lVert xrVert, |lambda| }$. Prove that, for any $n$-homogeneous polynomial $P$ on $Hoplus_inftymathbb{C}$ and its polar form $L$, it verifies that $lVert PrVert=lVert LrVert$.

I’ve tried to use the fact that $Hoplus_inftymathbb{C}$ contains $H$ as a hyperplane, and that, for a complex Hilbert space, the norm of a homogeneous polynomial and its dual coincide, but I’ve got nowhere.

Any help or suggestion would be really appreciated. Thanks a lot in advance.