Subst, Hold, equality, JavaScript etc.

35 views
Skip to first unread message

frans.morville

unread,
Aug 3, 2011, 10:58:08 AM8/3/11
to mathpiper-user
In continuation of an old post:

Ted wrote (18.10.2010)
Last post in
http://groups.google.com/group/mathpiper-user/browse_thread/thread/4c24513e63ef2436

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

The technique of combining "Subst" and "Hold" has helped me a lot,
now that I have dived ito it.
Without "Eval" and BoundVariables it can be used also for local
variables.

The only things I can't make MathPiper write are unnecessary
parentheses,
like in a + (b-c) , a*(b*c) etc.

I have worked with MathPiper since last year. The syntax for pattern
matching
and the nice Latex rendering of answers makes the program very well
suited for creating excercises for the students in algebraic
manipulations,
brackets etc.

In the beginning it was hard to understand what "equals" means to
MathPiper,
important when creating rule based algorithms, using pattern matching
( 100 # transform(a_IsNumber*_b) <-- ...) etc.

Only now I fully understand things like these:

In> 6/3=2
Result: True

In> x:=2*a*b
Result: 2*a*b

In> y:=Simplify(x)
Result: 2*a*b

In> y=x
Result: False
---------------
In> y=2*a*b
Result: False

In> y=2*(a*b)
Result: True

In> x=(2*a)*b
Result: True
- - -
In>IsNumber(5/10)
Result: False

In> IsNumber(10/5)
Result: True
--------------

I read in the developers forum, that a version of MathPiper has been
made based on JavaScript.
This sounds interesting, does it mean that one will be able to make a
web page (e.g. with algebraic exercises) created and corrected by a
MathPiper engine, without the students having to to install the
MathPiperIDE program?
If yes, can the latex rendering also be used on the web page?

Frans Morville

Ted Kosan

unread,
Aug 3, 2011, 7:48:32 PM8/3/11
to mathpip...@googlegroups.com
Frans wrote:

> The only things I can't make MathPiper write are unnecessary
> parentheses,
> like in   a + (b-c)   ,  a*(b*c)  etc.

What do you think about the idea of a new function called Format which
will allow the format of an expression to be configured using options?
Here is an example with an option called "brackets" being set to
True:

In> Format(a + (b-c), brackets -> True)
Result: a + (b-c)

If you like this idea, what other options for Format do you think
would be useful?

> I have worked with MathPiper since last year. The syntax for pattern
> matching
> and the nice Latex rendering of answers makes the program  very well

> suited for creating exercises for the students in algebraic


> manipulations,
> brackets etc.
>
> In the beginning it was hard to understand what "equals" means to
> MathPiper,
> important when creating rule based algorithms, using pattern matching
> ( 100 # transform(a_IsNumber*_b)  <--    ...)  etc.
>
> Only now I fully understand things like these:
>
> In> 6/3=2
> Result: True
>
> In> x:=2*a*b
> Result: 2*a*b
>
> In> y:=Simplify(x)
> Result: 2*a*b
>
> In> y=x
> Result: False

The = operator is designed to work quickly, so expressions that are
not stored identically in memory are not considered to be equal. The
ViewList function can be used to see how an expression is stored in
memory and it this case it shows that the expression that is bound to
x is stored differently than the expression that is bound to y:

In> ViewList(x)
Result: <A graphical representation of the expression is shown.>

In> ViewList(y)
Result: <A graphical representation of the expression is shown.>

To determine if two expressions are equally mathematically, one
expression is subtracted from the other and the result is simplified:

In> x:=2*a*b
Result: 2*a*b

In> y:=Simplify(x)
Result: 2*a*b

In> Simplify(x-y)
Result: 0

> In>IsNumber(5/10)
> Result: False
>
> In> IsNumber(10/5)
> Result: True

At some point in time it may be a good idea to adjust the meaning or
names of functions like IsNumber, IsRational, etc. to better match
people's expectations of how they should work.

> I read in the developers forum, that a version of MathPiper has been
> made based on JavaScript.
> This sounds interesting, does it mean that one will be able to make a
> web page (e.g. with algebraic exercises) created and corrected by a
> MathPiper engine, without the students having to to install the
> MathPiperIDE program?
> If yes, can the latex rendering also be used on the web page?

Yes, the JavaScript version of MathPiper we are working on will run in
a browser without needing to install MathPiperIDE. Also, web pages
will be able to be made with it that contain exercises which can be
used similarly to what you describe here.


By the way, the developer and user email lists don't currently reflect
the amount of work that is being done on MathPiper. If anyone is
interested in following the day-to-day changes that are being done to
MathPiper, they can be found here:

http://code.google.com/p/mathpiper/source/list

Ted

Ted Kosan

unread,
Aug 4, 2011, 8:33:36 AM8/4/11
to mathpip...@googlegroups.com
Frans wrote:

> If yes, can the latex rendering also be used on the web page?

Yes, the goal is to be able to render latex on a web page.

Ted

Reply all
Reply to author
Forward
0 new messages