How to write this tensor?

How can I write this tensor in Mathematica?

$ $ \mathcal{P}_{ijkl}(N) = \Big( \delta_{ik} – N_iN_k \Big) \Big( \delta_{jl} – N_jN_l \Big) – \dfrac{1}{2} \Big( \delta_{ij} – N_iN_j \Big)\Big( \delta_{kl} – N_kN_l \Big)$ $

I have tried with TensorProduct, but I realized that it is not so simple because of the position of the indices.

How do I write math equations in my blog?

I have been trying to do this for a long time and none of the methods I have come across seem to work for me. The most common suugestion I have seen is to use MathJax which can be activated by using this script

    <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script async="" id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> 

This still doesn’t seem to work for me or maybe I am just doing it the wrong way. I know how to use LATEX but i am not familiar with html.

How to obtain the same result of the same system if I write the system in different ways (NDSolve)?

I did program where I solved a system when I organized in matrix form, this is the code

Clear["Global`*"]  SeedRandom[1234]  Nmax = 5; (*Number of sites*)  tini = 0; (*initial time*)  tmax = 200; (*maximal time*)  \[Sigma]2 = 0; (*Variance*)  n0 = 5; (*initial condition*)  ra = 1; (*coupling range*)  \[Psi]ini = Table[KroneckerDelta[n0 - i], {i, 1, Nmax}];  RR = RandomReal[{-Sqrt[3*\[Sigma]2], Sqrt[3*\[Sigma]2]}, Nmax];  Z = Table[     Sum[KroneckerDelta[i - j + k], {k, 1, ra}] +       Sum[KroneckerDelta[i - j - k], {k, 1, ra}], {i, 1, Nmax}, {j, 1,       Nmax}] + DiagonalMatrix[RR];  Clear[\[Psi]]  usol = NDSolveValue[{I D[\[Psi][t], t] ==      Z.\[Psi][t], \[Psi][0] == \[Psi]ini}, \[Psi], {t, tini, tmax}]  Plot[usol[t], {t, tini, tmax}] 

Now, I´m trying to solve the same system but writing the equations

Clear["Global`*"]  tini = 0;  tmax = 200;  usol = NDSolveValue[{I x1'[t] == x2[t], I x2'[t] == x1[t] + x3[t],      I x3'[t] == x2[t] + x4[t], I x4'[t] == x3[t] + x5[t],      I x5'[t] == x4[t], x1[0] == 0, x2[0] == 0, x3[0] == 0, x4[0] == 0,      x5[0] == 1}, {x1, x2, x3, x4, x5}, {t, tini, tmax}];  Plot[usol[t], {t, tini, tmax}] 

Why the second code doesn´t give me the same result if I write the same system?

How to write a query to get wine pairing for a pizza based on pairing weight

I am working on a query to pair drinks to pizzas. Currently I am able to show the pizza_name, beverage and the pairing_weight being the amount of toppings on a pizza that the beverage pairs with. From here, I am looking to just output a mapping of distinct pizza name to beverage. I am unsure how to format the query to just return the top result per pizza based on pairing_weight.

mysql> select pizza_name, beverage, COUNT(beverage) as pairing_weight     -> from pizza_production     ->     JOIN pizza_restrictions pr on     ->         pizza_production.topping_name = pr.topping_name     ->     JOIN beverage_pairing_notes on     ->         restriction = pairing     ->     GROUP BY pizza_name, beverage     ->     ORDER BY pizza_name, pairing_weight DESC; +--------------+--------------------+----------------+ | pizza_name   | beverage           | pairing_weight | +--------------+--------------------+----------------+ | Grand Padano | Prosecco           |              2 | | Grand Padano | Champagne          |              2 | | Grand Padano | Riesling           |              2 | | Grand Padano | Cava               |              2 | | Grand Padano | Pinot Noir         |              1 | | Grand Padano | Carlsberg beer     |              1 | | Grand Padano | Zinfandel Rosé     |              1 | | Grand Padano | Chardonnay         |              1 | | Grand Padano | Chenin Blanc       |              1 | | Grand Padano | Gewürztraminer     |              1 | | Grand Padano | Guinness beer      |              1 | | Grand Padano | Pinot Grigio       |              1 | | Grand Padano | Heineken beer      |              1 | | Grand Padano | Irn Bru            |              1 | | Grand Padano | Malbec             |              1 | | Grand Padano | Muscat Blanc       |              1 | | new york     | Riesling           |              2 | | new york     | Champagne          |              2 | | new york     | Prosecco           |              2 | | new york     | Pinot Noir         |              2 | | new york     | Malbec             |              2 | | new york     | Syrah              |              1 | | new york     | Cava               |              1 | | new york     | Cabernet Sauvignon |              1 | | new york     | Chardonnay         |              1 | | new york     | Carlsberg beer     |              1 | | new york     | Chenin Blanc       |              1 | | new york     | Gewürztraminer     |              1 | | new york     | Guinness beer      |              1 | | new york     | Muscat Blanc       |              1 | | new york     | Heineken beer      |              1 | | pepperoni    | Pinot Noir         |              3 | | pepperoni    | Malbec             |              3 | | pepperoni    | Muscat Blanc       |              2 | | pepperoni    | Heineken beer      |              2 | | pepperoni    | Guinness beer      |              2 | | pepperoni    | Gewürztraminer     |              2 | | pepperoni    | Chenin Blanc       |              2 | | pepperoni    | Riesling           |              2 | | pepperoni    | Carlsberg beer     |              2 | | pepperoni    | Cabernet Sauvignon |              2 | | pepperoni    | Chardonnay         |              1 | | pepperoni    | Champagne          |              1 | | pepperoni    | Prosecco           |              1 | | pepperoni    | Cava               |              1 | | pepperoni    | Rioja              |              1 | | pepperoni    | Syrah              |              1 | | pepperoni    | Zinfandel Rosé     |              1 | | vegetarian   | Diet Coke          |              2 | | vegetarian   | Prosecco           |              1 | | vegetarian   | Champagne          |              1 | | vegetarian   | Riesling           |              1 | +--------------+--------------------+----------------+ 52 rows in set (0.01 sec) 

An example of desired output would be

+--------------+--------------------+ | pizza_name   | beverage           | +--------------+--------------------+ | pepperoni    | Pinot Noir         | | new york     | Riesling           | | Grand Padano | Prosecco           | | vegetarian   | Diet Coke          | +--------------+--------------------+ 

Is there a way to pull this data from what I already have in the output of the query above? Thank you.

Cannot write to file with fopen() , Permission denied

I get failed to open stream: Permission denied when trying to create a file, or write to a file (if I manually create it first in FTP or SSH).

I’ve looked at many aspects but I don’t find what may be the issue. So maybe it could related to wordpress in some way. The wordress setup is based on Bedrock (with a different folder structure).

Here are the details:

I do an ajax call from the frontend, which reaches a method in the backend, inside a plugin script. The method is an ajax function which is registered with a "wp_ajax_nopriv" action.

Folder path: This script is in /mnt/persist/www/thesite.com/web/app/plugins/theplugin/src/

Owner: The "src" folder and all its parent folders have a certain user, "deploy" as owner.

Permissions: All folders have 755. The file: If I create it manually, I have set it to ‘775’ and deploy as owner.

Current user: If I do get_current_user() inside the ajax method, I get "deploy".

Working directory: If I run getcwd() inside the script however, the working directory turns out to be: /mnt/persist/www/thesite.com/web/wp/wp-admin.

I changed permissions in "src" to 777.

I use "fopen" like this:

$  fp = fopen( $  folderPath . $  filename . '.txt' ,"a" );        if(!$  fp){     die('Error: ' . implode(',',error_get_last())); } 

If I try to create/write to a file in the current directory (not using a folder path), it doesn’t work, and if I try to use the path: /mnt/persist/www/thesite.com/web/app/plugins/theplugin/src/ (which is verified with file_exists), plus the filename, it gives the same Permission denied error.

If I SSH into the server and change user to deploy, and go into "src" folder, I can create a file with "touch myfile.txt".

Concerning the working directory ( /mnt/persist/www/thesite.com/web/wp/wp-admin) , those folders also have "deploy" as the owner, and permissions set to 755.

Can I trust get_current_user(), which says deploy? I thought I might be running it as www-data, but since it says deploy, there shouldn’t be any problem?

I’m a bit clueless..

Write the SQL code to find the average charge by the family medicine physicians

We need to write the script to find the average charge of physicians who specialize in "family medicine.

But i’m confused on how to write this because when we look at the appointment table, where we find the appointment_charge, it only gives us the physician_ID. How to link that to the specialize table. Can anyone help me solve this problem?

This link below contains the diagram, tables and question. I am stuck at number 13. Take a look, it will make more sense 🙂 >>>>

https://www.urgenthomework.com/question/hlst-3320-health-database-applications-sql-assignment

Mysql Router not sending Write request to R/W instance

I am doing InnoDB Cluster Group Replication for the first time. I stuck at the last step Mysql Router. Mysql Router is configured with bootstrapping, But the main issue is MySQL router does not send the write request to the Primary R/W instance after failover. After failover primary become node instance and the Error says The MySQL server is running with the –super-read-only option so it cannot execute this statement

I am following this tutorial https://severalnines.com/database-blog/mysql-innodb-cluster-80-complete-deployment-walk-through-part-one.

Thanks in advance

How can I write a formula for this houseruled roll in AnyDice?

So here it goes:

  1. The roll is a pool of dice of d6s, d8s, and d10s. The minimum dice pool is 1d6 and the maximum dice pool is 10 dice. It could be 2d6 + 2d8 + 1d10, for example.
  2. Rolling 5+ is a success.
  3. A number of successes is necessary equal or higher than the Difficulty (that ranges from 1 to 10) to have a successful check.
  4. The maximum value of a die explodes: 6 in a d6, 8 in a d8, 10 in a d10. But there’s a limit by the character’s Protagonism (ranges 1 to 10). It’s like the level of the character, so one with Protagonism 3 could not explode any dice more than 3 times. The eventual 4th time counts only as a normal success, even if it has the maximum value again.

I see it can be very difficult to do this, so I thank anyone who may come up with something. Thanks so much!

Using double write buffer is 8x slower in SSD (compared with 2x~3x in HDD)

I understand the double-write-buffer enhances the reliability of data, so it makes transactions slower. But it is amazing that the slow down is such severe in the newest Samsung 980 pro (M.2 PCIe 4.0, which is about 400$ for 1TB).

Workload: https://github.com/Percona-Lab/tpcc-mysql
Configurations: other parameters are defaults.
CPU: AMD Ryzen 3900XT
MEM: 64GB, 3200MHz
OS: Ubuntu 20.10, all disks are ext4
MySQL: 8.0.22

Why does this happen? Did I hit a performance bug?

Thanks!

en ter image description here