Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Best Symbolic Language

  1. Dec 8, 2009 #1
    What would be the friendliest programming language available for perform symbolic manipulaiton of mathematical expressions (on a PC)?

    Mathematica seems to the most popular, but seems to contain a few quirks, though I've only studied over couple dozen hours.

    On the list of possible choices I have Lisp, Prolog and Snobol and Mathematica.
  2. jcsd
  3. Dec 9, 2009 #2


    Staff: Mentor

    I am highly biased but I would pick Mathematica without hesitation.
  4. Dec 11, 2009 #3
    I've been reading the online and .pdf text found http://www.mathprogramming-intro.org/" [Broken]. You might even find it a good read if you are interested in the Mathematica kernel, and aren't altogether familiar already.

    I'm slightly familiar with symbolic language structure, after an introduction to lisp in 1984-1987. There's a great deal of similarity in the languages, having many shared notions emerging from MIT in the early 80's, as I recollect. Anyway, I was involved in the hardware side of dedicated lisp processors with embedded mathematica engines, so not required to know much at-all of lisp, and none of mathematica.

    There seems to be an unavoidable exception involving the Set[] function (=).

    If given, for example:

    a = z * Sin[x+y];

    the returned value is:

    Times[z, Sin [Plus[x, y]]].

    Why doesn't 'a' simply evaluate t 'a'? Mathematica doesn't design return a as the leaf of

    Set[a, Times[z, Sin [Plus[x, y]]]].

    If this expression is given an L-value, we could write

    b = a = z * Sin[x+y],


    b = (a = z * Sin[x+y])

    if the syntax is legal.

    But asking mathematica to evaluate b would just return

    Times[z, Sin [Plus[x, y]]] as far as I know (I don't yet have a copy of mathematica.)

    All and all, this may be outside your interests, but I and very curious whether a symbolic processor is capable of placing the assignment rule on equal par with other rules.
    Last edited by a moderator: May 4, 2017
  5. Dec 11, 2009 #4
    I am highly biased as well, but using Mathematica and Maple

    And since you said "friendliest" I say MAPLE. (I only used Maple 13 - and Mathematica 6.0)

    BY FAR better than Mathematica, in that context.

    Though not in your list, do consider it if you can access it:

    I'll just give you an example

    To evaluate the following integral:

    \int^\pi_0 sin(t) dt

    in Maple:


    whereas in Mathematica:

    Integrate[Sin[t], {t,0,:pi:}]

    This is exactly the way you should write it in Mathematica otherwise it'll yell. For instance you cannot write "sin" and you have to use square brackets instead of the natural parenthesis. In Maple, on the other hand, there's no case sensitivity, the commands are much more straightforward. It'll immediately "get" you because it's meant for "ease" rather than verbose & formal syntax. And needless to say, it can take care of ANYTHING Mathematica handles.

    Plus, by just right clicking a certain expression in Maple, you can see the available options,
    factoring, integrating , solving , isolating and all other stuff you can imagine, without messing with the help commands or looking up every little thing in google.

    It is NOT that popular but it's way better and practical than Mathematica, IMO.

    Plus, you can convert expressions to LaTeX for quick formula typing, or to MATLAB or to C++ syntax, where you can check things more quickly if you are familiar with them.

    You could immediately post the formulas you are playing with in Maple here, because this website also supports TEX format - you don't even have to learn it. Just copy and paste.

    I have tackled research level problems with Maple, and I just love it.

    I also recommend the book "Mathematica and Maple" ( I forgot by whom) which shows tricks that you'll never find elsewhere.

    Let me know of your final decision!
    Last edited: Dec 11, 2009
  6. Dec 11, 2009 #5
    Thanks sokrates. I should have asked about the set: mathematica, maple, matlab and mathcad, instead. Are there any I've left out?

    I've very torn about this. I've become so enamored with mathematica over a few days, that I could be willing to put up with a lot of extra effort and unfriendliness to use it over other languages.

    Second to this, I have some pretty odd requirements. I need a language to handle differential geometry. I need to manipulate tensors in eight dimensions, and it could get worse--like sixteen or more. I need to be able to map four dimensional complex-valued tensors to eight dimensional real-valued tensors in eight dimensions. I need to partition tensors in space-time coordinates into subspaces such as space4 and space3time1.

    Can maple manage my odd requirements?
    Last edited: Dec 11, 2009
  7. Dec 11, 2009 #6
    Well, honestly that goes way over my experience with Maple, but as far as I know (also from the book I mentioned) if Mathematica can handle it, Maple should be able to as well, in principle.

    Of course, for the specific thing you want, you might need additional toolboxes etc... With a quick google search I found separate, stand-alone toolboxes (like atlas) for Maple on what you mention but I don't know whether you need such a thing or not.

    If your experience with Mathematica is just a few days long, I'd consider switching. Have you started your work on differential geometry in Matehmatica already? what are the specific functions you are using? I am pretty sure they have Maple equivalents.

    Believe me, it's worth the effort. It's one step going back, and hundred yards forward.
  8. Dec 11, 2009 #7
    This is true.

    Egads. Now I'm really torn. I'll do the research on Maple. How much does a private edition cost? Maybe I could buy both.
    Last edited: Dec 11, 2009
  9. Dec 11, 2009 #8
    This http://en.wikipedia.org/wiki/Comparison_of_computer_algebra_systems" [Broken] might be helpful.
    Last edited by a moderator: May 4, 2017
  10. Dec 12, 2009 #9


    Staff: Mentor

    I fully agree that the OP should check his options, but the things you mention here I am very aware of and consider them to be a significant advantage of Mathematica over all other math systems. The notational consistency is a big advantage. You always know that a square bracket is a function call and that a parenthesis is defining order of precedence, there is never any ambiguity which saves lots of time in debugging and troubleshooting. You automatically know that any custom function you write will not conflict with any built-in function simply by starting it with a lower case. Also if you don't know the name of a function you can usually guess it immediately. I really value the notational consistency of Mathematica.
  11. Dec 12, 2009 #10


    Staff: Mentor

    In mathematica there are a variety of set operators depending on what assignment you want made and what you want it associated with and when you want it evaluated. For example, the UpSet operator (^=) associates the assignment with the symbol at the first level in the lhs, and the TagSet operator (/:) associates the assignment with any arbitrary symbol, not necessarily even appearing in the lhs or the rhs. There is also SetDelayed which sets the lhs to the rhs, but defers evaluation of the rhs until the lhs is called. There is also Rule (->) which sets the lhs to the rhs for the purpose of a single expression, but does not associate the rule with either the lhs nor the rhs. Basically, there is a flavor of Set for most needs.
  12. Dec 12, 2009 #11
    I found a price holiday price break on mathematica 7 home edition for 250,http://www.wolfram.com/holiday/" --either that, or they are set to release version 8.

    Dale, after learning more about the evaluation kernel, perhaps I'll be able to say something intelligent about the status of the equal sign in mathematica.

    My concerns about mathematica is that I expect a brutal learning curve in comparison to maple, learning how a few hundred rules can be expected to behave, and getting lost in levels and levels of brackets. Does the notebook interface have color code brackets?
    Last edited by a moderator: Apr 24, 2017
  13. Dec 12, 2009 #12
    The notational consistency is usually a nuisance. You don't write the equivalent of a 10,000 line C++ code with these symbolic tools anyway. I don't accept it as an excuse for easy debugging.

    Most of the time you are trying to carry out a piece of calculation (otherwise why not Matlab or C++ for extensive programming?), and the interface and strange rules are getting in the way.

    Plus, Mathematica makes it really hard to program anything, because of its almost stupid way of outputting results.

    Just doing a naive:
    Solve x^2 = 4 and feed the result to the following expression needs hours of Google search - with no guarantee of success. You might know the answers if you invested enough time in understanding it, but I am sure it wasn't easy. Well it's not easy for me after 4-5 years of playing with it.

    The bottom-line: It's not straightforward. The syntax is very tiresome, error reports are ugly, code writing is close to impossible.

    And I was just trying to handle elementary matrix manipulation, ODEs, eigenvalue problems etc... etc...

    I accidentally bumped into Maple - and it feels like Linux after Windows. You can't see the difference until you experience it. Phrak needs to consider his options. Seriously.
  14. Dec 12, 2009 #13


    Staff: Mentor

    That is all opinion and my opinion is exactly opposite. I picked up the syntax very quickly and enjoyed it immensely from day 1 with equal or less of a learning curve than most programming languages. I certainly could solve a polynomial and use the result within the first day using only the built-in help. Perhaps the difference between us is simply that I understand and agree with the philosophy behind the design choices, so they always "clicked" for me.

    But I do agree that Phrak should look around and find what works best for him. No tool is "one size fits all", not even my favorite tool.
    Last edited: Dec 12, 2009
  15. Dec 12, 2009 #14


    Staff: Mentor

  16. Dec 12, 2009 #15
    Sure. And that's all my opinion. I used them both, I like one more.
  17. Dec 12, 2009 #16
    I hope this does not turn off the discussion, and I appreciate both your remarks; I sprung for mathematica.

    My choice is multiple. Beyond being biased toward mathematica from the beginning, I could not discover if maple is capable of manipulating tensor expressions on Riemann manifolds with complex entries using its built in functions, or even if I could build my own using maple.

    Secondarily, I have a long standing curiosity to know, in formal code, what it looks like, when we do what we do, in solving algebraic expressions. Maple does have a symbolic module of it's own, but I could not discover how it's implimented.

    I also have mathcad for actual numerical results, though for simpler problems. And I still have the choice of purchasing maple and evem matlab, at a later time.
    Last edited: Dec 12, 2009
  18. Dec 19, 2009 #17
    I think both are equally powerful. I am just curious to see what more people use, because that's essentially what's going to survive in the end. Could everyone please take 2 seconds to vote for which one they use the most ??

    http://users.ox.ac.uk/~hert3229/ [Broken]

    Thank you!
    Last edited by a moderator: May 4, 2017
  19. Dec 19, 2009 #18
    This may depend on what you want.

    On my PC it took mathematica 14 seconds to generate the Levi-Civita symbol in 8 dimensions using

    Code (Text):
     [Signature[{#1, #2, #3, #4, #5, #6, #7, #8}] &, {8, 8, 8, 8, 8, 8, 8, 8}]]
    I used the Dimensions function so that the print_to_screen of Array doesn't occur and get included in the timing.

    Sorry if this doesn't make any sense to those that don't do tensor calculus. I initialized an 8 dimensional array of rank 8 with calculated integer values.
    Last edited: Dec 19, 2009
  20. Dec 20, 2009 #19

    I'm guessing that that's an 8x8x8x8x8x8x8x8 tensor ?

    I don't understand your point, how does 14 seconds compare to other software ??

    I don't work with tensors much but I know Maple can, given a metric, calculate all Cristoffel symbols, Riemann tensor, Ricci Tensor, Ricci scalar, Einstein Tensor, Weyl Tensor, plus some other things, all in just 0.06 seconds:


  21. Dec 20, 2009 #20
    That's right, an 8x8x8x8x8x8x8x8 tensor; sixteen milion terms, so I'm concerned over execution time.

    Would you like to compare speeds of execution? I'd like to know how mathematica compares to maple in tensor algebra. Since there's a lot of difference in time between 4 and 8 dimensions, even memory managment may enter into how well each manages. I think filling spare arrays compare as the factorial of the dimension; 4! to 8!-- yikes!

    Can you see how maple times at generating a completely antisymmetric tensor in eight dimensions?
    Last edited: Dec 20, 2009
  22. Dec 21, 2009 #21
    Hi Phrak,

    In maple you don't need to create the Levi-Civita symbol yourself, it's already intrinsically there in Maple (so you don't have to wait 14 seconds for it to be created, and that's why I was wondering what you were comparing mathematica to)

    in Maple if you apply the commands:
    Code (Text):

    The rank 8, Euclidean, Levi-Civita symbol is created and accessible (this occurs in real time, the timer didn't even change from 0.00s to 0.01s).

    For example, if I want to find the (1,2,3,4,5,6,7,8) component, I type:

    Code (Text):
    LeviCivita[1, 2, 3, 4, 5, 6, 7, 8];
    And I get the answer: 1

    Code (Text):
    LeviCivita[2, 3, 4, 5, 6, 7, 8, 1];
    Gives the answer: -1

    Code (Text):
    LeviCivita[2, 3, 4, 5, 6, 7, 8, 8]
    Gives the answer: 0

    This all happens essentially in real time,

    After applying all of those commands the timer still hasn't gone up from 0.00s to 0.01s.
  23. Dec 21, 2009 #22
    Hi again,
    I just tested what would happen if I cranked up the dimension to 30,
    and the Levi-Civita symbol still works flawlessly, and reports answers in real time.
  24. Dec 21, 2009 #23
    Hi juliette

    I've discoverd that mathematica also has a levi-civita function.

    Here're some timing results.

    Code (Text):

    In:=  myTiming[LeviCivitaTensor[8]]
    Out=  0.0906

    In:=  myTiming[LeviCivitaTensor[9]]
    Out=  0.875

    In:=  myTiming[LeviCivitaTensor[7]]
    Out=  0.0000125

    In:=  a = LeviCivitaTensor[7]
    In:=  b = LeviCivitaTensor[7]
    In:=  myTiming[Dot[a,b]]

    Out= 0.219
    I'm a bit concerned that my computer can't manage a dot b in eight dimenions without running out of memory, so the test was for 7 dimensions.
  25. Dec 22, 2009 #24
    So it looks like Mathematica takes 0.8 seconds to make a rank 9 Levi-Civita pseudotensor, while Maple takes less than 0.01 seconds to make one of rank 30.

    Maple's dot product of the rank 30 Levi-Civita with itself takes 0.49 seconds and 6.87MB of memory.

    But it just seems to good. What exactly is mathematica's dot product function doing ??
    In terms of tensor contractions, how would you write it ??
  26. Dec 22, 2009 #25
    They should really be compared on the same machine. Mine is a 2.2GHz AMD Athlon with 1G RAM running 46 processes.

    Strange. how do you figure 6.87MB? A rank 30 tensor has 30^30 total entries. A rank 30 levi-civita symbol has 30! nonzero entries.

    What does your code look like?
    Last edited: Dec 22, 2009
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook