From: Stavros M. <mac...@gm...> - 2024-04-09 17:56:12
|
You changed the problem. It works fine if you set *f: x+%i*y*. What output would you like to see? On Tue, Apr 9, 2024 at 1:26 PM <fi...@ig...> wrote: > Dear Stavros, > > On 2024-04-09 11:50, Stavros Macrakis wrote: > > 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*: > > Thank you for this advice. > > > 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 ) > > unfortunately cabs(f) only works if f can be disassembled into real > and imaginary part. If we only know, that f is complex, we get: > > declare(f, complex, t, real); /* to be as clear as possible */ > done > depends(f, t); > [f(t)] > diff(cabs(f), t); > df > f -- > dt > ------ > abs(f) > > > This in general is not correct, or am I wrong? The result is the same > using abs(f). > > > Best regards > > > Torsten > > > > > > 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 > > > > > -- > ------------------------------------------------------------------------ > Torsten Finke > fi...@ig... > ------------------------------------------------------------------------ > |