[comp.sources.wanted] Equation solver

tony4@stretch.cs.mun.ca (Anthony H. Galway) (08/07/90)

I am in need of a program that will allow a student to enter an equation
in the form 

	>  b = 5
	>  s = 90 
	>  w = 12
	>  x = b^2 + (s^3/w)

The program needs to be able to do all basic math functions.

	* / - + sin() cos() tan() atan() acos() asin() log() sqrt() etc...

I am about to write the program, but if there is one already floating
around I will be grateful for a copy, or a pointer to it. 

The program is to be used as a teaching aid for one of our engineering
courses. I will specialize it to fit the specifications of the course.

Thanks in advance.

-- 
                            Tony Galway 
Department of Enginneering                Memorial University of Newfoundland
tony4@stretch.cs.mun.ca||tony4@stretch.mun.edu||uunet!stretch.cs.mun.ca!tony4
Save the whales .............................. we'll need them for food later.

ts@uwasa.fi (Timo Salmi LASK) (08/08/90)

In article <1990Aug6.184606.4634@stretch.cs.mun.ca> tony4@stretch.cs.mun.ca (Anthony H. Galway) writes:
>I am in need of a program that will allow a student to enter an equation
>in the form 
>
>	>  b = 5
>	>  s = 90 
>	>  w = 12
>	>  x = b^2 + (s^3/w)
>
>The program needs to be able to do all basic math functions.
>	* / - + sin() cos() tan() atan() acos() asin() log() sqrt() etc...
... rest deleted ...

For equations of *one* variable in the said for you might be
interested in the following package available by anonymous ftp from
chyde.uwasa.fi, Vaasa, Finland, 128.214.12.3.  (No source code). 

TSNUM12.ARC     Numerical Analysis by Timo Salmi
Filename        Comment                             Date      Time    CRC
--------        --------------------------------    ----      ----    ---
BISE.EXE        Solves f(x)=0, Bisection Method   11-03-88  21:01:26  2E56
EQ2.EXE         Solve linear equations of 2 vars  11-02-88  23:28:46  560A
IC.EXE          Line's intercepts with the axes   11-03-88  21:04:08  0BE4
LINE.EXE        Equation of line thru two points  11-03-88  21:07:20  7C87
POLYR.EXE       All roots of a polynomial         01-14-89  00:15:58  F24D
SECA.EXE        Solves f(x)=0, Secant Method      11-03-88  21:08:40  9A86
SINTEG.EXE      Integrates f(x), Simpson's rule   11-03-88  21:11:20  04B4
TSNUM.INF       Document                          06-01-89  12:45:08  683F
TSPROG.INF      List of PD programs from T.Salmi  05-28-89  13:10:24  F9AA
----            ------             ------  -----
0009            147682             102799   31%

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

rab@ariel.its.unimelb.edu.au (Richard Alan Brown) (08/08/90)

In article <1990Aug6.184606.4634@stretch.cs.mun.ca> tony4@stretch.cs.mun.ca (Anthony H. Galway) writes:
>I am in need of a program that will allow a student to enter an equation
>in the form 
>
>	>  b = 5
>	>  s = 90 
>	>  w = 12
>	>  x = b^2 + (s^3/w)
>
>The program needs to be able to do all basic math functions.

In Kernighan and Pike's book `The Unix Operating System', they develop a
sophisticated calculator program called 'hoc4'. The back of the book has a full
source code listing. I suspect many people have typed this code in by hand, so
it may be available near you. If you can't find it locally, one of my colleagues
here at Melbourne has typed it in, *and* fixed a few bugs in he code (sloppy
mixing of pointer types, &c.), so i could post it if you like.

--

Richard Brown                     | E-mail: pbrown@munda.ph.unimelb.EDU.AU
School of Physics                 | Phone : +61 3 344 5081
University of Melbourne           | Fax   : +61 3 347 4783
Parkville Victoria AUSTRALIA 3052 | Telex : AA35185

peter@ontmoh.UUCP (Peter Renzland) (08/08/90)

From article <1990Aug7.183727.16237@uwasa.fi>, by ts@uwasa.fi (Timo Salmi LASK):
> In article <1990Aug6.184606.4634@stretch.cs.mun.ca> tony4@stretch.cs.mun.ca (Anthony H. Galway) writes:
>>I am in need of a program that will allow a student to enter an equation
>>in the form 
>>
>>	>  b = 5
>>	>  s = 90 
>>	>  w = 12
>>	>  x = b^2 + (s^3/w)
>>
>>The program needs to be able to do all basic math functions.
>>	* / - + sin() cos() tan() atan() acos() asin() log() sqrt() etc...
> ... rest deleted ...

If you have a Unix system, it's easy -- just use the "bc" calculator.
If you feed it the above example and then say "w", it will say "60775".

psm@manta.NOSC.MIL (Scot Mcintosh) (08/09/90)

In article <199@ariel.its.unimelb.edu.au> rab@ariel.its.unimelb.edu.au (Richard Alan Brown) writes:
>In Kernighan and Pike's book `The Unix Operating System', they develop a
>sophisticated calculator program called 'hoc4'.

I think Mr. Brown means 'The Unix Programming Environment' by Kernighan
and Pike.

duty@ariel.its.unimelb.edu.au (Duty Programmer) (08/15/90)

In article <1177@manta.NOSC.MIL> psm@manta.nosc.mil.UUCP (Scot Mcintosh) writes:
>In article <199@ariel.its.unimelb.edu.au> rab@ariel.its.unimelb.edu.au (Richard Alan Brown) writes:
>>In Kernighan and Pike's book `The Unix Operating System', they develop a
>>sophisticated calculator program called 'hoc4'.
>
>I think Mr. Brown means 'The Unix Programming Environment' by Kernighan
>and Pike.

Oops! You are absolutely correct.

While I'm here, I should mention for the benefit of those who have
written to me requesting the source code, that for various reasons it
is not immediately available, but should be so in a week or
thereabouts: be patient!

Also, it seems that I have quite a few requests for this code, which
makes me inclined to submit the source code to comp.sources.misc.
However, since the code is published in the above-mentioned book, does
that make the _source_code_ copyright? Can I post the source without
infringing the copyright?

rab
---
Richard Brown                     | E-mail: rab@ariel.its.unimelb.EDU.AU
School of Physics                 | Phone : +61 3 344 5081
University of Melbourne           | Fax   : +61 3 347 4783
Parkville Victoria AUSTRALIA 3052 | Telex : AA35185