Using Solve to solve my equation with Matrices

I’m attempting to solve an equation that involves matrices (so I suppose a system of equations). I have my matrices defined as follows:

Subscript[H, 1] = {{a, 0, 0}, {0, b, 0}, {0, 0, c}} Subscript[H, 0] = {{0, 0, 0}, {0, \[Omega], 0}, {0, 0, 2 \[Omega] + \[Alpha]}} Subscript[H, int] = \[CapitalOmega]/2 {{0, 1, 0}, {1, 0, Sqrt[2]}, {0, Sqrt[2], 0}} Subscript[G, 1] = {{Subscript[g, 11], Subscript[g, 12], Subscript[g, 13]}, {Subscript[g, 21], Subscript[g, 22], Subscript[g, 23]}, {Subscript[g, 31], Subscript[g, 32], Subscript[g, 33]}}  

And my function comm defined as follows:

comm[matrixone_, matrixtwo_] := matrixone . matrixtwo - matrixtwo . matrixone 

I’ve tried using the Solve function as follows:

Solve[Subscript[H, 1] ==    Subscript[H, int] +     I*comm[Subscript[G, 1], Subscript[H, 0]], {Subscript[g, 11],    Subscript[g, 12], Subscript[g, 13], Subscript[g, 21], Subscript[g,    22], Subscript[g, 23], Subscript[g, 31], Subscript[g, 32],    Subscript[g, 33]}] 

And it gives me a matrix with no elements. Any suggestions on how I can fix this would be appreciated as I’m basically brand new to mathematica.

Best way to add onclick function to all internal links using javascript

As part of a plugin, I am looping all <a> link tags on a page and adding an onclick attribute.

But I only want to add the onclick attribute IF the link URL is on the same site… So I am using the siteurl option value as part of this detection. (Also, I I realize I could add a click event listener instead… I’m not sure if there is any advantage to that approach.)

Here is what I have so far (extracted and simplified to make it easier to read):

var siteurl = '<?php echo get_option("siteurl"); ?>'; var ignoreclasses = [ 'external' ];  alinks = document.getElementsByTagName('a'); for (var i = 0; i < alinks.length; i++) {     if ( !alinks[i].onclick && !alinks[i].getAttribute('onclick') && (alinks[i].href != '')       && !alinks[i].getAttribute('target') && (alinks[i].href.indexOf('javascript:') !== 0) ) {         skip = false;         if (ignoreclasses.length) {             for (i in ignoreclasses) {                 if (alinks[i].classList.contains(ignoreclasses[i])) {skip = true;}             }         }         if (!skip) {             external = is_link_external(alinks[i]);             if (!external) {alinks[i].setAttribute('onclick', 'return my_function(this);');}         }     } }  function is_link_external(el) {     /* treat hash or query as internal */     u = el.href; a = '#'; b = '?';     if ((u.indexOf(a) === 0) || (u.indexOf(b) === 0)) {return false;}      /* check against site URL */     if ((siteurl != '') && (u.indexOf(siteurl) === 0)) {return false;}      /* check against host/protocol */     if (el.host == window.location.host) {         a = window.location.protocol+'//'+window.location.host;         b = '//'+window.location.host;         if ((u.indexOf(a) === 0) || (u.indexOf(b) === 0)) {return false;}     }     return true; } 

So that is what I have so far and it seems to be working well, my question is, am I missing anything? Are there any weird URLs that fall outside of this scope that I haven’t thought of? Or maybe there are other edge cases or some possibility that could trigger an error somewhere. I just want this code to be as robust as possible.

How to stack several vector plots using StreamPlot?

I would like to plot several stream plots as is in ref/StreamPlot (Mathematica 12).

As is reported in the section: Generate a list of stream plots of varying [Lambda]:

I did not change but it does not work as this example.

The problem is, there is field that may represent a bidimensional vector (Electric,Acoustic), this is the code.

a = 1; b = 1;  (* fixed values, constants *)  f1 = (-y  l )/(y^2 + a x^2);  f2 = ( x l )/(b y^2 + x^2);   l = {-1, 0, 1};  (* This can take several values *)  plots = MapIndexed[   Function[{f1, f2},     StreamPlot[{f1, f2}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> 16,      StreamScale -> 0.07,      StreamStyle -> ColorData["SolarColors"][0.3 l[[1]]]]], l]  plotSpacing = 5; stackPlots[plots, plotSpacing, Axes -> True, Boxed -> False,   Ticks -> {Automatic, Automatic,     MapIndexed[{plotSpacing #2[[1]], Row[{"l = ", #1}]} &, values]}] 

It does not work, only the constant value is plotted. the function can not take different values as must be. This function does not evaluate the vector.Thanks!

Vector Parametric Plot different from polar plot using norm of vector

I’ve defined two vector functions (2D) of real variables and then I plotted them parametrically using ParametricPlot[]. The result is the green and orange curves (the blue curve is a reference circle).

enter image description here

What I’m seeking however is the norm of theses functions, and I was getting weird values from the norm – so I decided to plot the resulting norm parametrically where I plotted {Norm1[u] Cos[u],Norm1[u] Sin[u]} and {Norm2[u] Cos[u],Norm2[u] Sin[u]} (u going from zero to $ 2\pi$ . Here Norm1 and Norm2 are just the Norm[] method applied to the vector functions. I get this funky plot that doesn’t match the vector plot.

enter image description here

I cannot disclose the functions themselves as they are an on-going group work but they are functions of real variables. It seems very strange that taking the norm and then doing a polar plot like that does not recover the original plot. Any thoughts or pointers on what could be happening?

Create page in category using REST API

The REST docs show how to create a page: https://developer.wordpress.org/rest-api/reference/pages/#create-a-page

But it makes no mention of how to set categories for that page. It is also not mentioned in the categories page (https://developer.wordpress.org/rest-api/reference/categories/)

I assume this has to be done by adding data to meta property but I can’t find an example.

How do I create a page in specific categories?

Stroring field name instead of referencing using objectId

This is my first question here

For example: I have a post document which contains list of people who like it and my question is Should i store each person in the array using objectId or username(it’s also a unique identifier) the reason i ask is that when we view a likes of a particular post i want to show only their username and profile pic in this case I think storing username will be much faster than query each objectId and fetch their username, but after all i still need to fetch their profile pic using either one of them.

Guide me if i’m wrong or misunderstood sth.

you can send me if you have any blogs related to this.

From a game design point of view, what are the implications of using realistic distances in an open world map?

I’m starting an open world game and the plan is to have a single "open world" map that should contain a medieval citadel (1.4 km/2 – taking as example Palmanova in Italy) and some countryside around it.

The plan is to delimit the map with a river and some hills.

What I realized so far is that most open-world games take a specific approach when it comes to size their areas, it’s unlikely you’ll ever find a realistically sized citadel, they will tend to be all pretty small, and it will take no more than a few minutes to run from one side to the other of it.

An example that comes to mind is The Witcher 3, the Novigrad/Velen map is 15.2 km2 but the city is approx 0.25km2, which is a lot smaller than what I plan to build for my map.

To walk from one side to the other of my citadel the player should take around 15 minutes (according to Google Maps), while, as I said, in most games you can run through a city in a matter of 1 or 2 minutes.

Keep in mind there will be no vehicles and I’d still like to have the countryside take most of the map area to keep everything proportioned and realistic.

The question is, is it a good idea to build such a "large" citadel? What gameplay issues could I face? How should I handle the fact that the countryside will end up being extremely huge (and empty?) if I want to keep it properly proportioned with the citadel?