Common denominator problem

Why can I not get a common denominator from a/2+b/3?  Maple returns 1/2*a + 1/3*b and not (3a+2b)/6.  Normal(a/2+b/3) returns the same equation.

If I simplify(a/b+b/c) I get (a*c+b^2)/(b*c) but doesn't seem to work right with numbers in there.   

 

se la vi

That's just the way Maple works.  It automatically distributes multiplication of numerics over sums.  You can fake the output using the empty function (``):

x := a/2+b/3:
makefrac := (``@numer)/(``@denom):
makefrac(x);
                                  (3 a + 2 b)
                                 ------------
                                      (6)
expand(%);
                                   a/2 + b/3


c'est la vie

Okay, yes that works. 

Haven't come across how to use an empty function (` `) yet and I haven't used the @ symbol.  Still have lots to learn.  Can't find any help on how to use the empty function but thanks for the reply.

 

emptysymbol

Look under ?emptysymbol for help on the empty symbol function. 

Thanks for correcting my gibberish francaise.

empty symbol

Nice little trick to force maple to give a common denom by the way.

?empty symbol,  I'll check it out.  Thanks

Can you give a few more examples?

Can you give a few examples using the empty function ' ' and the @ symbol so I can understand how it works a little better. 

explanation

The empty function is an inert function whose name is `` and so appears as empty (invisible). For example,

``(a);
                     (a)

It can be used to group quantities that would otherwise be combined by Maple.  It's primary use is in ifactor, where it prevents the terms from being recombined:

ifactor(6);
                     (2)*(3)

The @ symbol is used for function composition (it is the closest non-letter ascii symbol corresponding to the usual mathematical symbol for function composition, the open centered circle).  Thus

(f@g)(x)
                    f(g(x))

Similary, (``@denom)(x) is equivalent to ``(denom(x)), which visually encloses the denominator of x in parentheses. Somewhat more elaborate is

makefrac := (``@numer)/(``@denom):

This works (as described herein) because with Maple one can apply an algebraic expression to arguments, the arguments are then passed to each of the algebraic terms.  For example (f/g)(x) evaluates to f(x)/g(x).  So makefrac(x) evaluates to ``(numer(x))/``(denom(x)) which then displays the numerator and denominator of x as a fraction, with no automatic recombination (numer and denom are designed to give the appropriate answer even if their arguments are not of type `*`).

functional programming documentation

I find that this latter issue on functional style programming is barely mentioned in the documentation. In ?examples,functionaloperators :

Operators are transitive.

(a+b)(t);

	a(t)+b(t)
...

and may be not much more elsewhere.

By the way, I would call this property as distributive.

evalapply

Examples of applying the common base types to arguments are give in the help page for evalapply. 

not an obvious place

for those examples. And only one example for 'evalapply' itself...

Thanks for the explanation

I agree, I have found the documentation to be a little sparse in some areas. 

And thanks for the explanation, that was quite helpful.  By the way how did you learn how to do this?  Was it from a separate book or just from the maple help documentation?

Learning Maple

Most of my knowledge of Maple has been acquired by practice (i.e. using Maple, and trying stuff), reading the help pages, reading the programming manuals, inspecting existing code, and following this and other/previous Maple forums.

Wiki

It is a recurrent theme, but I think that a wiki could help a lot with deficiencies of documentation in some areas like this one.

jpmay's picture

Unofficial Wiki

It seems pretty rough and pretty out of date, but there is a Maple project at WikiBooks for any aspiring Wikinauts:

http://en.wikibooks.org/wiki/Maple

John

I will look at it

Thank you for this link.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}