cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Best format for writing Mathcad expressions in text?

StuartBruff
23-Emerald III

Best format for writing Mathcad expressions in text?

Reference message Online Encyclopedia of Integers (OEIS) Sequence A256275

The Online Encyclopedia of Integer Sequences (The On-Line Encyclopedia of Integer Sequences® (OEIS®)) only accepts entry information in text format.   This creates a bit of a problem for Mathcad entries.

Mathcad is rare in that it only has a "Math Form" input and display, with (for example) summation being represented by Sigma (Σ) with underscript and overscript notation for the variable and initial value (k=1) and final value (n), respectively; similarly, expressions such as 2^(n^2) and (a+b)/(c+d) can be written and displayed without the need for parentheses to disambiguate them from 2^n^2 and a+b/c+d.

However, there is no universally agreed method of conveniently writing down a Mathcad expression that is readily meaningful for both Mathcad and non-Mathcad users.

Keystrokes are one method for Mathcad users but they don't "show" the expression, and don't give much insight into an expression; they do, however, allow a Mathcad user to enter the expression as intended. For example:

a ( n ) : 2 ^ n ^ 2 End + ' 1 + Ctl-$ 2 ^ ' n + 1 Space Space * ' n - k Tab k Tab 1 Tab n Tab

then

a ( 3 ) = to evaluate numerically or

a ( 3 ) Ctl-. to evaluate symbolically

where you type each of the characters in the order shown, with End, Ctl-$, Space, Tab and Ctl-. represent the

corresponding keys (the actual spaces above between the key characters act as key delimiters and don't get typed; a space is only typed where Space is written.

I wouldn't wish the saved (Mathcad 14/15) .xml format on my worst enemy ... well, I might! However, it is possible to process the xml to get rid of the tags, which gives more readable formats, but probably wouldn't be too recognizable to the average Mathcad user. Eg:

a ( n ) := ( plus ( plus 2 ( plus n 2 ) ) ( ( plus 1 ( summation lambda ( ( k ) ( plus 2 ( mult ( ( plus n 1 ) ) ( ( minus n, k ) ) ) ) ) ( 1, n ) ) ) ) )

or (removing some of the spaces adjacent to parentheses)

a( n ):=( plus( plus 2( plus n 2 ))(( plus 1( summation lambda(( k )( plus 2( mult(( plus n 1 ))(( minus n, k )))))( 1,

n )))))

or (removing all of the spaces adjacent to parentheses)

a(n):=(plus(plus 2(plus n 2))((plus 1(summation lambda((k)(plus 2(mult((plus n 1))((minus n, k)))))(1, n)))))

or (changing arithmetic function names to their usual symbols)

a(n):=(+(+ 2(+ n 2))((+ 1(summation((k)(+ 2(*((+ n 1))((- n, k)))))(1, n)))))

As an occasional dabbler in functional languages such as LISP, I'm OK with the above xml transformations, but I suspect not everybody would be.

Unfortunately, Prime doesn't save files in pure text xml format (unlike Mathcad 15), and has no components so it's not possible to iterate over all the regions and extract their xml codes, which makes it a problem converting expressions to text anyway.

Ideally, any such representation should act in furtherance of the long-standing requests to have a "standard" text format input and output format for import/export of equations.

What format would people recommend for writing Mathcad expressions as text?

Stuart

5 REPLIES 5

Hi Stuart,

How about just a text file (".txt" file format)?

StuartBruff
23-Emerald III
(To:VladimirN)

VladimirN. wrote:

Hi Stuart,

How about just a text file (".txt" file format)?

Sorry,  Vladimir.  I didn't mean the format for saving the expression (we sort of have a text file format in the xmcd files), but rather how to write a Mathcad expression as a text string,  in a way that is unambiguous amd as directly meaningful as reasonable to both Mathcad users and those unfamiliar with it.

What,  for example,  is the best way to explicitly write an equation? Should it be FORTRAN or C or LISP style? It would help if there was a standard publicised name for operators (eg, summation and a definite integral), which there is at xml level.

It would be very useful to have Mathcad export and import strings in such a format (it's a fairly straightforward job to convert the xml to a LISP-like expression and only a bit more effort to put it into standard arithmetic notation).

Stuart

RichardJ
19-Tanzanite
(To:StuartBruff)

What format would people recommend for writing Mathcad expressions as text?

Question does not compute! Brain overheating! Emergency shutdown!

LucMeekes
23-Emerald III
(To:RichardJ)

Interesting topic.

For years I have been looking for the right software that will help my son, who's writing abilities are deteriorating but who can still type, to do his maths, physics and chemistry homework and, more importantly, the school tests/exams on computer.

The problem is that any software he uses is not allowed to be solving, while it must be interpretative in knowing how to present formulae, and fast to enter. Hence Prime is no good (lacks speed, calculates), Mathcad is also not allowed (calculates) but he uses it now mostly to make his maths homework.

Only today was I pointed to efofex (www.efofex.com), who produce software (specifically "FX Equation") that may come very close to what he needs.

I just started to try it out, and have some more evaluation to do.

The direct relation to this topic is that Efofex's Equation uses a text entry format and converts it to a standard, good-looking math equation.

My proposal would be to standardize on Efofex's format.

Luc

athurin
12-Amethyst
(To:LucMeekes)

I don't know if that would work for you, but when I was in university, I used LaTeX. It's "just" word processing, no solving there, but the math look absolutely gorgeous ! There is a learning curve though, as it is not "what you see is what you get", but some editors (TeXStudio, TeXMaker, for instance), have GUIs to help with this sort of things ...

I am still a huge fan of LaTeX, but it is so sad that it is not used in the industry ...

Announcements

Top Tags