Oh, it may not be documented, but tex(a+b,false) produces
a string result, not sent to a file, so
concat("hello there ", tex(a+b^2,false), " good bye");
results in a single string. Actually it is an atom with
a long print name.
On the assumption that you are doing some programming
anyway, and are therefore writing in some non-Lisp
language also, why not consider learning Lisp. I think
that even if you spent 2 weeks on this task, it would
be reclaimed in the total project time.
While Maxima's internal language is lisp + many extensions,
it still looks pretty much like lisp.
Richard Fateman wrote:
> This is certainly possible to do. The tex function is defined in a
> file called mactex, but it is written in lisp, so you would either have
> to learn some lisp or find someone who knows lisp.
> However, you are working on several faulty premises.
>
> 1. A person who can solve a calculus problem has the interest and ability
> to type it in to a computer algebra system perfectly.
> 2. A person who CAN'T do calculus, even more miraculously, can type the
> answer (wrong...) into a computer algebra system perfectly.
> 3. The computer will differentiate the correct answer to get the
> integrand
> IN THE SAME FORM, EASILY CHECKED. Since 80% (my guess) of the correct
> answers will be typed incorrectly, people
> will not believe the computer feedback.
>
>
>
> Some people have used point-evaluation tests to check results
> heuristically.
>
> (Good luck, anyway)
>
> RJF
>
>
> Chris Sangwin wrote:
>
>> I am relatively new to Maxima, but have tried to find the answer to this
>> question in the FAQ and docs.
>>
>> I am using Maxima as part of a computer aided assessment system to
>> automatically mark students' work, and as part of this am concatinating
>> strings to generate feedback. I would like to capture the output
>> from the
>> TEX function as a string. For efficiency reasons I don't want to
>> write to
>> a file and then load this back.
>>
>> Also, I'd like to get just the raw TeX associated with a Maxima variable
>> without the $$'s around the string - sometimes I'd like to produce
>> inline
>> equations, or construct arrays say, with specified entries. In short
>> I'd
>> like a little more control.
>> Where is the TEX function defined? Is there a doc? How would I
>> customise
>> this? I am a LISP virgin!
>>
>> The sort of syntax I'd like is the following:
>>
>>
>> WrongAnswer: x^2/2*EXP(x)+c;
>> Integrand:x*EXP*(x);
>>
>> FB1:"Incorrect answer. You were asked to integrate $"$
>> T1:TEX(Integrand);
>> FB2:"$. The derivative of your answer should be equal to the
>> function that you were asked to integrate. In fact the derivative of
>> your answer is \\["$
>> T2:TEX(Diff(WrongAnswer,x));
>> FB3:"\\] So you must have done something wrong!"$
>>
>> FeedBack:CONCAT(FB1,T1,FB2,T2,FB3);
>>
>> Many thanks in advance for any advice.
>>
>> Chris Sangwin
>> ----------------------------------------------
>> LTSN Maths, Stats & OR Network
>> School of Mathematics and Statistics
>> University of Birmingham
>> Birmingham, B15 2TT
>> United Kingdom
>> +44 121 414 6197
>> ----------------------------------------------
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima@www.math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima