[Date Index]
[Thread Index]
[Author Index]
Re: Suggestions on how to use standard engineering symbols
*To*: mathgroup at smc.vnet.net
*Subject*: [mg104133] Re: Suggestions on how to use standard engineering symbols
*From*: Hannes Kessler <HannesKessler at hushmail.com>
*Date*: Tue, 20 Oct 2009 04:53:53 -0400 (EDT)
*References*: <200910180922.FAA16997@smc.vnet.net> <hbhhgg$21d$1@smc.vnet.net>
On 19 Okt., 13:11, Leonid Shifrin <lsh... at gmail.com> wrote:
> Hi Nasser,
>
> honestly, I would just use different symbols anyway, since messing with
> symbol names coinciding with System symbols can bring more harm than good.
> However, in case you really want to do it, here are few possibilities that
> come to my mind.
>
> If you are concerned about how your *input* code looks visually, one "quick
> and dirty" method is to take those pieces of code where you have conflicting
> symbols and wrap them in a Module, or better yet With (if symbol's values
> are not going to change), (but never use Block for this purpose!) declaring
> local symbols with the same names - like Module[{E=..., I =...,...},code] or
> With[{E=..., I =...,...},code]. In this case, the global symbols will be
> shadowed by local definitions. This option may be appropriate if you need to
> assign (Own)values to the symbols in question (this refers to Module) - that
> is, if you want to store some values in them. The advantage of this method
> is that syntax coloring will always tell you whether or not you really
> localized your symbol. It should be clear however that you won't be able to
> refer to the original system symbols with the same names, within this code.
> Also, the bindings are local to Module or With, so if you have some code
> scattered across a notebook, you will have to wrap all relevant pieces in a
> Module or With and keep all these Module or With constructs in sync.
>
> OTOH, if all you care about is the way the *output* looks, and you don't
> need to store any values in the symbols of interest, then another option is
> to define formatting rules for the output, something like this:
>
> Format[youngModule] := "E"
>
> In this case, while you will be using <youngModule>, in the output it will
> look like E.
>
> It is certainly possible (although does not seem to be easy to implement
> reliably) to produce a more sophisticated general solution to this problem,
> based for example on working in a different context and/or writing a
> $PreRead - based custom preprocessor. Perhaps this problem has been
> addressed before and others will suggest something nicer and simpler.
>
> Regards,
> Leonid
>
> On Sun, Oct 18, 2009 at 2:22 AM, Nasser M. Abbasi <n... at 12000.org> wrote:
>
> > Hello
>
> > This is a problem I am sure all of us had.
>
> > It would be nice to use the same standard engineering/physics
> > symbols/letters found in textbook to write the equations in mathematica.
>
> > But some/many of those symbols conflict with existing Mathemtica symbols.
> > For example, Young modulus is always written as E, but E in mathematica is
> > reserved to the exponential constant, and I would like to use I (upper case
> > I) to mean the moment of inertia, and not have it conflict with complex
> > number I. And many other examples.
>
> > I was wondering if there is a way to still use these letters in my
> > equations
> > but not conflict with Mathematica's?
>
> > I thought may be I could make a bold versions of these letters with a new
> > code, or find latine characters which "looks like" these from the palette,
> > but have different ASCII code.
>
> > Or may be I could tell mathematica somehow to "undefine" these symbols
> > during some computation and restore them again, so it will not interpret
> > them as its own standard symbols only during this computation, but was not
> > sure if this is a good idea? (would this will cause a problem internally to
> > Mathematica as it could very well use these symbols in its own package
> > code.
> > I could always use Exp[] instead of E and use Sqrt[-1] instead of "I" when
> > I
> > really mean to use the Mathematica letters and leave E and I etc... for my
> > use.
>
> > Any other ideas others have on this subject? I'd really like to write the
> > equations as they appear in the textbook if possible and not have to rename
> > standard engineering letters to something else.
>
> > --Nasser
Hello Nasser,
not a general solution, but to use E or I as your own symbols, you can
include them between escape keys, typing <escape>E<escape> or
<Escape>I<Escape>. Typing simply E and I still refers to the builtin
symbols. For longer Mathematica symbols you could type immediately
after the symbols <escape>bv<escape> which appends the small breve
character and thus makes a new symbol.
Best regards,
Hannes Kessler
Prev by Date:
**Re: How to find which variable caused the trigger in Manipulate[]**
Next by Date:
**Re: Text cell formating blues. LineBreakWithin, PageWidth, WordWrapping**
Previous by thread:
**Re: Suggestions on how to use standard engineering symbols**
Next by thread:
**Re: Suggestions on how to use standard engineering symbols in Mathematica which conflict with Mathematica own symbols?**
| |