performance tuning – Optimizing a series expansion for high order in $x$

I would like to expand the following function at $x sim 0$ up to some high $x_text{max} = Delta_text{max}$:

$$16 sum_{Delta=1}^{Delta_text{max}} sum_{s=0}^{Delta-2} f_{Delta,s} frac{(s+Delta)(1+s-Delta)}{(s-Delta)(1+s+Delta)} _2F_1 left(frac{1}{2},-s,frac{1}{2}-s,1right) _2F_1 left(frac{1}{2},2+Delta,frac{5}{2}+Delta,x^2 right) x^{2+Delta}, tag{1}$$

where $f_{Delta,s}$ are numerical coefficients. The series expansion should be performed after doing the following replacement (everywhere except in the subscript of $f_{Delta,s}$ and in the summation limits):

$$Delta to Delta + g^2 Delta^{(2)}_{Delta,s} + g^4 Delta^{(4)}_{Delta,s}, tag{2}$$

and expanding in $g$. Again the $Delta^{(k)}$ are numbers, which depend on $Delta$ and $s$. I am not interested in $log$ terms, which can be discarded by setting the rule $log x to 0$.

So far I wrote the following simple code:

(CapitalDelta)max=5;
(ScriptCapitalL)0s2 = 1/((s - (CapitalDelta)) (1 + s + (CapitalDelta))) 16 x^(2 + (CapitalDelta)) (1 + s - (CapitalDelta)) (s + (CapitalDelta)) Hypergeometric2F1(1/2, -s, 1/2 - s, 1) Hypergeometric2F1(1/2, 2 + (CapitalDelta), 5/2 + (CapitalDelta), x^2)
Sum(Series((f((CapitalDelta), s) Series((ScriptCapitalL)0s2 /. {(CapitalDelta) -> 
(CapitalDelta) + g^2 (CapitalDelta)2((CapitalDelta), s) + g^4 (CapitalDelta)4((CapitalDelta), s)}, {g, 0, 4}) /. {Log(x) -> 0} // Normal) /. {(CapitalDelta) -> (CapitalDelta)(CapitalDelta), s -> ss}, {x, 0, (CapitalDelta)max}) /. _?(N(#) == 0 &) :> 0 // Normal, {(CapitalDelta)(CapitalDelta), 2, (CapitalDelta)max}, {ss, 0, (CapitalDelta)(CapitalDelta) - 2})

Unfortunately this is insanely inefficient for high $Delta_text{max}$. For $Delta_text{max}=5$ the computation takes less than a second, for $Delta_text{max}=10$ about $20$ seconds, for $Delta_text{max}=15$ it took $3$ minutes,… I let it run the whole night yesterday to reach my goal, which is at least $Delta_text{max}=60$, and it was still running this morning!

Any suggestion how this expansion could be done (much) faster?

graphs – Can Johnson’s algorithm for simple cycles be modified in order to find only cycles up to length L (but all of them)?

I have a question regarding Johnson’s algorithm for finding all simple cycles in a graph.

I was wondering it is possible to modify the algorithm in order to find only cycles up to a given length.

After having read into the algorithm, my approach would the following:

Assume I want only cycles up to length L.
Then, if the stack has reached height L, if the current node on top of the stack is not a neighbor of the starting node, I treat it as having no neighbors left, i.e. I remove it again from the stack.

I am not deep enough into network theory, however, to be sure that this modification still guarantees me finding all simple cycles (up to length L).

opengl – Why does this order of Quaternion multiplication not introduce roll into my fps-style character controller?

I’m working on an OpenGL based project (in C#), employing Quaternions to rotate my camera I first tried to:

cameraOrientation = cameraOrientation * framePitch * frameYaw;

This accumulated an undesired roll in my cam-controller which made rotations unusable.
I found a post on stack exchange which suggested this reordering of operations:

cameraOrientation = framePitch * cameraOrientation * frameYaw;

Which completely solved this accumulation of roll. While I’m comfortable with matrix multiplication, I can’t seem to understand why this removes roll accumulation. Does anybody have any articles or images so I can grok what’s happening here?

It feels weird not to understand such a fundamental operation in my project.
Thanks!

Custom Sale Product add in order Magento 2?

In Magento 1 was extension or options to create custom sale product in order.

But in Magento 2 there is no extensions or oportunities to do that.

Maybe you can tell some ideas or some extensions for Magento 2?
enter image description here

Where to Order an Item online. | Proxies123.com

I have been using ‘amazon’ to purchase most of my digital product online, but recently this website seems to delayed my product each time I order an item with them,sometime my item will take long or exceed the specify days before its arrive my door step.
I need a good website that I can use now to purchase products and received it within the specify days of delivery.

rendering – Unity HDRP draw order doesn’t change when asset is set to higher priority?

I don’t like the way that light got baked into part of my mesh.
It might make sense for me to try to blacken that area of the lightmap in Photoshop, but first I tried to just hide it with a probuilder object that uses an unlit black material:

enter image description here

I changed the priority of this object from 0 to 1, higher than any object in this scene, or at least the floor object, but it does not draw over the floor in Game View. I tried using a higher number and setting it beneath the floor instead of intersecting it, but it is just being rendered the usual way. Also note that I have a UI Canvas component being drawn in ScreenSpace, in case that has anything to do with it.

How can I get this object to render in front of the floor while it is intersecting the two front faces, like in the picture?

magento2 – Magento 2 – REST API – How to create order for customer with admin token

I’m working on an app for Magento store. and I want to create an order for customers with my admin token.

I found 2 ways:

  1. To get the customer credentials (user name and password) and create a queue – But I can’t get all the users credentials.

  2. create a guest order but I didn’t find a way to add the customer’s id only email.

so the order is not linked to the customer’s orders history.

is there a way to create an order for customer with admin token? and link to order to the customer profile?

Thanks!

innodb – order by slowing down query with multiple joins and limit/offset on larger result sets

I am having trouble with the following query taking quite a long time to process when results are large. The limit and offset can change as this is used with pagination. The range on capture_timestamp can also change, but in this example is finding ALL results (between 0 and 9999999999 – this field is an int of utc timestamp). The issue seems to be the ORDER BY taking up most of the processing time. It looks like it uses user_id for the table join, but then never uses anything for the ordering.

On the logs table I have the following indexes :

PRIMARY : activity_id
user_id : (user_id, capture_timestamp)
capture_timestamp : capture_timestamp (added this to see if by itself would make a difference - it did not)

There are keys setup for all the ON joins.

This particular query for example has 2440801 results (the logs table itself is currently holding 18332067 rows), but I am only showing the first 10 sorted by capture_timestamp and it takes roughly 7 seconds to return the results.

SELECT
    logs.activity_id,
    users.username,
    computers.computer_name,
    computers.os,
    logs.event_title,
    logs.event_target,
    logs.capture_timestamp

FROM computers
INNER JOIN users
    ON users.computer_id = computers.computer_id
INNER JOIN logs
    ON logs.user_id = users.user_id AND logs.capture_timestamp BETWEEN :cw_date_start AND :cw_date_end
    
WHERE computers.account_id = :cw_account_id AND computers.status = 1
ORDER BY logs.capture_timestamp DESC
LIMIT 0,10

analyze :

Array
(
    (0) => Array
        (
            (ANALYZE) => {
  "query_block": {
    "select_id": 1,
    "r_loops": 1,
    "r_total_time_ms": 6848.2,
    "filesort": {
      "sort_key": "logs.capture_timestamp desc",
      "r_loops": 1,
      "r_total_time_ms": 431.25,
      "r_limit": 10,
      "r_used_priority_queue": true,
      "r_output_rows": 11,
      "temporary_table": {
        "table": {
          "table_name": "computers",
          "access_type": "ref",
          "possible_keys": ("PRIMARY", "account_id_2", "account_id"),
          "key": "account_id_2",
          "key_length": "4",
          "used_key_parts": ("account_id"),
          "ref": ("const"),
          "r_loops": 1,
          "rows": 294,
          "r_rows": 294,
          "r_total_time_ms": 0.4544,
          "filtered": 100,
          "r_filtered": 100,
          "attached_condition": "computers.`status` = 1"
        },
        "table": {
          "table_name": "users",
          "access_type": "ref",
          "possible_keys": ("PRIMARY", "unique_filter"),
          "key": "unique_filter",
          "key_length": "4",
          "used_key_parts": ("computer_id"),
          "ref": ("db.computers.computer_id"),
          "r_loops": 294,
          "rows": 1,
          "r_rows": 3.415,
          "r_total_time_ms": 0.7054,
          "filtered": 100,
          "r_filtered": 100,
          "using_index": true
        },
        "table": {
          "table_name": "logs",
          "access_type": "ref",
          "possible_keys": ("user_id", "capture_timestamp"),
          "key": "user_id",
          "key_length": "4",
          "used_key_parts": ("user_id"),
          "ref": ("db.users.user_id"),
          "r_loops": 1004,
          "rows": 424,
          "r_rows": 2431.1,
          "r_total_time_ms": 4745.3,
          "filtered": 100,
          "r_filtered": 100,
          "index_condition": "logs.capture_timestamp between '0' and '9999999999'"
        }
      }
    }
  }
}
        )

)

Is there anything I can do here to speed these up? When the result set is smaller everything is pretty much immediate although I guess that is because there isn’t as much sorting to do.

Additions :

CREATE TABLE `computers` (
  `computer_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` int(10) unsigned NOT NULL,
  `status` tinyint(1) unsigned NOT NULL,
  `version` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `os` tinyint(1) unsigned NOT NULL,
  `computer_uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `computer_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `last_username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `uninstall` tinyint(1) unsigned NOT NULL,
  `capture_timestamp` int(10) unsigned NOT NULL,
  PRIMARY KEY (`computer_id`),
  UNIQUE KEY `account_id_2` (`account_id`,`computer_uid`),
  KEY `account_id` (`account_id`,`status`),
  CONSTRAINT `computers_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=14362124 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci    

CREATE TABLE `users` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `computer_id` int(10) unsigned NOT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `changed` tinyint(1) unsigned NOT NULL,
  `timestamp` int(10) unsigned NOT NULL,
  `ctimestamp` int(10) unsigned NOT NULL,
  `stimestamp` int(10) unsigned NOT NULL,
  PRIMARY KEY (`user_id`) USING BTREE,
  UNIQUE KEY `unique_filter` (`computer_id`,`username`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`computer_id`) REFERENCES `computers` (`computer_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=54312 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci   

CREATE TABLE `logs` (
  `activity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `event_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `event_target` text COLLATE utf8_unicode_ci NOT NULL,
  `capture_timestamp` int(10) unsigned NOT NULL,
  `timestamp` int(10) unsigned NOT NULL,
  `demo` tinyint(1) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`activity_id`) USING BTREE,
  KEY `timestamp` (`timestamp`,`demo`),
  KEY `user_id` (`user_id`,`capture_timestamp`) USING BTREE,
  KEY `capture_timestamp` (`capture_timestamp`),
  CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=444156934 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci   

order theory – Expected height of a poset?

In Asymptotic Enumeration of Partial Orders on a Finite Set (1975), Kleitman and Rothschild showed that almost all partial orders on an $n$-element set have a simple description: they have three “layers” $L_1$, $L_2$, and $L_3$ of incomparable elements, of size $n/4$, $n/2$, and $n/4$ respectively. Each element of $L_1$ is covered by about half the elements of $L_2$. Likewise for $L_2$ and $L_3$, and in the reverse direction.

So almost all finite posets have height $3$.

(If you don’t have the time/effort to read Kleitman and Rothschild’s paper, I came across this reference via G. Brightwell, Linear extensions of random orders, Discrete Math. 125 (1994) pp.87-96. If memory serves, Brightwell’s paper presents a good summary of this one.)

calculus and analysis – How to get the result of function `LUDecomposition` in normal order?

The matrix A below is processed with the built-in LUDecomposition function, and its results are automatically ordered:

 A = {{2, 0, 1, 2}, {4, -3, -2, 2}, {2, 6, -5, 1}, {6, 3, -1, 2}}; 
{lu, p, n} = LUDecomposition(A)
l = LowerTriangularize(lu, -1) + IdentityMatrix(4); 
u = UpperTriangularize(lu); 
l . u
IdentityMatrix(4)((p))
A

What should I do to get the decomposition result $left(begin{array}{cccc}
2 & 0 & 1 & 2 \
2 & -3 & -4 & -2 \
1 & -2 & -14 & -5 \
3 & -1 & frac{4}{7} & -frac{22}{7}
end{array}right)$
in normal order?