YACAS Free Algebra System, Installing on Windows, and making HELP work.

D

D F

I found YACAS recently, and recommend it for Math/Science Teachers,
Algebra Students, curious on-lookers, Calculator Collectors,
Carpenters, and Physics Professors with nothing else to do at the
moment. :)

YACAS means "Yet Another Computer Algebra System" and it can
maniuplate algebraic expressions to produce symbolic results. For
example, if you enter Simplify((x-2)*(x+3)*(x+5)) you get:
x^3+6*x^2-x-30. Because it works at the symbolic level, it can also
manipulate ugly fractional math problems... When you enter 2/13+2/17,
you get 60/221.

YACAS is hosted at Sourceforge:

(This is the set of files I used...)
Win32 Download: http://www.xs4all.nl/~apinkus/backups/YacasWindowsBinary-1.0.54.zip
Documentation: http://yacas.sourceforge.net/backups/manual.html.tar.gz

(Other useful links...)
Sourceforge Summary: http://sourceforge.net/projects/yacas/
Sourceforge Files: http://sourceforge.net/project/showfiles.php?group_id=2528

Project Home Page: http://yacas.sourceforge.net/yacas.html
Download Page: http://yacas.sourceforge.net/downloads.html

The rest of this post recounts my suggestions for installing and
getting the Help (??) to work in the Windows environment.

First, unzip the Win32 download to a directory somewhere on your
computer. For example, my installation is at C:\Apps\YACAS.

Next, create a subdirectory "documentation" in the YACAS directory
where you unzipped the Win32 download. Then unpack the Documentation
Download into that subdirectory. (You may need Win-GZ from Simtel:
http://www.simtel.net/pub/pd/63053.shtml (see
http://www.crispen.org/src/ ) if your unzip utility can't handle the
tar.gz format. (Then, or course, you might need 'untar' also: From
Simtel - http://www.simtel.net/product.php?id=10607 ). (Aside, the
'Last Free Version of PowerArchiver 2000' version 6.1.1, works fine
for this, and is listed on the PricelessWare page as
http://woundedmoon.org/win32/powerarc611.exe (See
http://www.pricelessware.org/PL2003FILEUTILITIES.htm ).

Since this version of YACAS runs in a DOS Window (Console), I
recommend creating a BATCH file to start the program. For example, my
startup Batch file (YACAS.BAT) contains these lines:

@echo off
cd c:\Apps\Yacas
yacas.exe --rootdir .\documentation

(It is important, for startup purposes, to set the install directory
as the default directory,... CD C:\Apps\Yacas... This can also be
done in the properties of a Windows Shortcut, but the choice is up to
you.)

Although not really necessary, you can create a Windows Shortcut
(possibly put in on your Desktop, or in your Starup menu). However,
you should already be able to just double-click on the Batch file, and
YACAS will start. You see the following lines in the console when it
starts properly...

True;
This is Yacas version '1.0.54'.
Yacas is Free Software--Free as in Freedom--so you can redistribute
Yacas or
modify it under certain conditions. Yacas comes with ABSOLUTELY NO
WARRANTY.
See the GNU General Public License (GPL) for the full conditions.
See http://yacas.sf.net for more information and documentation on
Yacas.

Numeric mode: "Internal"
To exit Yacas, enter Exit(); or quit or Ctrl-c. Type ?? for help.
Or type ?function for help on a function.
Type 'restart' to restart Yacas.
To see example commands, keep typing Example();
In>

Now, at this point you can start using it. However, the Help access
(??) does not yet work on Windows systems. (And, the author makes
that clear in the ReadMe File.) Here is how to fix it so it works
more like what you might expect.

Two things happen when you enter the '??' command. YACAS locates the
file ./documentation/books.html, and then tries to open it with the
LYNX browser. (You can see this using SysInternals excellent program
FileMon: http://www.sysinternals.com/ntw2k/source/filemon.shtml ). If
you happen to have the LYNX browser installed, this is fine. However,
if you don't, continue reading...

To intercept the YACAS search for a usable browser, create a Batch
File in the YACAS directory, and name it LYNX.BAT (The name is
important). The batch file only needs to have one line:

START "%1" "%1"

That's all you need for a simple help page startup... Now when YACAS
goes looking for the LYNX browser, it finds LNYX.BAT and executes it,
feeding it the string "./documentation/books.html" as the argument.
What actually happens is that the START command 'Starts' the default
application for .HTML files, which may be (say) IE6.0, Netscape, or
whatever is associated with the file in the registry.

A side comment on the command above: START works differently between
older Win9x versions and the Win2K/XP versions. Newer implemntations
have an optional first parameter which can be a Window Title, if it
happens to be a quoted string. However, older versions expect the
first parameter of START to be just the file (whose application is the
one) to launch. The 'rub' appears when you try to launch a Long File
Name on older versions, and you Quote it (correctly). It launches as
expected. However, the SAME command, given on a Newer Windows version
will interpret the first parameter as the Window Title, and NOT find a
file to launch. The trick above just repeats the argument, so both
implementations are satisfied. (This is okay for any installed
application that ignores a second argument... If it does not work
right on your system, just tweak it so it does, and don't worry about
other systems.) Win98 opens the First Argument, and is happy. Win2k
opens the second argument, and is also happy.

Happy, Happy!? ... Not so happy! The problem with this simple
solution is that it works only for the '??' command, which brings up
the 'books.html' Help Page. This can get you where you want to go,
but the author of YACAS intended that if you entered (say) '?Simplify'
you will access the help file 'ref.html' and jump right to the
bookmark '#Simplify.' The argument passed to our LYNX Fake Batch
file, in this case is actually '.\ref.html#Simplify'. This causes the
START command to fail miserably.

If you don't mind that, then you can stop now, and just use ?? to get
help, and browse to your choice of functions, or other help material
by clicking the links you need.

However, a possible solution is to write a VBScipt, LYNX_script.vbs,
which parses the argument string (such as
'documentation\ref.html#Simplify') to identify the file, determines
your Default Browser for the file, then starts that browser with the
URL that supports the jump into detailed help. This script file can
be launched from the Batch file LYNX.BAT, and is sort of a special
replacement for the START command, in this case.

It took a few hours, but it did not prove to be impossible, just a bit
'round-about.'

So, to use the Detailed Help solution, modify the file LYNX.BAT to
contain just these two lines:

@echo OFF
CSCRIPT.EXE /Nologo Lynx_script.vbs "%1"

(For Win9x versions, you must have Windows Scripting Host
installed/enabled, and I recommend that you update to version 5.6:
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
) This is already installed on Win2K and XP. If you use Win9x, the
system must be able to find cscript.exe on the system PATH. If not,
just give the full path to cscript.exe... typically
C:\WINDOWS\COMMAND\CSCRIPT.EXE.)

Then create an additional file in the YACAS directory called
'Lynx_script.vbs', which contains the lines shown below.

The script below goes to the trouble of looking up the Default Browser
from the registry, so it supports Netscape, Mozilla or others, not
just IE. It should use the browser that you get when you double-click
on .html files. (Note that this was only tested on Win2K and Win98
with IE 6.0, but should work for other combinations, or it will be
interesting to learn why, if it does not.)

So, Happy Algebra Factoring, Integrating, Simplifying, whatever.

D F

The next lines should be saved as a file Lynx_script.vbs in the YACAS
directory. (Be sure to modify the LYNX.BAT file to call this script,
and pass it %1 from the Batch file - See above.)

'- Start File 'Lynx_script.vbs' for YACAS Help Support -
' All This, just to FAKE that LYNX is available to YACAS.
' (Supports YACAS Detailed Help File Access) by starting
' the ' Default Browser' (typically for .html or .htm
' files), with the URL fixed for Bookmark support.
'
' In fact, it starts the registered application for any
' file argment, but has processing to handle the HTML
' bookmark tag arguments that may be tacked on a URL.
' ** ONLY TESTED WITH IE6.0 on Win2K, Win98 ** Good Luck!!

Dim ocArgs, WshShell
Dim fullArg, fileArg, fCommand, fExe, hTag

Set ocArgs = WScript.Arguments
fullArg = ocArgs(0) ' Retrieve the passed argument
' Set up variables for building the command later
' Look for a Bookmark Link Tag tacked on the URL
if InStr(fullArg,"#") > 0 then
fileArg = Left(fullArg,InStr(fullArg,"#")-1)
hTag = Mid(fullArg,InStr(fullArg,"#"))
else
fileArg = fullArg
hTag = ""
end if

' Look up the application path for this file
fCommand = CommandForFileName(fileArg)

' Correct the argument to specify full path
' AND reassemble command with Bookmark Tag if needed
fullArg = GettheFullPath(fileArg) & htag

if InStr(fCommand,"""%1""") > 0 then
' Build a command if it already has file quotes embedded
fExe = Replace(fCommand,"%1", fullarg)
else
' Check to make sure the command takes an argument
if InStr(fCommand,"%1") > 0 then
' Build command, adding quotes for long file names
fExe = Replace(fCommand,"%1","""" & fullarg & """" )
end if
end if

' Create the Shell object and run the command.
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run fExE

Set WshShell = Nothing
' Exit the Script at this point

''' ************ Support Functions ********* '''
Function GettheExtension(PassedFile)
' Return the File Extension, using Scripting support
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GettheExtension = fso.GetExtensionName(PassedFile)
Set fso = Nothing
End Function

Function GettheFullPath(PassedFragment)
' Fill out the full path to the file.
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GettheFullPath = fso.GetAbsolutePathName(PassedFragment)
Set fso = Nothing
End Function

Function CommandForFileName(fileName)
' Look up the OpenNew, or Open command for a passed
' file, and return it as the command string.
' Note that the user may expect %1 parameter to be
' returned as part of the string.
Dim filExt, fRegName, fOpNew
Dim wShell

' Assume the extension is included in the filename.
fileExt = "." & GettheExtension(fileArg)
' Learn how this is classified in the registry
Set wShell = WScript.CreateObject("WScript.Shell")
fRegName = ""
fOpNew = ""
on Error Resume Next
fRegName = WShell.RegRead("HKEY_CLASSES_ROOT\" & _
fileExt & "\")
if fRegName <> "" then
' Use the RegName to look up the OpenNew command
fOpNew = ""
fOpNew = WShell.RegRead("HKEY_CLASSES_ROOT\" & _
fRegName & "\shell\opennew\command" & "\")
if fOpNew = "" then ' Try the Open command
fOpNew = WShell.RegRead("HKEY_CLASSES_ROOT\" & _
fRegName & "\shell\open\command" & "\")
end if
end if
' Check that a command of some kind came through...
On Error Goto 0
if fOpNew = "" then
' A bail-out with something, and it probably
' won't work, but may be better than nothing?
CommandForFileName = "START ""%1"" ""%1"""
else
' We got a command string, at least.
CommandForFileName = fOpNew
end if
set wShell = Nothing

End Function
'-The last line of 'LYNX_script.vbs' is just before this line -

Hint: On a Win2K system, you can just eliminate LNYX.BAT and call
this scipt file LYNX.vbs, when it is place in the YACAS directory.
This does not (alas) work for Win98.
 
D

D F

(e-mail address removed) (D F) wrote...
[...] the [YACAS] Help access
(??) does not yet work on Windows systems. (And, the author makes
that clear in the ReadMe File.) Here is how to fix it so it works
more like what you might expect.
[...]
... a possible solution is to write a VBScipt, LYNX_script.vbs,
which parses the argument string ...

In the first post I neglected to explain why I opted for a more
complicated solution, when there is a much more straight forward
solution for the average user.

If all you need is a 'static' installation of YACAS on your hard
drive, (that is, you always know where it is, and you know what your
Default Browser is), then just create a batch file named LYNX.BAT in
the YACAS directory, and launch your default browser directly to
access the full 'static' URL, which you just define explicitly...

For example, this version of LYNX.BAT works fine on the static
installation...

@echo OFF
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" C:\APPS\YACAS\%1

Keep it simple!! Of course, you need to provide your own browser
path, and adjust the argument 'C:\APPS\YACAS\' to point to your
installation.

What I needed was a solution suitable for YACAS when accessed from a
CD-ROM and (for example) distributed to students, where they would
drop that CD into who-knows-what(?) computer setup, and expect it to
work. (Students can be Tough on you when it doesn't work! :) Lots
of things can change, such as the CD Drive Letter, and the Default
Browser. So, the first (complicated) solution attempts to look up
what it can from the OS Registry.

As it is, that solution depends on the VBScript host working as
advertised, but at least it has a reasonable expectation of working
for Win2K or XP systems, and might work on an uncharted Win98 system.

My advice, ... if you just install it on your Hard Drive, for your own
use, then just use the SIMPLE batch file 'LYNX.BAT' outlined above.

D F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top