Ticket #4498 (new enhancement)

Opened 2 months ago

Last modified 2 months ago

Implement a symbolic version of the arg function; the current one is only for actual numbers

Reported by: TimothyClemans Assigned to: somebody
Priority: major Milestone: sage-wishlist
Component: basic arithmetic Keywords:
Cc:

Description (Last modified by was)

It would be nice if there were a symbolic arg function, just like the symbolic sin, cos, etc., functions. Then the following would happen:

sage: f = arg(x); f
arg(x)
sage: f.subs(x=1+I)
arg(1+I)

Now we have

sage: arg(1+I)
0.785398163397
sage: type(arg(1+I))
<type 'sage.rings.real_double.RealDoubleElement'>

I.e., the arg in Sage is currently the numerical person's arg, not the symbolic person's. It just casts to CDF.

"The function should return the argument of a complex function." - Ronan Paixão

Change History

11/11/2008 03:24:52 PM changed by TimothyClemans

arg(x)
///

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/ronan/.sage/sage_notebook/worksheets/admin/0/code/127.py",
line 6, in <module>
   exec compile(ur'arg(x)' + '\n', '', 'single')
 File
"/home/ronan/progs/sage/local/lib/python2.5/site-packages/ZODB3-3.7.0-py2.5-linux-i686.egg/", line 1, in <module>

 File
"/home/ronan/progs/sage/local/lib/python2.5/site-packages/sage/misc/functional.py", line 67, in arg
   except AttributeError: return CDF(x).arg()
 File "complex_double.pyx", line 286, in
sage.rings.complex_double.ComplexDoubleField_class.__call__
(sage/rings/complex_double.c:3324)
 File
"/home/ronan/progs/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1454, in _complex_double_
   raise TypeError
TypeError

11/12/2008 06:16:18 AM changed by mabshoff

Please post a complete session. As is the above is not very clear.

Cheers,

Michael

11/12/2008 09:13:16 AM changed by was

  • summary changed from The argument function does not work with variables. to Implement a symbolic version of the arg function; the current one is only for actual numbers.
  • type changed from defect to enhancement.
  • description changed.
  • milestone changed from sage-3.2.1 to sage-wishlist.

11/15/2008 09:17:03 AM changed by ronanpaixao

Is this really an enchancement? As it is, just using arg(x) already raises an error and everything that needs arg() must be implemented numerically.

11/16/2008 11:42:06 AM changed by was

Is this really an enchancement? As it is, just using arg(x) already raises an error and everything that needs arg() must be implemented numerically.

Yes, this is an enhancement since it is implementing new functionality. It would be a bug fix if there were a bug in the existing arg function, where it produced invalid results on supported input.

-- William