Re: _ interpreted as pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg38777] Re: [mg38761] _ interpreted as pattern
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Fri, 10 Jan 2003 04:33:49 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Thursday, January 9, 2003, at 06:40 PM, Rolf Alber wrote: > Hello together ! > > I am currently trying to convert a Maple spreadsheet to Mathematica. > My problem now is that I have a lot of variables which contain an > underscore, like "pressure_inside" p.ex. > This now causes problems in Mathematica as the "_" is interpreted as > pattern. > The number of variables which use such a "_" is quite large so I > wonder if > perhaps anyone here knows a solution to my problem except renaming the > variables. > > Any help is highly appreciated, > > thanks, > > rolF > > > > > It seems to me that there is no way to avoid "renaming the variables", in one way or another, and the issue is only about the best way to do that. The answer is likely to depend on the exact nature of your formulas but it should be possible to do something like this: y_cat^2 + x_dog^3 /. v__Pattern :> Subscript[v[[1]], v[[2,1]]] Subscript[x, dog]^3 + Subscript[y, cat]^2 Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/