On 2012-11-23, Jianrong Li <lijr07 at gmail.com> wrote:
> Can we use "else if" in Maxima? Thank you very much.
Yes. You can write it as "else if" or "elseif".
> Character(m, k, n, l):= block([],
Minor quibble: block([], ...) is unneeded here, since the body of it is
just one expression.
> if (Character[m][k][n][l] > 0 ) then
Minor quibble: parentheses are unneeded here.
> (Character[n][k][m][l]:Character[m][k][n][l];
> Character[m][l][n][k]:Character[m][k][n][l];
Major problem here: you must separate expressions in a block by commas,
not semicolons. E.g. if ... then (a:b, b:c, c:d) else ....
> Character[n][l][m][k]:Character[m][k][n][l]; return Character[m][k][n][l] )
Minor quibble: return is unneeded here, since the value of a (...) is
just the value of the last expression in the sequence.
> else if (m=0, k=0, n=0, l=0) then return 1
Major problem here: a conjunction must be written with "and".
E.g. else if foo and bar and baz then 1
> else if (m>0, k>0, n>0, l>0) then return (Character(m-1, k, n,
> l)*Character(m, k, n, l-1)-Character(0, 2*m-1, floor(k/2),
> 0)*Character(floor(k/2), 2*n, 0, 0))/(Character(m-1, k, n, l-1))
Hmm, I see you have Character(a, b, c, d) where you had
Character[a][b][c][d] before. Do you intend to have a function and an
array which have the same name? I think Maxima will let you do that but
it could be confusing. Maybe you are trying to construct a memoizing
function? I think you will have to explain a little more about what you
are trying to do in order for us to help you.
best,
Robert Dodier