Maxima CAS in Stack - syntax for x-bar

Maxima CAS in Stack - syntax for x-bar

by Edwina Jones -
Number of replies: 4

Hi, we're developing a statistics quiz using STACK and would like students to be able to enter x-bar (symbol for the mean) into their answers. I have looked everywhere I can think of to find the syntax in maxima for this, without any luck.

Can anyone help please. Many thanks in advance

Average of ratings: -
In reply to Edwina Jones

Re: Maxima CAS in Stack - syntax for x-bar

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
STACK discussion tends to take place in the 'Mathematical tools' forum. I will move this discussion there.
In reply to Edwina Jones

Re: Maxima CAS in Stack - syntax for x-bar

by Christopher Sangwin -
Picture of Plugin developers

The first question to answer would be "what does x bar mean?".  STACK tries to encourage meaning in mathematics.

If it has no meaning then you could just have students type in "bar(x)".  Then define

texput(bar,lambda([ex],sconcat("\\bar{", tex1(first(ex)), "}")));

to display the "bar" function (which does nothing) with a bar over the argument.

Do you have "mean" in mind? Maxima has a "mean" function already.  Is that what you want?

That's a little more complex, because Maxima's mean function expects a list. If you type mean(x) you will get an error.  You could put the following in the question variable.

mean(ex):=texmean(ex);
texput(texmean,lambda([ex],sconcat("\\bar{", tex1(first(ex)), "}")));

but then you won't have the "mean" function available elsewhere in the question!

Chris

In reply to Christopher Sangwin

Re: Maxima CAS in Stack - syntax for x-bar

by Edwina Jones -
Hi Chris,
 
This is great thanks. I got the mean function to work (I think). It passes the question tests anyway.
 
Kind regards
Edwina