Menu

#2796 ode2 with n declared constant

None
closed
5
2022-10-10
2014-08-07
No
(%i1) declare(n,constant)$

(%i2) ode2('diff(f,x)=f,f,x);
define: in definition of integfactor, found bad argument n
#0: ode2(?_l=['diff(f,x,1) = f,f,x])(ode2.mac line 100)
 -- an error. To debug this try: debugmode(true);

(%i3) build_info();
(%o3) build_info(version="5.33.0",timestamp="2014-04-04 08:28:01",host="i686-pc-mingw32",lisp_name="GNU Common Lisp (GCL)",lisp_version="GCL 2.6.10")

Discussion

  • bigfooted

    bigfooted - 2014-12-19

    this is due to a name clash between the user-declared 'n' and the 'n' in the function definition of integfactor at line 100:

    integfactor(m,n):=...

    The simplest solution is to rename internal variables in the function definition using e.g. _m,_n, etc to avoid name clashing, or to declare m,n local

     

    Last edit: bigfooted 2014-12-22
  • David Billinghurst

    • assigned_to: David Billinghurst
     
  • David Billinghurst

    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 2022-10-10
    • labels: --> scope, declarations, functions
     
  • Robert Dodier

    Robert Dodier - 2022-10-10

    I think this is a bug that is fixed by lexical symbols. Stay tuned.

     
  • Robert Dodier

    Robert Dodier - 2022-10-10

    Turns out this bug is also fixed by allowing user-declared constants to be formal arguments for functions (and only disallowing system constants such as inf, minf, %pi, etc). See commit 0517895 and bug #3403.

    I'll revert 9a469 since the local declarations are no longer needed due to 05178.

     
  • Robert Dodier

    Robert Dodier - 2022-10-10
    • labels: scope, declarations, functions --> declarations, functions
     

Log in to post a comment.