I was used to define functions in the following manner in Maple
Classic ( Version 13 and lower ), e.g.
f:=(i,j)-> if i<=j then 0 else i+j;
In the Classic Version this definition is accepted.
Now I like to use ( because of some ExcelExport application ) the
Maple Standard work sheet.
A function definition implying the if-statement is in Maple Standard
rejected.
How can I define such functions in Maple Standard ?
Wim
> I was used to define functions in the following manner in Maple
> Classic ( Version 13 and lower ), e.g.
>
> f:=(i,j)-> if i<=j then 0 else i+j;
>
> In the Classic Version this definition is accepted.
I doubt that. At least my Maple 6 needs a closing "fi" for the "if"
construction.
f:=(i,j)-> if i<=j then 0 else i+j fi;
f(3,4) ... yields 0
f(4,3) ... yields 7
You could try the ` quotes as follows:
g := (i,j) -> `if`(i <= j,0,i+j);
g(3,4) ... yields 0
g(4,3) ... yields 7
Cheers,
Rainer
Use "piecewise"
f := (i,j) -> piecewise(i<=j,0,i+j);
f(1,2);
0
f(3,2);
5
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/
Nice solution. I knew "piecewise" but did not realize that I could use
this command as an escape.
Wim
Thank you. I forgot the "end if". Your solution is a shorthand
notation for Edgar's solution. I like yours too.
Is there a secret Maple Handbook ?
Wim
It would be helpful to buy a book about Maple. My favourite is the
one by Andre Heck, called "Introduction to Maple". Don't be fooled by
the word "introduction": it has plenty of advanced material.
R.G. Vickson
>
> Wim
I have its 2nd ed. (1996). My main problems were things new since
Maple V.4 and things omitted from the index. The additions below to
the index may help others who have that edition. A page number in ( )
below means an addition to a list of page numbers already there.
{ } for sets, 296
[ ] for lists, 298
for,
from, 14,21,126
while, 121,123
with lists, 308
forget,
see also unapply,unassign
fsolve,
assigning solutions, 71
if, 196
integration,
dependence on parameters, 76
interface
text-based 37,96
worksheet 30-32,35,37,96
list
see lists
loops,
finite, see for
Newton-Cotes method, for numerical integration, (242)
polynomials,
converting series to, 272,275,276
premature evaluation, 76
printing messages, 98-99,130,254, see also infolevel
proc, 202
quadrature, 242
unapply, see also forget
while, 121,123
worksheet interface, (35,37,96) and that heading ought not to be
indented: it isn't a subheading under word size.
-- John Harper
I updated my edition of the book when I updated software to to much
newer versions of Maple. My current edition of Heck is the 3rd,
published in 2003. I have not checked all the material you give
above. Still, I am sure the OP would be glad to know of better books
if we could supply the titles.
R.G. Vickson
Dear Ray,
1) The reference ( an electronic Maple book in dutch ) given by Adri
van der Meer was also helpful.
Choose " Maple Input" in the "Input Display". Then I can use ( in the
Standard Worksheet ) the function definition ( with "if" ) I am used
to.
2) I have a lot of Maple books, also Heck's book ( third edition ).
But I could not find a quotation about my problem in it.
Wim ( Schmitz )