Question: Something is undefined but so what? 
Author Message
 Question: Something is undefined but so what?

I've written an html document with my question explained at length.  I dont
know if it works to post this as an attachment.  If it didnt get through
somebody please tell me. >>>My box did and now theyre backwards.

I should start by saying that I dont know much about languages.  Maybe I
should be looking for a language called something other than 'functional'

In a nutshell, Im looking for a language that doesnt automatically barf at
something being undefined.  The reason I want this is that it seems to me
that if declared but undefined functions are just pushed through the symbol
manipulator in the vain hope that they might eventually get a value, such
functions provide a lovely way of handling dimensions and units.  If dollar
was an undefined function, 2 * dollar should be 2 * dollar, and not 'ugh!'
The attachment explains this better.

I cant believe nobody has thought along these lines before.  Maybe if the
idea is persued further it runs aground, or maybe theres a pile of source
code sitting waiting for me somewhere.

Any ideas?



Wed, 08 Aug 2001 03:00:00 GMT  
 Question: Something is undefined but so what?
I've written an html document with my question explained at length.  I dont
know if it works to post this as an attachment.  If it didnt get through
somebody please tell me.

<<< My box did and now theyre backwards.

I should start by saying that I dont know much about languages.  Maybe I
should be looking for a language called something other than 'functional'

In a nutshell, Im looking for a language that doesnt automatically barf at
something being undefined.  The reason I want this is that it seems to me
that if declared but undefined functions are just pushed through the symbol
manipulator in the vain hope that they might eventually get a value, such
functions provide a lovely way of handling dimensions and units.  If dollar
was an undefined function, 2 * dollar should be 2 * dollar, and not 'ugh!'
The attachment explains this better.

I cant believe nobody has thought along these lines before.  Maybe if the
idea is persued further it runs aground, or maybe theres a pile of source
code sitting waiting for me somewhere.

Any ideas?



Wed, 08 Aug 2001 03:00:00 GMT  
 Question: Something is undefined but so what?

Quote:

> I've written an html document with my question explained at length.  I dont
> know if it works to post this as an attachment.  If it didnt get through
> somebody please tell me. >>>My box did and now theyre backwards.

> I should start by saying that I dont know much about languages.  Maybe I
> should be looking for a language called something other than 'functional'

> In a nutshell, Im looking for a language that doesnt automatically barf at
> something being undefined.  The reason I want this is that it seems to me
> that if declared but undefined functions are just pushed through the symbol
> manipulator in the vain hope that they might eventually get a value, such
> functions provide a lovely way of handling dimensions and units.  If dollar
> was an undefined function, 2 * dollar should be 2 * dollar, and not 'ugh!'
> The attachment explains this better.

> I cant believe nobody has thought along these lines before.  Maybe if the
> idea is persued further it runs aground, or maybe theres a pile of source
> code sitting waiting for me somewhere.

> Any ideas?

Where's the promised HTML attachment?  Your explanation of what you
want is somewhat unclear, but am I right in understanding that you
want to be able to perform symbolic math?  That is, you'd like to be
able to write "x*x" and get back "x^2" instead of an error message
saying "x" is undefined.  If that's what you're looking for, there are
plenty of languages which do just that.  Just do a search on the web
for "symbolic math" software packages and programming languages.

The most popular one is probably Mathematica.  Some other symbolic
math languages I can think of are Maple, MuPAD, Scilab, and Matlab if
you buy the symbolic math package for it.  MuPAD and Scilab are free
for Linux and other Unix's.  Mathematica and Maple are commercial.
All of these can even do calculus.  For instance you can ask it to
solve "Der[x^2]" and it returns "2 x".

Is this what you were asking about?

--
Adam P. Jenkins



Wed, 08 Aug 2001 03:00:00 GMT  
 Question: Something is undefined but so what?
Adrian May schrieb:

Quote:
> I've written an html document with my question explained at length.  I dont
> know if it works to post this as an attachment.  If it didnt get through

I hoped it didn't, but my newsreader says there is a
203-line-beast from you, so it might have happened.
Please be informed that posting anything but plain text is
considered bad style on Usenet and usually induces flames.

Quote:
> manipulator in the vain hope that they might eventually get a value, such
> functions provide a lovely way of handling dimensions and units.  If dollar
> was an undefined function, 2 * dollar should be 2 * dollar, and not 'ugh!'
> The attachment explains this better.

In the meantime I looked at it - it mostly contains <FONT> tags,
making it looking ugly. Are you sure that it was impossible to
write this as text?

I guess what you need is a computer algebra system (you might look
into the newsgroup sci.math.symbolic for more informations).
Maybe they even have a FAQ or maintain a list of available systems.
You might look for MuPaD (free for education), Maple, Mathematica
(both cheap for education and expensive otherwise), and maybe lots
of smaller systems.

OTOH, if you know in advance that your values are products of
pure numbers and units, you might use a datatype specialized
for that, select one unit (e.g. pound) as the default and make all
other units constants of that datatype. This gives the same
effect, but keeps your program typesafe (i.e. it will barf if
you try to add an amount of money to an area, but it will allow
you to add areas in m^2 and squared inches).

Ralf



Thu, 09 Aug 2001 03:00:00 GMT  
 Question: Something is undefined but so what?

Quote:

> I've written an html document with my question explained at length.  I dont
> know if it works to post this as an attachment.  If it didnt get through
> somebody please tell me. >>>My box did and now theyre backwards.

> I should start by saying that I dont know much about languages.  Maybe I
> should be looking for a language called something other than 'functional'

> In a nutshell, Im looking for a language that doesnt automatically barf at
> something being undefined.  The reason I want this is that it seems to me
> that if declared but undefined functions are just pushed through the symbol
> manipulator in the vain hope that they might eventually get a value, such
> functions provide a lovely way of handling dimensions and units.  If dollar
> was an undefined function, 2 * dollar should be 2 * dollar, and not 'ugh!'
> The attachment explains this better.

> I cant believe nobody has thought along these lines before.  Maybe if the
> idea is persued further it runs aground, or maybe theres a pile of source
> code sitting waiting for me somewhere.

> Any ideas?

Aubrey Jaffer has written and assembled a delightful library of Scheme
procedures called "SLIB".  His home page is:

http://swissnet.ai.mit.edu/~jaffer/index.html

And the SLIB page is:

http://swissnet.ai.mit.edu/~jaffer/SLIB.html

One of the modules of SLIB is the commutative ring module.  Here is a
quote from the SLIB manual on this module:

<blockquote>

   Scheme provides a consistent and capable set of numeric functions.
   Inexacts implement a field; integers a commutative ring (and Euclidean
   domain). This package allows the user to use basic Scheme numeric
   functions with symbols and non-numeric elements of commutative rings.

   (require 'commutative-ring)

   The commutative-ring package makes +, -, *, /, and ^ careful in the
   sense that any non-numeric arguments which it cannot reduce appear in
   the expression output. In order to see what working with this package
   is like, self-set all the single letter identifiers (to their
   corresponding symbols).

(define a 'a)
...
(define z 'z)

   Or just (require 'self-set). Now for some sample expressions:

(* (+ a b) (+ a b)) => (+ (* 2 a b) (^ a 2) (^ b 2))
(* (+ a b) (- a b)) => (- (^ a 2) (^ b 2))
(* (- a b) (- a b)) => (- (+ (^ a 2) (^ b 2)) (* 2 a b))
(* (- a b) (+ a b)) => (- (^ a 2) (^ b 2))
(/ (+ a b) (+ c d)) => (+ (/ a (+ c d)) (/ b (+ c d)))
(/ (+ a b) (- c d)) => (+ (/ a (- c d)) (/ b (- c d)))
(/ (- a b) (- c d)) => (- (/ a (- c d)) (/ b (- c d)))
(/ (- a b) (+ c d)) => (- (/ a (+ c d)) (/ b (+ c d)))
(^ (+ a b) 3) => (+ (* 3 a (^ b 2)) (* 3 b (^ a 2)) (^ a 3) (^ b 3))  
(^ (+ a 2) 3) => (+ 8 (* a 12) (* (^ a 2) 6) (^ a 3))

   Use of this package is not restricted to simple arithmetic  
   expressions:

(require 'determinant)

(determinant '((a b c) (d e f) (g h i))) =>
(- (+ (* a e i) (* b f g) (* c d h)) (* a f h) (* b d i) (* c e g))

   The commutative-ring package differs from other extension mechanisms
   in that it automatically, using properties true of all commutative
   rings, simplifies sum and product expressions containing non-numeric
   elements. One need only specify behavior for + or * for cases where
   expressions involving objects reduce to numbers or to expressions
   involving different non-numeric elements.

   Currently, only +, -, *, /, and ^ support non-numeric elements.
   Expressions with - are converted to equivalent expressions without -,
   so behavior for - is not defined separately. / expressions are handled
   similarly.

   This list might be extended to include quotient, modulo, remainder,
   lcm, and gcd; but these work only for the more restrictive Euclidean
   (Unique Factorization) Domain.

</blockquote>

I use SLIB mainly with SCM, Jaffer's solid and fast Scheme implementation,
but most of SLIB works with most Scheme implementations.

onr



Thu, 09 Aug 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Something new undefined method

2. Am i missing something with CW5Pe?

3. Am I missing something here?

4. Am I missing something here?

5. Clarion 4 Scroll Bars - Am I Missing Something

6. Am I missing something in forth!

7. Haskell: am I missing something?

8. Am I doing something silly?

9. GNAT.Regexp: Am I missing something?

10. Am I missing something?

11. re bug, or am I missing something?

12. itk::Toplevel and -menu - am I missing something

 

 
Powered by phpBB® Forum Software