awehring

55 Reputation

9 Badges

9 years, 330 days

MaplePrimes Activity


These are answers submitted by awehring

Thanks a lot, to all of you !

I think I will live very well with a combination of your tricks:

with(RealDomain) at the beginning of the document to cover most issues and assuming or assume where necessary. The loop is convenient too.

:-)

BTW (before someone struggles here), there is an issue, if you combine alias and assume, as assume renames your variables (x becomes x~).

E.g.

alias(`x*`=xs)   # (x* marked as Atomic Identifier)

xs+1 is (correctly) shown as x*+1

assume(xs >=0)

xs+2 is  shown as xs~+2

interface(showassumed=0)   # suppresses ~ for variables with assumptions

xs+3 is shown as xs+3

 

But assuming works fine (but of course just for the statement, where you set it).

I prepared my first pretty printed excercise sheet and with "alias" the complicated variable names werer easy to use. For those with similar tasks, here are my experiences. I'm using 2D Math.

The underlying problem is, that Maple interprets things on the fly. So y^e results in y to the power of e, printed as ye. If you want a variable named ye, where e stands for "expected", and ye ≠ y, you need to handle it correct.

The solution is called "Atomic Identifier" and works like this: Enter ye, then select the whole variable with the mouse and hit Ctrl-Shift-A, or the menupath "Format" -> "Convert To" -> "Atomic Identifier". ye is than converted to a complicated internal representation, denoting a single variable - thats, what you want.

But there is a big drawback: EVERY time you want to use ye, you have to mark it as an Atomic Identifier. Quite arduous.

The easy way is, to use the function "alias", which gives your ye a simple shortcut.

alias(ye=pe)

IMPORTANT: ye must be defined as Atomic Identifier BEFORE you hit return !

After defining this, you key in pe and it is always translated to the variable ye in the output. So, when you type an expression with ye, you just type pe instead.

 

When your superscript is a symbol, not a letter, you need a twist. Symbols are often interpreted as mathematical functions. E.g. y' stand for differentiation, y* (= y^*) for the Hermitian Transpose.
The twist is the backquote: `
Any text between backquotes is not interpreted by Maple.

alias(`y*`=ya)

alias(`y'`=ys)

This gives you two variables with the names y* and y'. Nice, isn't ist?

For subscripts, there is and easier way to impose the conversion to an Atomic Identifier: Use Ctrl + Shift + _ instead of _ . Just underline references a vector element, so y1 is the same as y[1], if you key y1 in with _ . Using Ctrl+Shift+Underline gives you an Atomic Identintifier, looking the same: y1

 

You can do fairly complicated stuff and save a lot of time, as you type your formulas.

Try
alias(πSSe=pess)

Don't forget to mark it as Atomic Identifier! Typing pess is much faster than doing that "super-and subscripting and marking as Atomic Identifier" in every expression. BTW, economists would call this the "expected steady state inflation rate".

Combining super-/subscripting with symbols does not to work - or at least I could not find a solution. The backquotes suppress the super-/subscripting.

 

I put all the alias at the beginning of the document. It is imortant, that you execute them, when you reopen the document or restart the Maple server. Otherwise your shortcuts don't work.

Problems might arise, when you mix the use of shortcuts and key in the denoted variable names directly. The best is to always use the shortcuts.

With
lprint((3))

you see the internal representation of the variables in an expression - (3) is here an example for a label. This is useful to find errors when you mixed shortcuts and directly entered variabale names, or forgot to mark it as Atomic Identifier.

Example:
x=ye - ye

lprint(%)

gives
x = `#msup(mi("y"),mi("e"))`-y^e

You see the complicated name of the variable ye and that the second ye was typed as y^e , what is y to the power of e !

 

@patrick and Joe Riel:

 

PERFECT !

works like a charm !

 

In fact, I strated to play around with the Typesetting Rules, but your apprach is the uch saver.

 

Thanks a lot to all !

 

In the help system I discovered the likely solution: Typesetting rules

But it is deterrent, a complex bunch of rules. It apears likely, that I end up worse, than I'm now, if I start reconfiguring it, without deeper understanding.

It is too bad, as I would really save a lot of time, if I could prepare my papers with Maple instead of LaTex.

 

So I can only hope, that the white knight appears here ...

Up to now, I have the problem with * and '

... but who knows, what comes up tomorrow.

 

Renaming the variables would shurely help with Maple. But I'm preparing educational material and they must be with the common names.

E.g. it is common (in my environment) that Y* denotes foreign Gross Domenstic Production, while Y denotes home GDP,  overlines are for constant (exogenes) factors; the ' is often used for equilibrium values.

Page 1 of 1