> 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
> 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
> 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
> 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
> 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
> 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
> 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