Ask Your Question

# Mathematica misinterprets some underscored symbolic variables

Following examples show that the interface between sage and Mathematica misinterprets symbolic variables if they are underscored with numbers:

sage: h_20,h_10,h_2,h_3,h20,h10,h_ij,h_kl=var("h_20,h_10,h_2,h_3,h20,h10,h_ij,h_kl");
sage: mexpr=mathematica((h_20+h_10)^3);
sage: print(mexpr);
3
27000 (h_)
sage: mexpr1=mathematica((h20+h10)^3);
sage: print(mexpr1);
3
(h10 + h20)
sage: mexpr2=mathematica((h_2+h_3)^3);
sage: print(mexpr2);
3
125 (h_)
sage: mexpr3=mathematica((h_ij+h_kl)^3);
sage: print(mexpr3);
3
((h_ij) + (h_kl))


I use sage-8.1 and Mathematica 11.2.0 at Linux OpenSUSE Leap v42.3. In this forum I haven't found any other comment regarding this funny behaviour.

edit retag close merge delete

## 1 answer

Sort by ยป oldest newest most voted

I'm not entirely sure but I think Mathematica doesn't like underlines, so instead of defining variables like A_ij I would define Aij. You just have to adhere to naming conventions in both Mathematica and Sage, so something like Aij would be acceptable in both, I think.

more

## Comments

I agree, The best method to circumvent this problem is substituting the "_"- symbol by unique identifiers in sage and subsequently replacing them in Mathematica by its appropriate underscoring. key combination. This workaround should be applied to all kinds of underscored symbols (not only for underscored numbers).

( 2018-03-22 15:37:27 -0600 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2018-03-21 02:25:24 -0600

Seen: 108 times

Last updated: Mar 22 '18