On 11/26/2011 10:34 PM, Stavros Macrakis wrote:
>> If there was a way to write "nr(2.0)" to mean "nr,x=2.0" I would be happy.
>
> The syntax "nr,x=2.0" is another feature (the "ev" function) that I would
> discourage you from using. The simple cases work fine, but they don't
> generalize nicely when you start programming.
:-(
> That's one way of looking at it. Another way is to realize that every tool
> has idiosyncracies and you may want to learn to use the tool effectively,
> which means that you don't necessarily do things in ways that come
> naturally to you at first.
>
> I'm not saying that all these idiosyncracies are intellectually defensible,
> just that that is what they are for now. But many idiosyncracies respond
> to concerns that you may not be aware of or interested in.
Ok. Fair enough.
> For example,
> you seem to want to use Maxima as a desk calculator. But many users of
> Maxima like to use it as programming language, where the functions they
> define are not functions mapping numbers to numbers (as in your examples),
> but functions over *expressions* (mapping expressions to expressions or
> mapping expressions to numbers).
Yes, I basically want a desk calculator to do calculus and algebraic
work that would take too long to do with a pencil.
My work is done in Fortran 2008. I am interested in astrophysical
simulations. Last week I wanted to make a polynomial approximation for a
stellar model and I needed it to have certain smoothness properties. My
first couple of tries were with a pencil, but I realized I could explore
more ideas if I used a CAS like Maxima.
I probably won't use a CAS very often, but this week proved to me that I
should know how to use at least one.
I modified your idea in your previous post. You'll probably consider
this an abomination, but I kind of like the syntax:
infix("->", 20, 20);
"->"(a,b) := define( ev(a), b );
f(x) -> x^5 + x^2 - 1;
df(x) -> diff(f(x),x);
nr(x) -> 1 - f(x)/df(x);
Is it possible to add the first two lines to a startup script or
something so I always have this? Btw, can explain to me why what I'm
doing is wrong? At first sight it looks innocent enough.
Cheers,
Daniel.
--
I'm not overweight, I'm undertall.