Search code examples
trigonometrysymbolic-mathmaxima

Solving equations with maxima


I can solve the equation bellow normally

sin(b1*(x-c1)) = sin(b2*(x-c2))
b1*(x-c1)      =  b2*(x-c2)
c2             = x-(b1*(x-c1))/b2

for c1 = 0, b1 = 1, b2 = 1.5, x = pi/2

c2 = (x-(b1*(x-c1))/b2) = 0.523598775598299

But when I try and do this in Maxima see below the answer is completely different what am I doing incorrectly?

kill(all)$
numer:true$
phase1:0; freq1:1; freq2:1.5; x:pi/2; solve(sin(freq1*(x-phase1))=sin(freq2*(x-phase2)),phase2);

Answer I get below Answer I get


Solution

  • solve usually works only for simple equations, try Solver.

    Also, pi (variable) is not the same as %pi (constant).

    kill(all)$
    load(solver)$
    numer:true;
    f:sin(freq2*(x-phase2))=sin(freq1*(x-phase1));
    phase1:0; freq1:1; freq2:1.5; x:%pi/2; a:Solver([f],[phase2]);
    rhs(a[1][1]),numer;
    

    Answer: 0.5235987755982978

    Your second question:

    kill(all);
    f:sin(b1*(x-c1)) - sin(b2*(x-c2))=0;
    triginverses:all;
    solve(f,c2);