Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Maxima's diff in function definition?

I want to use a function's derivative in an other function. How should this be done in Maxima?

E.g:

f(x) := 2*x^4;
g(x) := diff(f(x),x)-8;

Now g(x) yields 8x^3-8 as expected, but g(0) gives an error, since diff(f(0),0) doesn't make sense. But then how should I properly define g?

like image 617
shinjin Avatar asked Dec 12 '11 04:12

shinjin


People also ask

How to define function in Maxima?

To define a function in Maxima you use the := operator. E.g. would return a list with 1 added to each term. f(x) := (expr1, expr2, ...., exprn);


1 Answers

Note that quote-quote is only understood when the code is parsed. That's OK if you only work in the interpreter but if you put stuff into scripts, it is possible to have unintended effects.

Another way to do this. It works the same in the interpreter and in a script.

define (g(x), diff (f(x), x) - 8);

See 'define'.

like image 147
Robert Dodier Avatar answered Sep 17 '22 12:09

Robert Dodier