On 2012-11-26, =?utf-8?Q?foelsche at sbcglobal.net?= <foelsche at sbcglobal.net> wrote:
> see attached diode.txt.
> Too few arguments supplied to rest(t,i1,v1,v2,v2t,omega); found: [[2,t]]
I found a few problems.
(1) there is already a built-in function named 'rest', and Maxima has
gotten them confused. Rename your function 'rest' to something else.
(2) you defined a function named 'V' but referred to it as 'v'. Symbols
are case-sensitive, so those are 2 different names. You'll need to make
them both 'V' or both 'v'.
(3) the definition of dintd1 looks like dintd1(...):diff(...) -- I guess
you probably mean dintd1(...):=diff(...). Same with dintd1d1.
I see also that you apparently had charge_current as a function, then
changed it to a variable -- it needs to be a function too.
(4) dintd1 differentiates with respect to a1, but you put a1=0 in
ev(dintd1(...), ...). Same with ev(dintd1d1(...), ...). So diff
complains that its argument is not a symbol (since it is 0).
charge_current has the same problem.
I guess what you mean is to evaluate the derivative at a point. A
construct for that in Maxima is at(diff(f(u), u), u=u0) where u0 is the
point at which to evaluate. For example, I changed charge_current to
this:
charge_current (v2, v2t) := at (diff (charge (%v2), %v2), %v2=v2) * v2t $
so %v2 acts a dummy variable for differentiation.
(5) in dintd1d1 you have diff(..., a1, a1) but the third argument is the
degree of the derivative. I am guessing you mean diff(..., a1, 2) (i.e.
second derivative).
With these changes, I get 0 for dintd1 and 1/50000000 for dintd1d1.
A note about style: Maxima prefers exact numbers (integers, rationals,
and symbolic constants) to inexact (floating point numbers). Also, it
might be easier to debug your program if you compute stuff one step at a
time, so that you can inspect partial results.
Hope this helps. I like to claim that Maxima is a useful program for
practical problems, so when such problems appear on the mailing list, I
am anxious to solve them ....
best,
Robert Dodier