From: Stavros M. <mac...@gm...> - 2024-04-09 15:50:32
|
Maxima is not very smart about the *conjugate* function. If you want to find a real expression for the absolute value of a complex expression, try *cabs*: depends([x,y],t) => [x(t), y(t)] cabs(x+%i*y) => 2 2 sqrt(y + x ) diff(%,t) => dy dx 2 y -- + 2 x -- dt dt --------------- 2 2 2 sqrt(y + x ) On Tue, Apr 9, 2024 at 11:39 AM <fi...@ig...> wrote: > Dear Maxima Users, > > I am a little confused about Maxima's understanding of the abs() function. > > Consider a complex function f = x + i y where x and y depend on some > real parameter t. What should the first derivative df/dt be? Shouldn't > it be purely real? > > (%i1) depends([x, y], t); > (%o1) [x(t), y(t)] > (%i2) f : x + %i * y; > (%o2) %i y + x > (%i3) diff(abs(f), t); > dy dx > (%i y + x) (%i -- + --) > dt dt > (%o3) ----------------------- > abs(%i y + x) > (%i4) expand(%); > dy dy dx dx > y -- %i x -- %i -- y x -- > dt dt dt dt > (%o4) (- -------------) + ------------- + ------------- + ------------- > abs(%i y + x) abs(%i y + x) abs(%i y + x) abs(%i y + x) > > > Oops! Maxima tells me, that the first derivative is not real but has > an imaginary part! > > What would be my mistake? Did I miss something in the documentation > about complex derivatives? I would like to apologize in advance. > > For my understanding the following equation for some complex number z > holds: > > abs(z) = sqrt(z conj(z)) > > right? > > So we try > > (%i5) diff(sqrt(f * conjugate(f)), t); > dy dx dx dy > (x - %i y) (%i -- + --) + (%i y + x) (-- - %i --) > dt dt dt dt > (%o5) ------------------------------------------------- > 2 sqrt((x - %i y) (%i y + x)) > (%i6) expand(%); > dy dx > y -- x -- > dt dt > (%o6) ------------- + ------------- > 2 2 2 2 > sqrt(y + x ) sqrt(y + x ) > > > The expected result; and purely real. > > BTW.: For Maxima the following is not evaluated to zero: > > (%i7) abs(f) - sqrt(f * conjugate(f)); > (%o7) abs(%i y + x) - sqrt((x - %i y) (%i y + x)) > > Why this? > > > Any advice appretiated and best regards > > > Torsten > > > > > -- > ------------------------------------------------------------------------ > Torsten Finke > fi...@ig... > ------------------------------------------------------------------------ > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |