Post Reply 
How to get all solutions to e^x=1
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 


Messages In This Thread
How to get all solutions to e^x=1 - townba - 09-12-2024, 04:08 AM
RE: How to get all solutions to e^x=1 - townba - 09-16-2024 04:34 AM



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