Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: SourceForge.net <noreply@so...>  20080929 11:02:53

Bugs item #2135806, was opened at 20080929 06:02 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Barton Willis (willisbl) Assigned to: Nobody/Anonymous (nobody) Summary: noun / verb confusion for real/imag part Initial Comment: I think (%o4) should be (conjugate(z)+z)/2: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o4) realpart(z) For the sub to happen, we need to nounify: (%i5) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o5) (conjugate(z)+z)/2 For other functions (say cos), the nounify isn't needed: (%i7) subst(lambda([s], 42), 'cos, cos(x)); (%o7) 42 So, I think the nounify(realpart) shouldn't be needed in (%i5).  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 
From: SourceForge.net <noreply@so...>  20090110 23:53:05

Bugs item #2135806, was opened at 20080929 13:02 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Barton Willis (willisbl) Assigned to: Nobody/Anonymous (nobody) Summary: noun / verb confusion for real/imag part Initial Comment: I think (%o4) should be (conjugate(z)+z)/2: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o4) realpart(z) For the sub to happen, we need to nounify: (%i5) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o5) (conjugate(z)+z)/2 For other functions (say cos), the nounify isn't needed: (%i7) subst(lambda([s], 42), 'cos, cos(x)); (%o7) 42 So, I think the nounify(realpart) shouldn't be needed in (%i5).  >Comment By: Dieter Kaiser (crategus) Date: 20090111 00:53 Message: The reason for the different behavior is that the functions realpart() and imagpart() have not the property ALIAS like the functions sin() or cos(). The parser returns for the input 'realpart the symbol $realpart. For fully implemented simplifying functions the parser returns e.g. for the input cos the symbol %cos because of the property ALIAS. Unfortunately, the Lisp function risplitnoun introduces the symbols %realpart and %imagpart and realpart(z) simplifies to the expression ((%realpart) z). The function subst() does not work because of the different symbols. The call nounify(realpart) changes the verb form $realpart to the noun form %realpart and now it works again. This behavior can be changed when we do not use the symbol %realpart but change the function risplitnoun like: (defun risplitnoun (l) (cons (list '($realpart) l) (list '($imagpart) l))) A noun which is declared to be complex now gives the expression: (($REALPART SIMP) $Z) The original code does a simplify, but I think this is not possible for the whole expression (we loop endlessly) and not necessary for the argument l. We get the correct expression from the simplifier. We have to change the symbols %realpart and %imagpart at about 5 places in the whole code. The testsuite has no problems with this changes. With this change the example will work as expected: (%i25) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o25) (conjugate(z)+z)/2 Remark: With the original code and the changed code we get: 'realpart(x+%i*y); 'realpart(x+%i*y) /* intern ((%realpart) .... ) */ In this case the parser returns the symbol %realpart. Because realpart() is not a simplifying function Maxima can not further simplify this expression e.g. rectform('realpart(1)); realpart(1) So what do you think? Should we change %realpart to $realpart in risplitnoun. Perhaps later we can introduce a simplifying function realpart(). Dieter Kaiser  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 
From: SourceForge.net <noreply@so...>  20091128 23:56:03

Bugs item #2135806, was opened at 20080929 13:02 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Pending >Resolution: Wont Fix Priority: 5 Private: No Submitted By: Barton Willis (willisbl) Assigned to: Nobody/Anonymous (nobody) Summary: noun / verb confusion for real/imag part Initial Comment: I think (%o4) should be (conjugate(z)+z)/2: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o4) realpart(z) For the sub to happen, we need to nounify: (%i5) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o5) (conjugate(z)+z)/2 For other functions (say cos), the nounify isn't needed: (%i7) subst(lambda([s], 42), 'cos, cos(x)); (%o7) 42 So, I think the nounify(realpart) shouldn't be needed in (%i5).  >Comment By: Dieter Kaiser (crategus) Date: 20091129 00:56 Message: The substitution does not work as expected, because internally in Maxima the function realpart lives in two different forms: a noun form with the symbol %realpart and a verb form with the symbol $realpart. Because of this, we do not get the expected answer for the example of the bug report. The symbol 'realpart is passed with its noun form to the function subst. The verb function realpart(z) is evaluated (not simplified) to the internal noun form ((%realpart) $z). The substitution does not work, because subst distinguish the two forms: (%i1) declare(z,complex)$ (%i2) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o2) 'realpart(z) As written in the bug report a nounify helps. Again realpart(z) is evaluated to an internal noun form. Now we do not pass the verb form, but the symbol %realpart to subst: (%i3) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o3) (conjugate(z)+z)/2 We get the same result, when we prevent the evaluation of realpart(z) by quoting the function. Now only the verb form is present: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, '(realpart(z))); (%o4) (conjugate(z)+z)/2 This behavior is different from simplifing functions like sin, cos, ... These functions only have one internal representation, that is a noun form. The "noun/verb confusion" is the expected behavior and is due to the implementation of functions like realpart. Perhaps, we can improve the documentation on this topic. I had no look at the code of subst. Perhaps, it is possible to do an implementation which ignores the noun/verb scheme for symbols. We could change the implementation of the function realpart and friends or we might modify the function subst. I think both ways are feature requests. Therefore, I would like to close this bug report. Dieter Kaiser  Comment By: Dieter Kaiser (crategus) Date: 20090111 00:53 Message: The reason for the different behavior is that the functions realpart() and imagpart() have not the property ALIAS like the functions sin() or cos(). The parser returns for the input 'realpart the symbol $realpart. For fully implemented simplifying functions the parser returns e.g. for the input cos the symbol %cos because of the property ALIAS. Unfortunately, the Lisp function risplitnoun introduces the symbols %realpart and %imagpart and realpart(z) simplifies to the expression ((%realpart) z). The function subst() does not work because of the different symbols. The call nounify(realpart) changes the verb form $realpart to the noun form %realpart and now it works again. This behavior can be changed when we do not use the symbol %realpart but change the function risplitnoun like: (defun risplitnoun (l) (cons (list '($realpart) l) (list '($imagpart) l))) A noun which is declared to be complex now gives the expression: (($REALPART SIMP) $Z) The original code does a simplify, but I think this is not possible for the whole expression (we loop endlessly) and not necessary for the argument l. We get the correct expression from the simplifier. We have to change the symbols %realpart and %imagpart at about 5 places in the whole code. The testsuite has no problems with this changes. With this change the example will work as expected: (%i25) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o25) (conjugate(z)+z)/2 Remark: With the original code and the changed code we get: 'realpart(x+%i*y); 'realpart(x+%i*y) /* intern ((%realpart) .... ) */ In this case the parser returns the symbol %realpart. Because realpart() is not a simplifying function Maxima can not further simplify this expression e.g. rectform('realpart(1)); realpart(1) So what do you think? Should we change %realpart to $realpart in risplitnoun. Perhaps later we can introduce a simplifying function realpart(). Dieter Kaiser  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 
From: SourceForge.net <noreply@so...>  20091213 02:20:24

Bugs item #2135806, was opened at 20080929 11:02 Message generated for change (Comment added) made by sfrobot You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: Wont Fix Priority: 5 Private: No Submitted By: Barton Willis (willisbl) Assigned to: Nobody/Anonymous (nobody) Summary: noun / verb confusion for real/imag part Initial Comment: I think (%o4) should be (conjugate(z)+z)/2: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o4) realpart(z) For the sub to happen, we need to nounify: (%i5) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o5) (conjugate(z)+z)/2 For other functions (say cos), the nounify isn't needed: (%i7) subst(lambda([s], 42), 'cos, cos(x)); (%o7) 42 So, I think the nounify(realpart) shouldn't be needed in (%i5).  >Comment By: SourceForge Robot (sfrobot) Date: 20091213 02:20 Message: This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).  Comment By: Dieter Kaiser (crategus) Date: 20091128 23:56 Message: The substitution does not work as expected, because internally in Maxima the function realpart lives in two different forms: a noun form with the symbol %realpart and a verb form with the symbol $realpart. Because of this, we do not get the expected answer for the example of the bug report. The symbol 'realpart is passed with its noun form to the function subst. The verb function realpart(z) is evaluated (not simplified) to the internal noun form ((%realpart) $z). The substitution does not work, because subst distinguish the two forms: (%i1) declare(z,complex)$ (%i2) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o2) 'realpart(z) As written in the bug report a nounify helps. Again realpart(z) is evaluated to an internal noun form. Now we do not pass the verb form, but the symbol %realpart to subst: (%i3) subst(lambda([s], (s + conjugate(s))/2), nounify(realpart), realpart(z)); (%o3) (conjugate(z)+z)/2 We get the same result, when we prevent the evaluation of realpart(z) by quoting the function. Now only the verb form is present: (%i4) subst(lambda([s], (s + conjugate(s))/2), 'realpart, '(realpart(z))); (%o4) (conjugate(z)+z)/2 This behavior is different from simplifing functions like sin, cos, ... These functions only have one internal representation, that is a noun form. The "noun/verb confusion" is the expected behavior and is due to the implementation of functions like realpart. Perhaps, we can improve the documentation on this topic. I had no look at the code of subst. Perhaps, it is possible to do an implementation which ignores the noun/verb scheme for symbols. We could change the implementation of the function realpart and friends or we might modify the function subst. I think both ways are feature requests. Therefore, I would like to close this bug report. Dieter Kaiser  Comment By: Dieter Kaiser (crategus) Date: 20090110 23:53 Message: The reason for the different behavior is that the functions realpart() and imagpart() have not the property ALIAS like the functions sin() or cos(). The parser returns for the input 'realpart the symbol $realpart. For fully implemented simplifying functions the parser returns e.g. for the input cos the symbol %cos because of the property ALIAS. Unfortunately, the Lisp function risplitnoun introduces the symbols %realpart and %imagpart and realpart(z) simplifies to the expression ((%realpart) z). The function subst() does not work because of the different symbols. The call nounify(realpart) changes the verb form $realpart to the noun form %realpart and now it works again. This behavior can be changed when we do not use the symbol %realpart but change the function risplitnoun like: (defun risplitnoun (l) (cons (list '($realpart) l) (list '($imagpart) l))) A noun which is declared to be complex now gives the expression: (($REALPART SIMP) $Z) The original code does a simplify, but I think this is not possible for the whole expression (we loop endlessly) and not necessary for the argument l. We get the correct expression from the simplifier. We have to change the symbols %realpart and %imagpart at about 5 places in the whole code. The testsuite has no problems with this changes. With this change the example will work as expected: (%i25) subst(lambda([s], (s + conjugate(s))/2), 'realpart, realpart(z)); (%o25) (conjugate(z)+z)/2 Remark: With the original code and the changed code we get: 'realpart(x+%i*y); 'realpart(x+%i*y) /* intern ((%realpart) .... ) */ In this case the parser returns the symbol %realpart. Because realpart() is not a simplifying function Maxima can not further simplify this expression e.g. rectform('realpart(1)); realpart(1) So what do you think? Should we change %realpart to $realpart in risplitnoun. Perhaps later we can introduce a simplifying function realpart(). Dieter Kaiser  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2135806&group_id=4933 