Post Reply 
How to get all solutions to e^x=1
09-12-2024, 04:08 AM
Post: #1
How to get all solutions to e^x=1
I'm having trouble trying to find how to get the Prime to fully solve e^x=1. Complex is on, Principal is off.

When I try solve(sin(x)=0), I get {n_0*π}, which I expect. However, when I try solve(e^x=1), I get {0} instead of something like {2*i*n_0*π}. (For comparison, the HP 50g solves e^x as 2·i·π·n1.)

Is there a different function I should use?
Find all posts by this user
Quote this message in a reply
09-16-2024, 04:34 AM
Post: #2
RE: How to get all solutions to e^x=1
I downloaded the source code for Giac and took a look. Looks like the n_0 approach is only used for trigonometric functions, so I'm not sure this is possible without a change to the CAS.

I hacked in a solution in solve.cc:

Code:

  static gen isolate_exp(const gen & e,int isolate_mode,GIAC_CONTEXT){
    if (isolate_mode &1) {
      if (isolate_mode &2){
        identificateur x(string("n_")+print_intvar_counter(contextptr));
        return ln(e,contextptr)+(x)*one_tour(contextptr)*cst_i;
      }
      else {
        return ln(e,contextptr);
      }
    }
    …

It works, though its output can be unwieldy for non-simplistic cases. (I suppose this could be true of the trig functions as well.)
  • solve(e^x=1) gives list[2*i*n_0*pi], which is what I was hoping to get.
  • sol := solve(e^(x^2)=1) gives a very long answer containing things like im(n_0) and re(n_0).
  • simplify(subst(sol, [im(n_0)=0, re(n_0)=n_1])) gives list[(1+i)*sqrt(-n_1*pi),(-1-i)*sqrt(-n_1*pi)], which is correct (-n_1 could be simplified as well). (I was a bit surprised that that particular subst approach works, but Giac/Xcas is awesome.)

I think this could be a nice approach, though this behavior change could be surprising. It might need a separate configuration setting and other work for it to be generally acceptable.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)