Passing latex formulae directly to HotEqn?

20 views
Skip to first unread message

frans.morville

unread,
Jun 14, 2010, 6:46:49 AM6/14/10
to mathpiper-user
The idea of ”piping” maths information from one program to another is
exciting. I came to learn about MathPiper through Geogebra (which is
excellent for visualizing geometry and graphs), and I see the
%geogebra folds as an interesting way to pass results from CAS
calculations to geogebra.
As a secondary school teacher I have tried in the last two months to
use the MathPiper/Yacas CAS-programming language to create activities
where algebraic manipulations (removing/expanding brackets, solving
equations, calculations with fractions …) are done stepwise by the
students, just typing one-letter commands at a time (responding to
questions from the program: What to do now with this subexpression:…)
What I need now is the formulae (containing fractions and roots) to be
displayed nicely and immediately using HotEqn.
I am running the Windows edition. It looks like some commands can and
others can’t be sent immediately from MathPiper to another program:
GeogebraPoint( ) and GeogebraPlot( ) can be called from inside a
MathPiper fold with immediate response in Geogebra.
And Histogram(..) etc can send information immediately to JFreeChart
from a MathPiper fold.
It would very useful if latex formulae could be sent directly from the
MathPiper Program to HotEqn.
And nice if HotEqn could take the same place on the screen as Geogebra
and JFreeChart: the right hand side of the screen, making it possible
for HotEqn and the MathPiper Execution window (bottom left) to be seen
at the same time)
Frans Morville, Copenhagen, Denmark

Ted Kosan

unread,
Jun 14, 2010, 12:13:52 PM6/14/10
to mathpip...@googlegroups.com
Frans wrote:

> As a secondary school teacher I have tried in the last two months to
> use the MathPiper/Yacas CAS-programming language to create activities
> where algebraic manipulations (removing/expanding brackets,  solving
> equations, calculations with fractions …) are done stepwise by the
> students, just typing one-letter commands at a time (responding to
> questions from the program: What to do now with this subexpression:…)

This program sounds very interesting! Would you be willing to post
the code to the group so we can play with it?

> What I need now is the formulae (containing fractions and roots) to be
> displayed nicely  and immediately using HotEqn.
> I am running the Windows edition.  It looks like some commands can and
> others can’t be sent immediately from MathPiper to another program:
> GeogebraPoint(  )  and   GeogebraPlot(  ) can be called from inside a
> MathPiper fold with immediate response in Geogebra.
> And  Histogram(..) etc can send information immediately to JFreeChart
> from a MathPiper fold.
> It would very useful if latex formulae could be sent directly from the
> MathPiper Program to  HotEqn.

The unreleased version of MathPiper which is in the source code
repository contains two new functions called ViewLatex and ViewMath.
ViewLatex takes LaTeX code as input and displays a window which shows
the rendered version. ViewMath is similar to ViewLatex, except it
takes a MathPiper expression as input and renders it.

If you would like to try these new functions now, I can provide
instructions for checking the current version of MathPiper out of the
source code repository and building it. If you don't think you can
check out the code and build it, you can wait for the next release of
MathPiper, which should be made within the next couple of weeks.

> And nice if HotEqn could take the same place on the screen as Geogebra
> and JFreeChart: the right hand side of the screen, making it possible
> for HotEqn and the MathPiper Execution window (bottom left) to be seen
> at the same time)

You can move the HotEqn plugin to the right side of the application by
selecting the small black triangle which is near the lower left corner
of the application. This is the docking menu and it will allow you to
move the plugins around.

Ted

frans.morville

unread,
Jun 15, 2010, 11:09:17 AM6/15/10
to mathpiper-user


On 14 Jun., 18:13, Ted Kosan <ted.ko...@gmail.com> wrote:
> This program sounds very interesting!  Would you be willing to post
> the code to the group so we can play with it?

There are two programs made: Equations and Brackets, and one program
(Fractions) to be worked on.
The first program is relatively simple, and others will be able to
modify it.
I have now translated the user interface from Danish into English, and
I have copied it to the bottom of this post.
(as far as I can see File attachments are not possible here).
The "Remove Parentheses" (from inside out) program is easy to use,
but
the code is somewhat more complicated. If there is an interest in it,
I shall translate it.
(It hasn't been tested with students yet)
>
> The unreleased version of MathPiper which is in the source code
> repository contains two new functions called ViewLatex and ViewMath.
> ViewLatex takes LaTeX code as input and displays a window which shows
> the rendered version.  ViewMath is similar to ViewLatex, except it
> takes a MathPiper expression as input and renders it.
>
> If you would like to try these new functions now, I can provide
> instructions for checking the current version of MathPiper out of the
> source code repository and building it.

If it is not too hard, I would like to try. The ViewMath will
certainly be of
great value for the Equations program and for the Fractions program

> > And nice if HotEqn could take the same place on the screen as Geogebra
> > and JFreeChart: the right hand side of the screen,...
>
> You can move the HotEqn plugin to the right side of the application by
> selecting the small black triangle which is near the lower left corner
> of the application.  This is the docking menu and it will allow you to
> move the plugins around.
Yes ! Perfect !

Frans

List of commands and examples after the mathpiper fold.

%mathpiper,title="equationsolving"

antalOp:=4;
laengde:=4;
Retract("ops",1);
Postfix("ops",10);
ops(antal):= [If(IsPositiveInteger(antal) And antal<6,
[antalOp:=antal;], antalOp);
lign:=ligning(laengde,1);];

Retract("new",1);
Prefix("new",10);
new antal:= [If(IsPositiveInteger(antal) And antal<20,
[laengde:=antal;], laengde);
lign:=ligning(laengde,1);];

brug(vs,hs):= [lign:= vs==hs; oprlign:=lign;];

Retract("tr",2);
100 # tr(_a, _lop)_(n=lop) <-- ligning(laengde,1);
100 # tr(_a + _b == _c, _lop)_(m=lop) <-- a == c-b;
100 # tr(_a - _b == _c, _lop)_(p=lop) <-- a == udglat(c+b);
100 # tr(_a * _b == _c, _lop)_(d=lop) <-- a == c/b;
100 # tr(_a / _b == _c, _lop)_(t=lop) <-- a == c*b;
100 # tr(_a ^ _b == _c, _lop)_(r=lop) <-- a == c^(1/b);
100 # tr(_a ^ _b == _c, _lop)_(l=lop) <-- a == Ln(c)/Ln(b);

100 # tr(_a + _b == _c, _lop)_(i=lop) <-- udglat(b+a) == c;
100 # tr(_a * _b == _c, _lop)_(i=lop) <-- udglat(b*a) == c;
100 # tr(_a == _c, _lop)_(f=lop) <-- -a == -c;
100 # tr(_a == _c, _lop)_(w=lop) <-- c == a;
100 # tr(_a == _c, _lop)_(s=lop) <-- Simplify(a)== Simplify(c);
100 # tr(_a, _lop)_(z=lop) <-- veryoldlign;
120 # tr(_a, _lop) <-- a;

Retract("'",1);
Postfix("'",10);
'(x) := [
veryoldlign:=oldlign;
oldlign:=lign;
lign:=tr(lign, x);
];

opbyg(vartal, varlist, xMed):=
[
tegn:=If(xMed, Replace(varlist, RandomInteger(vartal), x)
, varlist);
brugte:=0;
resv:=1;
total:=vartal;
udtr();
];

udglat(p):=
PipeFromString(ExpressionToString(p):";") Read();

ligning(lv,lh):=
oprlign:=udglat(opbyg(lv, {a,b,c,d,e,f,g,h,i}, True)
== opbyg(lh, {k,m,n,p}, False));

vari():=[
brugte++;
resv--;
tegn[brugte];
];

udtr():=[
Local(out,pot,varibool,operat, op1,op2);
pot:=total-brugte-resv;

varibool:=If(pot=0, True
, If(resv=1, False
, RandomInteger(2)<=1));
If(brugte>=8 Or resv<1 Or pot<0, Break());
operat:=RandomInteger(antalOp);
out:=If(varibool, vari(),
[resv++;
op1:=udtr();
op2:=udtr();
{op1+op2, op1-op2, op1*op2, op1/op2, op1^op2}[operat];
]);
out;
];

%/mathpiper

%output,preserve="false"
Result: True
. %/output


Solve for x. x appears only once in the eqaution.
The left side of the equation is analysed, broken up into e.g.
(first) - (second) = (third)
(or maybe + * / ^ in stead of - )
Here you are required to move "(second)" to the right side of the
equation using
the command p ' meaning: add (second) on both sides.

Try to get x as far left as possible
If x has been moved to the right side of the equation get it back to
the left side using w ' (swap),
and then use i ' (intercahange) to move x further to the left in the
equation.

Commands (to be executed in the MathPiper window)
n ' new equation

p ' plus (add) something on both sides
m ' minus (subtract) something on both sides
t' times (multiply) something on both sides
d ' divide by something on both sides
r ' root/reciprocal exponent used for solving : x^a = b -> x = b^(1/
a)
l ' logarithms used for solving: a^x = b -> a = Ln(b)/Ln(a)

(s ' simplify on both sides - not necessary, but sometimes makes
things more clear)
w' swap: a=b -> b=a
i' interchange: a+x -> x+a or a*x -> x*a
z ' undo: back (1 step possible).

new 5 new equations, now with 5 variables on the left side.
2 ops from now on use only 2 different operators: + - in the new
equations
...
5 ops from now on use all 5 different operators: + - * / ^ in the
new equations

When you arrive at x== ... the equation is solved.
Get a new problem with n '

EXAMPLE 1:
In> n '
Result: (a*b+x)*d==k

In> d '
Result: a*b+x==k/d

In> i '
Result: x+a*b==k/d

In> m '
Result: x==k/d-a*b


EXAMPLE 2:
In> n '
Result: a/(b-x)-d==k

In> p '
Result: a/(b-x)==k+d

In> t '
Result: a==(k+d)*(b-x)

In> w '
Result: (k+d)*(b-x)==a

In> i '
Result: (b-x)*(k+d)==a

In> d '
Result: b-x==a/(k+d)

In> p '
Result: b==a/(k+d)+x

In> w '
Result: a/(k+d)+x==b

In> i '
Result: x+a/(k+d)==b

In> m '
Result: x==b-a/(k+d)

Ted Kosan

unread,
Jun 16, 2010, 2:47:33 AM6/16/10
to mathpip...@googlegroups.com
Frans wrote:

> There are two programs made:  Equations and Brackets, and one program
> (Fractions) to be worked on.
> The first program is relatively simple, and others will be able to
> modify it.
> I have now translated the user interface from Danish into English, and
> I have copied it to the bottom of this post.
> (as far as I can see File attachments are not possible here).
> The "Remove Parentheses" (from inside out) program is easy to use,
> but
> the code is somewhat  more complicated. If there is an interest in it,
> I shall translate it.
> (It hasn't been tested with students yet)

Thanks for posting this code, it is indeed interesting. My guess is
that you learned how to write advanced programs like this using Yacas,
because we have not created MathPiper documentation yet which explains
how to develop MathPiper programs which use pattern matching. I am
going to look into the idea of placing programs like this into the
project Wiki so that they are easily accessible.

>> If you would like to try these new functions now, I can provide
>> instructions for checking the current version of MathPiper out of the
>> source code repository and building it.
>
> If it is not too hard, I would like to try.

I just added the following page to the http://mathpiper.org website,
and it explains how to obtain the MathPiperIDE source code and build
it:

http://sites.google.com/site/mathpiper/Check-Out-And-Build

If you run into difficulties, don't hesitate to ask questions :-)

Ted

frans.morville

unread,
Jun 30, 2010, 3:41:41 PM6/30/10
to mathpiper-user


On 16 Jun., 08:47, Ted Kosan <ted.ko...@gmail.com> wrote:
....  My guess is
> that you learned how to write advanced programs like this using Yacas,
> because we have not created MathPiper documentation yet which explains
> how to develop MathPiper programs which use pattern matching.

Yes, I found the Yacas manuals at the Yacas site, in the coding book
it is explained very well.
(The site does not answer now, so I can't paste the link.)
I also tried the online version of Yacas. With some small
modifications I got my equations program run there,
But for programs a little bit larger it would not work.
And debugging - very difficult and annoying compared to MathPiper.

> >> If you would like to try these new functions now, I can provide
> >> instructions for checking the current version of MathPiper out of the
> >> source code repository and building it.
...
> I just added the following page to thehttp://mathpiper.orgwebsite,
> and it explains how to obtain the MathPiperIDE source code and build
> it:
> http://sites.google.com/site/mathpiper/Check-Out-And-Build
...
> Ted

Thanks! I managed to checkout and build after some trials. And I have
noticed now a new "official" beta .79b
Here both the ViewMath and the ViewLatex work.
They appear in floating windows with 2-3 panes having different
appearences of the same formula.
(For trial I guess?). Is it possible - or will it be possible - to
close the windows from a MathPiper commmand? Or to replace the old
content of the window with new content? Like the HotEqn pane?.
As it is now there may be 15 or 20 windows to clean up after a short
session with one of my step by step algebraic manipulation programs.

And will it be possible for the ViewMath and ViewLatex windows to be
"docked" in a fixed place like e.g. the HotEqn window etc.?
For the time beeing I use the PrettyForm for output. Works all right,
but of course not as nice as the Latex output.
- -
Now school is on vacation, but I am looking forward to trying the
things out with the students in August or September.

Another thing that is used a lot with CAS programs in secondary
schools is of course the "Solve" function.
Even at most part of the written exams CAS programs are allowed in
our school system.
With the Texas Instrument programs, that are most often used, Solve
etc. can be put into "real" mode.

It would be very nice if MathPiper got something like a "SolveReal"
function, where complex numbers do not occur, neither in input nor
output.
Where e.g. the following could give an answer:

SolveReal(x^(3/2) == 4, x)
SolveReal(3*(1.5)^x == 2^x, x)
SolveReal((x-3)*(x^2+3) == 0, x) (only the real root x=3, please)

Frans Morville

Ted Kosan

unread,
Jul 1, 2010, 1:35:15 AM7/1/10
to mathpip...@googlegroups.com
Frans wrote:

> I managed to checkout and build after some trials. And I have
> noticed now a new "official" beta .79b
> Here both the ViewMath and the ViewLatex work.
> They appear in floating windows with 2-3 panes having different
> appearences of the same formula.
> (For trial I guess?).

Yes, I am currently testing these Latex rendering functions and this
is why they have multiple views of the same formula. My goal is to
get to the point where only the nicely rendered one in the bottom pane
is used.

> Is it possible - or will it be possible - to
> close the windows from a MathPiper commmand? Or to replace the old
> content of the window with new content? Like the HotEqn pane?.
> As it is now there may be 15 or 20 windows to clean up after a short
> session with one of my step by step algebraic manipulation programs.
>
> And will it be possible for the ViewMath and ViewLatex windows to be
> "docked" in a fixed place like e.g. the HotEqn window etc.?

I should be able to add all of these capabilities, and since I am
currently working on the Latex rendering functions, I will plan to add
them sooner rather than later.

But what I am shooting for is to have the rendered Latex displayed in
the MathPiper console underneath the code that generated it. I am
planning on adding the ability for the MathPiper console to be able to
work with %mathpiper folds in addition to In> prompts so the rendered
Latex will be placed beneath each of these :-)

> Another thing that is used a lot with CAS programs in secondary
> schools is of course the "Solve" function.
> Even at most part of the written exams  CAS  programs are allowed in
> our school system.
> With the Texas Instrument programs, that are most often used, Solve
> etc. can be put into "real" mode.
>
> It would be very nice if MathPiper got something like a "SolveReal"
> function, where complex numbers do not occur, neither in input nor
> output.
> Where e.g. the following could give an answer:
>
>  SolveReal(x^(3/2) == 4, x)
>  SolveReal(3*(1.5)^x == 2^x, x)
>  SolveReal((x-3)*(x^2+3) == 0, x)  (only the real root x=3, please)

Sherm is currently working on improving the Solve function so I will
let him address the idea of MathPiper having a SolveReal function.

Ted

frans.morville

unread,
Jul 1, 2010, 6:32:26 AM7/1/10
to mathpiper-user


Thanks for very fast and very promising answers!

On 1 Jul., 07:35, Ted Kosan <ted.ko...@gmail.com> wrote:
> But what I am shooting for is to have the rendered Latex displayed in
> the MathPiper console underneath the code that generated it.  I am
> planning on adding the ability for the MathPiper console to be able to
> work with %mathpiper folds in addition to In> prompts so the rendered
> Latex will be placed beneath each of these :-)

This sounds very nice and useful!
If you haven't allready planned it, may I suggest that it could be
possible to
keep and save a history of rendered Latex formulae in a .tex file
for later reviewing and maybe editing e.g. in TexWorks

> >  SolveReal(x^(3/2) == 4, x)
> >  SolveReal(3*(1.5)^x == 2^x, x)
> >  SolveReal((x-3)*(x^2+3) == 0, x)  (only the real root x=3, please)
>
> Sherm is currently working on improving the Solve function so I will
> let him address the idea of MathPiper having a SolveReal function.

Fine! Even a function, that only copes with quite simple equations
will be
useful in high school.

Frans Morville

Ted Kosan

unread,
Jul 5, 2010, 4:08:25 AM7/5/10
to mathpip...@googlegroups.com
Frans wrote:

> Is it possible - or will it be possible - to

> close the windows from a MathPiper command?

MathPiper now has the ability to show, hide, and dispose of the
windows which are shown by all of the ViewXXX commands. The following
code demonstrates how to do this:

In> frame := ViewMath(x^2)
Result: javax.swing.JFrame

In> JavaCall(frame, "hide")
Result: True

In> JavaCall(frame, "show")
Result: True

In> JavaCall(frame, "dispose")
Result: True


>If you haven't already planned it, may I suggest that it could be possible to


>keep and save a history of rendered Latex formulae in a .tex file

>for later reviewing and maybe editing e.g. in TexWorks.

The Latex form of expressions can be saved in a file with the following code:

In> PipeToFile("test.tex") WriteString(TeXForm(x^2));

Would you be able to use this code as a starting point to build the
history capability you are interested in having?

Ted

frans.morville

unread,
Jul 26, 2010, 3:30:40 AM7/26/10
to mathpiper-user


On 5 Jul., 10:08, Ted Kosan <ted.ko...@gmail.com> wrote:
> The Latex form of expressions can be saved in a file with the following code:
>
> In> PipeToFile("test.tex") WriteString(TeXForm(x^2));
>
> Would you be able to use this code as a starting point to build the
> history capability you are interested in having?
>
> Ted

I tried (in the current public beta version (79b/80e) of the Windows
version)

In> PipeToFile("test.tex") WriteString(TeXForm(x^2));

followed by

In> PipeToFile("test.tex") WriteString(TeXForm(1/x));

The file test.tex was apparently empty until I closed MathPiper, then
the file contained the latter formula:
$\frac{1}{x} $

Concatenating strings first it should be possible to use this
facility, e.g. for writing out math execercises created by a random
generator.

By the way: Is there a way to "Restart" , that is cancelling all
assignments etc.?
Like with PipeToFile I have seen terminating MathPiper as the only way
to get it done.





Ted Kosan

unread,
Jul 26, 2010, 12:26:02 PM7/26/10
to mathpip...@googlegroups.com
Frans wrote:

> I tried (in the current public beta version (79b/80e) of the Windows
> version)
>
>  In> PipeToFile("test.tex") WriteString(TeXForm(x^2));
>
> followed by
>
>  In> PipeToFile("test.tex") WriteString(TeXForm(1/x));
>
> The file test.tex was apparently empty until I closed MathPiper, then
> the file contained the latter formula:
>  $\frac{1}{x} $

There was a bug in the PipeToFile function which was causing it to not
close the file after it was called. I just fixed it and the fix is
available in the latest version of MathPiper (version k) which is in
the repository.

Also, the MathPiper console now displays its results in rendered Latex
format. If you click on any result with the mouse, it changes into a
text field which can be toggled between the MathPiper code version of
the expression and the Latex form of the expression. If you have some
time to look at the new console, I'd be interested to hear your
thoughts on it.

> By the way:  Is there a way to "Restart" , that is canceling all


> assignments etc.?
> Like with PipeToFile I have seen terminating MathPiper as the only way
> to get it done.

Unbind(*) unbinds all of the global variables which have been assigned
by the user:

In> a := 1
Result> 1

In> b := 2
Result> 2

In> GlobalVariablesGet()
Result> {$CacheOfConstantsN1,$numericMode2,%,a,b,I,LoadResult}

In> Unbind(*)
Result> True

In> GlobalVariablesGet()
Result> {$CacheOfConstantsN1,$numericMode2,%,I,LoadResult}


Ted

frans.morville

unread,
Sep 18, 2010, 2:57:22 PM9/18/10
to mathpiper-user


On 26 Jul., 18:26, Ted Kosan <ted.ko...@gmail.com> wrote:
...
> Also, the MathPiper console now displays its results in rendered Latex
> format.  If you click on any result with the mouse, it changes into a
> text field which can be toggled between the MathPiper code version of
> the expression and the Latex form of the expression.  If you have some
> time to look at the new console, I'd be interested to hear your
> thoughts on it.


After vacation and a lot of work in the beginning of the term, I have
now had
time to work with the Latex output in the MathPiper window.
Very impressing!
My "Equation" program immediately became very nice to look at.
And my Fraction program (after a little rewriting) also displays
expressions
(often with fractions on fractions) very nicely. The "Font+" button
is useful,
when letters get too small.
I am looking forward to trying the Equations program with my new
students
next week.

I have a few questions again:

1) Right now I use only one-letter variables, a, b, x etc.
For other purposes however, one may want to use longer variable names:
price, length, width, height
In that case it would be nice to have multiplications displayed with
a \cdot
in the rendered Latex format : length·width·height rather than
lengthwidthheight
A \cdot would also distinguish function calls from multiplications,
g(h+j) vs g·(h+j)


2) In many cases it would be nice for students to be able to save
their work done
in the MathPiper Window, and look at it again later, displayed with
the nice Latex
typesetting.
E.g. if one could print the content of the MathPiper Window it could
also be printed
to at pdf-file.


3) I tried the Unbind(*) command as you suggested to cancel all
assigments of variables.
Functions however, f(x):=3*x+4 , don't get killed.
They can be "Retracted" one by one, but is there a way to cancel all
functions defined
by the user in the current session?

Frans

Ted Kosan

unread,
Sep 19, 2010, 1:56:22 AM9/19/10
to mathpip...@googlegroups.com
Frans wrote:

> 1) Right now I use only one-letter variables,  a,  b, x  etc.
> For other purposes however, one may want to use longer variable names:
>  price, length, width, height
> In that case it would be nice to have multiplications displayed with
> a  \cdot
> in the rendered Latex format :  length·width·height   rather than
> lengthwidthheight
> A \cdot would also distinguish function calls from multiplications,
> g(h+j) vs g·(h+j)

I changed the behavior of the LaTeX rendering of multiplication to
\cdot like you suggested. The new behavior is available in
development release .79h:

http://www.mathpiper.org/development-releases

> 2) In many cases it would be nice for students to be able to save
> their work done
> in the MathPiper Window, and look at it again later, displayed with
> the nice Latex
> typesetting.

Providing the ability to save the contents of the MathPiper console to
a file and to load it from a file is a problem that I have been
researching for a number of months now. My plan for the MathPiper
console is for it to become a very rich notebook interface to
MathPiper which will be similar in functionality to the Mathematica
and MathCad notebooks. The challenge with this is coming up with a
file format which is capable of saving the following items which can
be contained in a worksheet:

- MathPiper code.
- JFreeChart information.
- 3DXplormathJ information.
- GeoGebra information.
- Styled text.
- Formulas.
- etc.

I have been holding off creating any kind of save/load capability for
the console until I had some good ideas on how to solve this problem.
I did not want to provide a simple save/load mechanism which people
would get use to using and then which would have to be replaced with
the more advanced mechanism.

However, I have finally identified some good candidates for an
advanced save/load mechanism and what I have concluded is that it will
coexist with a very simple text-only save/load mechanism which will
only be capable of saving the console as plain text with no graphics
or formatting information.

I have added simple text-only save/load capability to development release .79h.

> E.g. if one could print the content of the MathPiper Window it could
> also be printed
> to at pdf-file.

Printing capabilities and exporting to .pdf format will also be
supported in the advanced notebook GUI.

> 3) I tried the   Unbind(*)  command as you suggested to cancel all
> assigments of variables.
> Functions however,   f(x):=3*x+4   ,  don't get killed.
> They can be "Retracted" one by one, but is there a way to cancel all
> functions defined
> by the user in the current session?

Retracting only functions that users have created is a difficult
problem because there is currently no way I know of to distinguish
between functions that users have created and functions that have been
created by the system while being used. I will continue to think
about this problem in the hopes of coming up with a solution :-)


Ted

frans.morville

unread,
Oct 17, 2010, 4:40:23 PM10/17/10
to mathpiper-user
On 19 Sep., 07:56, Ted Kosan <ted.ko...@gmail.com> wrote:
...
> I changed the behavior of the LaTeX rendering of multiplication to
> \cdot like you suggested.  The new behavior is available in
> development release .79h:
> http://www.mathpiper.org/development-releases

It is very nice, the formulae are well looking and very easy to read.
I have been working with the development release in the last couple of
weeks.
I had the studens do excersises, and it went fine

...
> I have added simple text-only save/load capability to development release .79h.

Fine!
This helped us, making it easy for the students to save their work and
send it to me.
(I did not nead to see the latex format, it was enough for me to see
how far they had
succeeded)
- -
...
>My plan for the MathPiper
>console is for it to become a very rich notebook interface to
>MathPiper which will be similar in functionality to the Mathematica
>and MathCad notebooks. The challenge with this is coming up with a
>file format which is capable of saving the following items which can
>be contained in a worksheet:

>- MathPiper code.
>- JFreeChart information.
>- 3DXplormathJ information.
>- GeoGebra information.
>- Styled text.
>- Formulas.
...
Sounds very nice and useful!
There is a thing I have been wanting, and maybe it is included in your
plans:

As output after an input "In> ..."
you can now get a "Result: " nicely formatted and you can get som
text as
"Side Effects: ... using Echo in the program.

It would be nice, if you could have mixtures of text and formatted
formulas in the
"Side Effects". E.g. One line of text, one line with a formula, two
lines of text,
one formula etc.
Using Prettyform, you get it, but without the nice Latex formatting.
- - -
Another thing, that has given me challlenges and problems:
MathPiper and/or the Latex tool often changes ("simplifies") the
formulae in ways that
I don't want.
I have had great difficulty outputting (a/b) * (c/d) as two
fractions multiplied by each other
Or getting a*2 rather than 2*a
( In both cases: most often with some expressions substituted as a, b,
c, d ..)
And I have not succeded in getting e.g. (a-b) + (c-d) as an
output.
(For explanation purposes)
And it gives difficulty, when students have to determine the "Type" of
an output expression:
Example:
In> (a-b)+(c-d)
Result: a-b+c-d
In> Type(%)
Result: "+"

In> a-b+c-d
Result: a-b+c-d
In> Type(%)
Result: "-"

Is there a way to minimize the simplifying, so that only substitutions
(evaluation of assigned variables) are done? I have tried with "Hold",
but with no succes.

Frans













And

Ted Kosan

unread,
Oct 18, 2010, 1:12:04 AM10/18/10
to mathpip...@googlegroups.com
Frans wrote:

> There is a thing I have been wanting, and maybe it is included in your
> plans:
>
> As output after an input "In> ..."
> you can now get a "Result: "  nicely formatted and you can get som
> text as
> "Side Effects:  ...  using Echo in the program.
>
> It would be nice, if you could have mixtures of text and formatted
> formulas in the
> "Side Effects".  E.g. One line of text, one line with a formula, two
> lines of text,
> one formula etc.
> Using Prettyform, you get it, but without the nice Latex formatting.

I have added this enhancement request to the issue system:

http://code.google.com/p/mathpiper/issues/detail?id=77

I will keep it in mind when I work on the console in the future.

> Another thing, that has given me challlenges and problems:
> MathPiper and/or the Latex tool often changes ("simplifies") the
> formulae in ways that
> I don't want.
> I have had great difficulty outputting  (a/b) * (c/d)   as two
> fractions multiplied by each other
> Or getting   a*2  rather than 2*a
> ( In both cases: most often with some expressions substituted as a, b,
> c, d  ..)

> And I have not succeeded in getting e.g.     (a-b) + (c-d)  as an


> output.
> (For explanation purposes)
> And it gives difficulty, when students have to determine the "Type" of
> an output expression:
> Example:
> In> (a-b)+(c-d)
> Result: a-b+c-d
> In> Type(%)
> Result: "+"
>
> In> a-b+c-d
> Result: a-b+c-d
> In> Type(%)
> Result: "-"
>
> Is there a way to minimize the simplifying, so that only substitutions
> (evaluation of assigned variables) are done? I have tried with "Hold",

> but with no success.

Included below is a function I just created called EvalBound which is
a first step towards solving your problem. If you would, play with it
a bit and then let me know what improvements I need to make to it.

Ted

%mathpiper

EvalBound(expression):=
[
Local(boundVariables);

boundVariables := VarList(expression, "IsBound");

ForEach(boundVariable, boundVariables)
[

expression := Subst(boundVariable, Eval(boundVariable)) expression;

];

expression;

];

%/mathpiper

%output,preserve="false"
Result: True
. %/output

%mathpiper

a := 1/5;
b := 2;
c := 3;
d := 4;

EvalBound(Hold((a-b) * (c-d)));

%/mathpiper

%output,preserve="false"
Result: (1/5-2)*(3-4)
. %/output

Reply all
Reply to author
Forward
0 new messages