On 8 Şubat, 12:51, Jerome Lacoste <[email protected]> wrote:
> Hi all,
>
> We're trying to find a way to get sage to generate latex
> representation of numeric expressions without fully evaluating them.
>
> For example this would allow us to do something like render 1+5 in
> latex as $1+5$ instead of 6.
> Can someone tell us if it's possible to achieve this goal ? Maybe by
> doing something like
>
> var('a')
> var('b')
> sage_exp("a + b", locals={'a': 1, 'b': 5})
>
> This may require adding new code.
>
> I prefer to discuss design upfront. I am new to the project.
> I've been looking a bit at the sage.symbolic.expression class.
>
> Pointers appreciated.
>
> Cheers,
>
> Jerome
>
> Our background:
> *******************
>
> We've been experimenting with an exercise generator for math students.
> Target age: <=18 years old at start.
> Our first version of the program uses a custom language and a ply (lex/
> yacc) parser. Our exercises are dynamic with some randomness for both
> variables and operations. Example of an exercise:
>
> id0
> "Compute"
> a (1;5)
> b (-5;-1)
> s \sign1
> solve a s (b)
> solution \res {a s (b)}
>
> (add or substract 2 numbers)
>
> or
>
> id21
> "Write the answer in standardform"
> a, c, e, g \d(1;10)
> b, d, f, h (-4;4)\0
> solve \frac {\res {\decform{a*10^b}} * \res {\decform {c*10^d}}}{\res
> {\decform{e*10^f}} * \res {\decform{g*10^h}}}
> solution \stdform {\res {\frac {\res  {a*10^b} * \res {c*10^d}}{\res
> {e*10^f} * \res {g*10^h}}}}
>
> For our second prototype, we've been exploring alternative designs, in
> particular using Domain Specific Languages instead of a parser. Here
> comes sage.
> Sage seems great for everything that is advanced maths. But is harder
> to use when it comes to simple numeric expressions. As the expressions
> are evaluated right away, I am unable to render 1+5 in latex. It gets
> printed as 6 instead of $1+5$
>
> Other example: 2/4 + 1/4 should be $\frac{2}{4} + \frac{1}{4}$ and not
> $\frac{1}{2} + \frac{1}{4}

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to