equation resolution – complicated polynomial taking forever

I'm trying to solve this very complex polynomial equation for x, but it takes too much time or I get an error message. No suggestion?

FindRoot (((g + 0.4 * (1/s)) ((log (k * (1 + x)e ^ -r)) /k + (r + (s ^ 2) /2) -s) -0,16 (1/s) ((log (k(1 + x)e ^ -r)) /k + (r + (s ^ 2) / 2) -s) ^ 3 + 0.025 (1/s) ((log (k(1 + x)e ^ -r)) /k + (r + (s ^ 2) / 2) -s) ^ 5-0.003 (1/s) ((log (k(1 + x)e ^ -r)) /k + (r + (s ^ 2) / 2) -s) ^ 7)) ((0.4(1/s) ((log (k * (1 + x)e ^ -r)) /k + (r + (s ^ 2) 2)) – 0,16 (1/s) ((log (k(1 + x)e ^ -r)) /k + (r + (s ^ 2) 2)) ^ 3 + 0.025 (1s) ((log (k(1 + x)e ^ -r)) /k + (r + (s ^ 2) 2)) ^ 5-0.003 (1/s) ((log (k(1 + x) * e ^ -r)) k + (r + (s ^ 2) 2)) ^ 7)) == x, {x}, real)

drivers – How to increase the resolution on the ZOTAC ZBOX-CI549 NANO?

I need to set a higher resolution on my Zotac XBOX. Here is the list of resolutions that I see in the drop-down list:

enter the description of the image here

I have to select this resolution 1680×1080. Currently, if I select it, it does not work and returns to the currently selected 1280×800. This resolution is supported by Windows on the same PC and I have also clearly seen it working when first connecting to Ubuntu after installation. But later, it went to 1280×800. This is the output of my xrandr:

enter the description of the image here

I've added this last line of CVT, but as I said earlier, it does not work:

enter the description of the image here

It looks like I need to change something in the video driver, but there is no Linux driver on the ZOTAC website. Also, there is no driver here:

enter the description of the image here

What can I try to do? I remember very well that this resolution worked successfully on this Ubuntu 18 with this hardware.

How to make my sudoku resolution algorithm backtrack faster in Python?

I wrote a Sudoku solving algorithm in the background in Python.
It solves a 2D array like this (zero means "empty field"):

(
  (7, 0, 0, 0, 0, 9, 0, 0, 3),
  (0, 9, 0, 1, 0, 0, 8, 0, 0),
  (0, 1, 0, 0, 0, 7, 0, 0, 0),
  (0, 3, 0, 4, 0, 0, 0, 8, 0),
  (6, 0, 0, 0, 8, 0, 0, 0, 1),
  (0, 7, 0, 0, 0, 2, 0, 3, 0),
  (0, 0, 0, 5, 0, 0, 0, 1, 0),
  (0, 0, 4, 0, 0, 3, 0, 9, 0),
  (5, 0, 0, 7, 0, 0, 0, 0, 2),
)

like that:

(
  (7, 5, 8, 2, 4, 9, 1, 6, 3), 
  (4, 9, 3, 1, 5, 6, 8, 2, 7), 
  (2, 1, 6, 8, 3, 7, 4, 5, 9),
  (9, 3, 5, 4, 7, 1, 2, 8, 6),
  (6, 4, 2, 3, 8, 5, 9, 7, 1), 
  (8, 7, 1, 9, 6, 2, 5, 3, 4), 
  (3, 2, 7, 5, 9, 4, 6, 1, 8), 
  (1, 8, 4, 6, 2, 3, 7, 9, 5), 
  (5, 6, 9, 7, 1, 8, 3, 4, 2)
)

But for the "difficult" Sudokus (where there are many zeros at the beginning), it's quite slow. It takes about 9 seconds for the algorithm to solve the Sudoku above. It's way better than what I started doing (90 seconds), but still slow.

I think the "deep copy" can be improved / replaced (as it is executed 103,073 times in the example below), but my basic approaches have been slower.

I've heard about C / C ++ solutions of 0.01 second, but I do not know if these are backtracking algorithms of a mathematical solution …

This is my entire algorithm with 2 examples of Sudokus:

from copy import deepcopy

def is_sol_row(mat,row,val):
  m = len(mat)
  for i in range(m):
    if mat(row)(i) == val:
      return False
  return True

def is_sol_col(mat,col,val):
  m = len(mat)
  for i in range(m):
    if mat(i)(col) == val:
      return False
  return True

def is_sol_block(mat,row,col,val):
  rainbow = (0,0,0,3,3,3,6,6,6)
  i = rainbow(row)
  j = rainbow(col)
  elements = {
    mat(i + 0)(j + 0), mat(i + 1)(j + 0), mat(i + 2)(j + 0),
    mat(i + 0)(j + 1), mat(i + 1)(j + 1), mat(i + 2)(j + 1),
    mat(i + 0)(j + 2), mat(i + 1)(j + 2), mat(i + 2)(j + 2),
  }
  if val in elements:
    return False
  return True

def is_sol(mat,row,col,val):
  return is_sol_row(mat,row,val) and is_sol_col(mat,col,val) and is_sol_block(mat,row,col,val)

def findAllZeroIndizes(mat):
  m = len(mat)
  indizes = ()
  for i in range(m):
    for j in range(m):
      if mat(i)(j) == 0:
        indizes.append((i,j))
  return indizes

def sudoku(mat):
  q = ((mat,0))
  zeroIndizes = findAllZeroIndizes(mat)
  while q:
    t,numSolvedIndizes = q.pop()
    if numSolvedIndizes == len(zeroIndizes):
      return t
    else:
      i,j = zeroIndizes(numSolvedIndizes)
      for k in range(1,10):
        if is_sol(t,i,j,k):
          newt = deepcopy(t)
          newt(i)(j) = k
          q.append((newt,numSolvedIndizes+1))
  return False


mat = (
  (7, 0, 0, 0, 0, 9, 0, 0, 3),
  (0, 9, 0, 1, 0, 0, 8, 0, 0),
  (0, 1, 0, 0, 0, 7, 0, 0, 0),

  (0, 3, 0, 4, 0, 0, 0, 8, 0),
  (6, 0, 0, 0, 8, 0, 0, 0, 1),
  (0, 7, 0, 0, 0, 2, 0, 3, 0),

  (0, 0, 0, 5, 0, 0, 0, 1, 0),
  (0, 0, 4, 0, 0, 3, 0, 9, 0),
  (5, 0, 0, 7, 0, 0, 0, 0, 2),
)

# mat = (
#   (3, 0, 6, 5, 0, 8, 4, 0, 0),
#   (5, 2, 0, 0, 0, 0, 0, 0, 0),
#   (0, 8, 7, 0, 0, 0, 0, 3, 1),
#   (0, 0, 3, 0, 1, 0, 0, 8, 0),
#   (9, 0, 0, 8, 6, 3, 0, 0, 5),
#   (0, 5, 0, 0, 9, 0, 6, 0, 0),
#   (1, 3, 0, 0, 0, 0, 2, 5, 0),
#   (0, 0, 0, 0, 0, 0, 0, 7, 4),
#   (0, 0, 5, 2, 0, 6, 3, 0, 0)
# )

print(sudoku(mat))

novice – Resolution of the Kruskal algorithm with the help of Python

That's the problem of Uva online judge. Visit https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975

In an episode of the show Dick Van Dyke, little Richie connects the
freckles on his father's back to form an image of the bell of freedom.
Alas, one of the freckles turns out to be a scar. His Ripley's
the commitment falls through. Consider Dick's return as a plane with
freckles at various (x, y) Locations. Your job is to tell Richie how
connect the dots to minimize the amount of ink used. Richie
connects the points by drawing straight lines between pairs, possibly
lift the pen between the lines. When Richie has finished, there must be a
sequence of connected lines from one freckle to another freckle.

Contribution

The entry starts with a single positive integer on a single line
indicating the number of following cases, each of them being
described below. This line is followed by a white line and there is
also an empty line between two consecutive entries. The first line
contains 0 < n ≤ 100, the number of freckles on Dick's back. For each
freckle, a line follows; each next line contains two real numbers
indicating the (x, y) coordinates of the freckle.

Exit

For each test case, the output must follow the description below. the
the outputs of two consecutive cases will be separated by a blank line.
Your program prints a single real number with two decimal places: the
total minimum length of ink lines that can connect all freckles.

I passed it, but when I see the code, it seems really messy. I am probably a beginner in algorithm and python. I want to keep the format of having Edge and Freckle class for some reasons.

can you give me some tips to make it more functional or improve performance?

Thank you in advance.

import math
import sys

class Freckle:

    def __init__(self, freckle_id, x_position, y_position):
        self.freckle_id = freckle_id
        self.x_position = x_position
        self.y_position = y_position


class Edge(object):

    def __init__(self, edge_id,  start_freckle, to_freckle, weight):
        self.edge_id = edge_id
        self.start_freckle = start_freckle
        self.to_freckle = to_freckle
        self.weight = weight
        self.spanning_tree = False





def assign_weight(freckle_list, edge_list):

    # for one in range(0, len(freckle_list)-1, 1):
    #     for two in range(one+1, len(freckle_list)):
    #         weight = euclidean_distance(freckle_list(one), freckle_list(two))
    #         edge = Edge(freckle_list(two), euclidean_distance(freckle_list(one), freckle_list(two)))
    #         freckle_list(one).edge_list.append(edge)
    edge_id = 0
    for one in range(0, len(freckle_list)-1):
        for two in range(1, len(freckle_list), 1):
            weight = euclidean_distance(freckle_list(one), freckle_list(two))
            if weight == 0:
                continue
            else:
                edge = Edge(edge_id, freckle_list(one), freckle_list(two), weight)
                edge_list.append(edge)
            edge_id +=1


def euclidean_distance(edge_one, edge_two):
    distance = math.sqrt((edge_one.x_position-edge_two.x_position)**2 +(edge_one.y_position-edge_two.y_position)**2)
    return distance


def kruskal(answer_list, freckle_list, freckle_num):
    edge_list = list()
    assign_weight(freckle_list, edge_list)
    union_find = UnionFind(len(edge_list))
    mst_tree = list()
    edge_list.sort(key=lambda one_edge: one_edge.weight)
    for edge in edge_list:
        if not edge.spanning_tree:
            if union_find.find_set(edge.start_freckle.freckle_id) != union_find.find_set(edge.to_freckle.freckle_id):
                mst_tree.append(edge)
                if len(mst_tree) == freckle_num - 1:
                    edge.spanning_tree = True
                union_find.merge_set(edge.start_freckle.freckle_id, edge.to_freckle.freckle_id)
            edge_list.sort(key=lambda one_edge: one_edge.weight)
        else:
            return
    total = 0
    for x in mst_tree:
        total += x.weight

    answer_list.append(round(total, 2))



class UnionFind:

    def __init__(self, freckle_num):
        self.parent = None
        self.create_set(freckle_num)

    def create_set(self, freckle_num):
        self.parent = list(range(freckle_num))
    ## parent(0) = 0, parent(1)=1 ...

    def find_set(self, freckle_num):
        if self.parent(freckle_num) != freckle_num:
            self.parent(freckle_num) = self.find_set(self.parent(freckle_num))
        return self.parent(freckle_num)

    ##who is the parent of freckle number 3? , then it should return which is the root

    def merge_set(self, one_freckle, two_freckle):
        self.parent(self.find_set(one_freckle)) = self.find_set(two_freckle)

    ##merge it. For example... parent(0) = 0, 1

def main():
    answer_list = list()

    freckle_list = list()
    case_num = sys.stdin.readline()
    case_num = int(case_num)

    for num in range(0, case_num):
        freckle_list = list()
        skip_blank = sys.stdin.readline()
        freckle_num = int(sys.stdin.readline())
        for one_freckle in range(0, freckle_num):
            positions = sys.stdin.readline()
            positions = positions.rstrip('n')
            positions = positions.split(" ")
            x_position = float(positions(0))
            y_position = float(positions(1))
            freckle = Freckle(one_freckle, x_position, y_position)
            freckle_list.append(freckle)
        # if num == 0:
        #     sys.stdout.write("n")
        kruskal(answer_list, freckle_list, freckle_num)
    count = 0
    for answer in answer_list:
        #sys.stdout.write(str(answer))
        print(answer)
        if count < len(answer_list)-1:
            print()
        count +=1


if __name__ == "__main__":
    main()

contribution

3

5
1.0 1.0
3.0 1.0
1.0 3.0
5.0 4.0
7.0 7.0

4
1.0 1.0
-1.0 1.0
-1.0 -1.0
1.0 -1.0

6
3.0 3.0
5.0 -2.0
8.0 4.0
12.5 -3.0
-5.0 -1.0
0.0 0.0

expected production


11.21

6.00

27.39
```

mathematica – MATLAB ODE Resolution System with ODE45

In my class, we need to develop a matlab script that determines solutions to specific ODEs. The following ODE system is as seen below in the picture, with the following question;

Picture

I can not understand how to use ODE45 even with the integrated MATLAB help function. I have watched countless videos but they do not explain it too well for my level at least. My current code is as seen below;

function (t, x, y, z) = Ass3 (sigma, beta, rho, tmax, x0, y0, z0);
t = 0;
x = (x0 y0 z0);
function (ode) = yeet (rho, beta, sigma)
ode = @ (t, x) (sigma * (x (2) -x (1)) x (1)(rhox (3)); x (1)x (2) -betax (3));
end

(t, x, y, z) = ode45 (yeet (rho, beta, sigma), (0 tmax), (x0, y0, z0));

end

Any help is welcome :).
Thanks in advance!

Equation Resolution – Reduced Analytic Maximization Fails to Solve

I'm working on an interesting problem, but I'm stuck on a step on which Mathematica fails (regardless of the angle at which I'm trying to get it).

I'm trying to find the symbolic maximum of this convex function (relative to DY):

PArbNegDY(K0_, Y0_, S0_, DY_, DS_, (Lambda)_) := -DY - (
  K0 (DS + S0) (-1 + (Y0/(DY + Y0))^(1/(Lambda))))/Y0

K0>0 && Y0>0 && S0>0 && DS>-S0 && 0<(Lambda)<=1

enter the description of the image here

So, I have differentiated regarding DY and I am now trying to solve it:

0 == -1 + (K0 (DS + S0) (Y0/(DY + Y0))^(-1 + 1/(Lambda)))/((DY + Y0)^2 (Lambda))

However, neither solve nor reduce give an answer (cut executions forever). Any help would be greatly appreciated.

vpn – the DNS resolution works for nslookup but fails in the browser when using the openconnect

Try to use openconnect connect to Cisco Anyconnect VPN.

I just did brew install openconnect and use it from the cmd line like this:

sudo openconnect –authgroup = VPN-SSL-GROUP -u FIRST_LAST@domain.com vpn.domain.com

Then I try to access resource.domain.com name of the private network and get:

  • in Chrome: DNS_PROBE_FINISHED_NXDOMAIN
  • in Network Utility -> Search: resource.domain.com -> The operation could not be completed. (Error 2. kCFErrorDomainCFNetwork.)

BUT this is set when I use nslookup from the command line:

nslookup resource.domain.com
Server:         10.66.0.1
Address:        10.66.0.1#53

Non-authoritative answer:
Name:    resource.domain.com
Address: 10.66.110.24

I decided to check the contents of /ect/resolv.conf:

nameserver 10.66.0.1
nameserver 10.66.0.2
nameserver 192.168.100.1 # (this is the DNS address of my home router)

and see that required DNS addresses used by nslookup are in place. (If I use a resolved address in a browser, I successfully access a private resource, so the routing works correctly)

I've googled a bit and learned that DNS resolution does not work as I can expect from Linux. There is a scutil utility that can help manage the actual DNS settings.

Here is a list of my DNS settings that I can see in scutil:

> list .*DNS
  subKey (0) = Setup:/Network/Service/47AA11B0-4713-41EF-B532-FC580ACD3E75/DNS
  subKey (1) = State:/Network/Global/DNS
  subKey (2) = State:/Network/MulticastDNS
  subKey (3) = State:/Network/PrivateDNS
  subKey (4) = State:/Network/Service/47AA11B0-4713-41EF-B532-FC580ACD3E75/DNS
  subKey (5) = State:/Network/Service/utun1/DNS # (this one appears when I am connected using openconnect)

The content of State:/Network/Global/DNS and State:/Network/Service/47AA11B0-4713-41EF-B532-FC580ACD3E75/DNS the keys match and are equal to:

 {
  ServerAddresses :  {
    0 : 10.66.0.1
    1 : 10.66.0.2
    2 : 192.168.100.1
  }
}

The content of State:/Network/Service/utun1/DNS (which exists only after the connection has been established with openconnect) is:

 {
  DomainName : location.domain.com
  SearchDomains :  {
    0 : location.domain.com
  }
  ServerAddresses :  {
    0 : 10.66.0.1
    1 : 10.66.0.2
  }
  SupplementalMatchDomains :  {
    0 : location.domain.com
  }
}

Other DNS-related keys are empty.

I've also tried going into Preferences -> Network -> my Wy-Fi connection -> Advanced and set the DNS addresses manually. Still does not work.

And I've also learned vpnc-script for openconnect. I found that it already existed on my machine and I tried to specify it explicitly:
--script /usr/local/etc/vpnc-script but that did not help to solve the private domains.

From what I see in scutil it seems to be properly configured, but for some reason the DNS resolution does not work. Ideas why? What can I check and try?

Equation Resolution – FindRoot: Power: Infinite Expression 1/0. meet

I'm trying to solve the problem below with FindRoot. At first, it works fine, but when I change the constants of my equation, the solver returns the following message: FindRoot: Power: Infinite Expression 1/0. meet. What does it mean? Is there no solution for the system with the new values ​​in e2?

Also when I put M -> 10 in data, another message appears for icmsol1: FindRoot: Failure to converge to the accuracy or precision requested within 100 iterations.

data = {M -> 1, To -> 280.5, T(Infinity) -> 254}

(Mu)v = {3.9300, 7.3663, 10.6438, 13.8624, 17.0535, 20.2295, 23.3965,
   26.5574, 29.7144, 32.8684}

fi = (To (Sin((Mu)(j)(0)) - Cos((Mu)(j)(0)) (Mu)(j)(0)))/(
 T(Infinity) (Mu)(j)(0)^2)

Ni((Tau)_, j_) = Integrate(Sin((Mu)(j)((Tau))*x)^2, {x, 0, 1})

fr = T1^3
f2 = 1/T1

e1 = Table((mi*
       Cos(mi) + ((1*fr - 1 - 0.5*f2) /. 
         T1 -> Sum(Sin((Mu)(j)(0))*(1/Ni(0, j))*fi, {j, M /. data}))*
       Sin(mi) == 0) /. mi -> (Mu)(i)(0), {i, M /. data})

e2 = Table((mi*
       Cos(mi) + ((0.00122275*fr - 0.879355 - 1.67153*f2) /. 
         T1 -> Sum(Sin((Mu)(j)(0))*(1/Ni(0, j))*fi, {j, M /. data}))*
       Sin(mi) == 0) /. mi -> (Mu)(i)(0), {i, M /. data})

CImsys = Table({(Mu)(i)(0), (Mu)v((i))}, {i, M /. data})

icmsol1 = FindRoot(e1 /. data, CImsys)

icmsol2 = FindRoot(e2 /. data, CImsys)

Ag.algebraic geometry – if it complains as a conifold resolution and if it waddles as a conifold resolution, $ ldots $

Assume that $ X $ is a triple projective with at worst singularities conifold and assumes $ omega_X $ commonplace. assume $ Y $ is a projective variety with a birational morphism $ f: Y to X $ which is an isomorphism of the points of conifold and such that $ f ^ {- 1} (p) = mathbb {P} ^ 1 $ for each point of conifold $ p in X $. Can I conclude that $ Y $ is smooth? it is to say that $ f: Y to X $ is a conifold resolution?

It sounds too good to be true, but I was unable to find a counterexample and it would be really helpful (at least for me) if that was true.

35 mm – Digitizing film negatives – Resolution, DPI and file size

dpi is about the inch … pixel by inch.

4500×3000 pixels at 3200 dpi equals 1.4 x 0.94 inches on the film.

4500×3000 pixels at 360 dpi corresponds to 12.5 x 8.33 inches on the printing paper. The spacing and size of the printed pixels. He should have shown dimensions in inches too.

It's a simple division … 4500 pixels / 360 dpi = 12.5 inches.

Exactly the same pixels, but simply adjusted to different thumb sizes on a film or paper backing. This is an extremely important basic principle of printing. Dpi is just a number that does not even exist until thumbs are declared.

For 4500×3000 pixels, the print size depends on the printed dpi …
If for example dramatic, at 100 dpi would be 45×30 inches.
If printed at 300 dpi, then 15 x 10 inches.
If the print is printed at 12×8 inches, then at 375 dpi.