built in symbols – What could go wrong in redefining Power to act on functions?

Inspired by a tweet (from a locked account, unfortunately, so I can’t link it), we can get notation like $cos^2(x)$ to work in Mathematica in general:

Power(f_, n_)(x___) := Power(f(x), n);

Weirdly, so far, I can’t think of anything this would break, since—as far as I can tell—Power(f_, n_) is never otherwise expected to appear as the head of some other expression. It seems like this might actually be a convenient choice.

Is there any chaos this could cause that I’m not thinking of?

c – MPLAB IDE shows countless error symbols and does not work

I cant post the full code but I wish I could as there are symbols on almost every single line with any variables, that show errors with identifiers saying “Unable to resolve identifier”, which doesn’t necessarily affect the code, but makes it hard for me to troubleshoot.

if (PORTAbits.RA0 = 0 && PORTAbits.RA1 = 0 && PORTAbits.RA2 = 0)
 LATBbits.RB6 = 1;
 delay (SHORT_DELAY);
 LATBbits.RB6 = 0;
 delay (SHORT_DELAY);

if (PORTAbits.RA2 = 1)
 while (1){   
 LATB = one;
 delay (SHORT_DELAY);
 LATB = zero;
 delay (SHORT_DELAY);

if (PORTAbits.RA0 = 1)
 while (1){   
 LATB = zero;
 delay (SHORT_DELAY);
 LATB = one;
 delay (SHORT_DELAY);
 LATB = two;
 delay (SHORT_DELAY);

keyboard – Emoji & Symbols input method enabled as input source after Log Out or Reboot

I have some weird behavior on my MacBook Pro running Big Sur 11.2.3 (20D91). When I login to any user, after Log Out or Reboot I see “Emoji & Symbols” input method in the list of activated input methods (something similar to described here). After I remove it and then Reboot it comes back. I tried to create a new user and for it “Emoji & Symbols” presents with the same behavior.

Also, I tried to remove both files:

rm ~/Library/Preferences/com.apple.HIToolbox*
rm /Library/Preferences/com.apple.HIToolbox*

After I reboot and Login I see English and “Emoji & Symbols” layouts.

And in addition to described behavior sometimes it is very hard to delete this “Emoji & Symbols” layout. It stays inactive there:

Sreenshot1 Screenshot2 Screenshot3

Has anyone experienced this issue? Are there are any workarounds?

tensors – Differentiation by indexed variable in equation of Christoffel Symbols

I am very new to Mathematica, and am trying to use it to compute Christoffel symbols for a certain manifold. All this requires is taking some indexed sums of derivatives, but it builds up on several different things, and I am missing something in defining the indexed variables. This might be a little long, but I would really appreciate any help that I could get.

I started by defining the local coordinate function and finding its partial derivatives and then the elements of the metric tensor:

f(x1_, x2_) = (x1, x2, Sqrt(r^2 - x1^2 - x2^2).
fx = D(f(x1, x2), x1),
fy = D(f(x1, x2), x2)
g(1, 1, x1_, x2_) = fx.fx,
g(1, 2, x1_, x2_) = fx.fy 
g(2, 1, x1_, x2_) = fx.fy
g(2, 2, x1_, x2_) = fy.fy

Running this code goes smoothly, giving me three functions of $x_1$ and $x_2$ that match what I computed by hand. I then want to calculate the inverse of the coordinate representation of the metric tensor, which is easily done:

Inverse({{g(1, 1, x1_, x2_), g(1, 2, x1_, x2_)}, 
{g(2, 1, x1_, x2_), g(2, 2, x1_, x2_)}})

Then defining the components of this matrix from what we get:

ginv(1, 1, x1_, x2_) = 1 - x1^2/r^2
ginv(2, 2, x1_, x2_) = 1 - x2^2/r^2
ginv(1, 2, x1_, x2_) = -((x1 * x2)/r^2)
ginv(2, 1, x1_, x2_) = -((x1 * x2)/r^2),

we have everything that we should need to get our Christoffel symbols. The equation for Christoffel symbols in local coordinates is

Gamma_{ij}^k = frac{1}{2}left(frac{p g_{j ell}}{p x^i} + frac{p g_{ell i}}{p x^j} – frac{p g_{ij}}{p x^ell}right)g^{ell k}$

I don’t know anything about using Einstein notation in Mathematica (I am very new to it), so since our indices only range from one to two, I just wrote out the whole thing without using dummy indices at all. This is where I ran into problems. I know that my syntax is wrong, but I thought I’d try it anyway since I could find out how to do this correctly anywhere online at all. Here is what I tried to define the Christoffel symbol “function” (of $i, j, k$) as:

Gamma(i_, j_, k_, x1_, x2_) = 
 0.5*(D(g(j, 1, x1, x2), xi) + D(g(1, i, x1, x2), xj) - 
     D(g(i, j, x1, x2), x1))*ginv(1, k, x1, x2) + 
  0.5*(D(g(j, 2, x1, x2), xi) + D(g(2, i, x1, x2), xj) - 
     D(g(i, j, x1, x2), x2))*ginv(2, k, x1, x2)

I couldn’t figure out any other way to make $x$ a function of an index $i$ without changing too much else and running into issues with taking partial derivatives by $x_i$ and other things like that. How do I fix this to accurately define a function of indices that can be differentiated etc. (I am trying to calculate components of the Riemannian curvature tensor using the Christoffel symbols)?

Any help would be wonderful!

keyboard – Stop autocorrect in Microsoft Office changing custom symbols to emoji

I have set up a number of custom shortcuts for math/logic symbols to use in Word and OneNote, including the left/right arrow ↔. This works in OneNote, but I also need it to work in Word, but it keeps autocorrecting to the corresponding arrow emoji which is incredibly frustrating.

I have tried the following:

  • changing the shortcut to add a space after the ↔. This still corrects to the emoji.
  • selecting “change back to (custom shortcut)” – this does what it says, and corrects it all the way back to the shortcut, rather than to the arrow symbol I want
  • using the inbuilt shortcut leftrightarrow (which I want to avoid because it’s so much faster to type a three-character shortcut than that) also autocorrects to the emoji outside of math fields in Word
  • changing the shortcut trigger to something different. This still replaces the arrow with an emoji.

Within specified math fields, this issue doesn’t occur, but I want to be able to continue to use these symbols outside of math fields, because that’s the only way I can still use it within OneNote as well due to the way the Autocorrect dictionary for Office is set up.

I suspect that the issue is due to the fact that there is an inbuilt auto-replacement function for the arrow symbol to be replaced by the arrow emoji itself, much like how the smiley symbols started getting replaced by emoji a few years ago too, but I wouldn’t know where to look to disable that to allow insertion of the actual arrow symbol itself. Any suggestions? Right now I’m copying and pasting but obviously this is not an ideal solution.

I am using Microsoft Word for Mac Version 16.46.

Thank you in advance, this is driving me up the wall!

posts – Posting an article containing mathematical symbols and R code

I have been trying to figure out the best workflow to publish articles heavy in R code and R output and mathematical formulas.
I would like to be able to finish the entire report in RMarkdown including all the figures (ggplot), code and tables (kable). So far I tried to copy the html code from RStudio and pasted it directly into the text editor of WordPress. When doing that I get the following errors:

  1. Basically everything that is in the <head> tag in the html file will offset the beginning my article by a certain margin. You can not see the code but I can see extra whitespace added at the beginning. The rest is displayed normally.
  2. I noticed that tables produced with kable() cannot be displayed. What could be the reason? Is there an alternative?

I imagine what I could do is to generate my tables in html and define my own styling options. This process still does not appear very streamlined to me. I would love to hear what ideas you have.

Strange signs and symbols in my sharepoint list

i have 2 strange things i have noticed when using my sharepoint list:
Could anyone tell me what these signs and symbols are:

enter image description here

enter image description here

terminology – Code reference symbols in documentation, comments and pull requests?

I’ve seen method references in PRs and comments and documentation but it’s unclear what the specific symbology means.

E.g. ClassName#myMethod or ClassName::myMethod or what about ClassName::CONSTANT

Is there a distinction in the # and :: notation, does it say whether one method is an instance method, a static method, a variable, etc.?

Are there any other notations that can help me write cleaner pull request summaries, documentation or commit messages when referring to classes/methods and instance variables/constants? While also allowing me to be specific on typing and syntax when referencing the code?

Any resources about this topic is much appreciated!

built in symbols – Dot Product doesn’t behave like normal function

I am trying to slightly modify the Dot function by treating it like a usual function, but soon I notice something weird about it.

Suppose there is a set set = {λ}, and I want to force Dot(a, λ) (having two arguments) to just print out {a, λ}.

set = {λ};

Dot(x_, λ_) := Module({}, Print({x, λ})) /; MemberQ(set, λ)

(* test *)
Dot(a, λ)
Dot(a, b, λ)

The two tests print out



{b, λ}
{a.b, λ}


However, the same code for a different function Dott behave completly differently,

set = {λ};
Dott(x_, λ_) := 
 Module({}, Print({x, λ})) /; MemberQ(set, λ)

(* tests *)
Dott(a, λ)
Dott(a, a, λ)

where the two tests print out {a,λ} and an unevaluated expression Dott(a, a, λ) respectively, and as expected.

I wonder what is going on under the hood (it appears that Dot is trying to exhaust all possible “two-factor product” given any number of dotted factors), and how to properly temper with the Dot product? (my ultimate goal is to adapt it for some non-commutative algebra).

Alphanumeric symbols in the data/app directory?

Why are the names of the applications replaced with alphanumeric characters in the data/app directory? I am seeing this when accessing the directory through an adb shell.