It's not pretty, but this seems to work:
msinh(x):=sin(%i*z)/%i;
mcosh(x):=cos(%i*z);
mtrigreduce(e):=block([%iargs],%iargs:false,
e:subst('msinh,'sinh,e),
e:subst('mcosh,'cosh,e),
e:ev(e,nouns),
e:trigreduce(e),
e);
At 03:06 PM 11/25/2013, Henry Baker wrote:
>If non-mixed is the only problem, then
>
>%iargs:false
>sinh(x) => sin(%i*z)/%i
>cosh(x) => cos(%i*z)
>trigreduce()
>%iargs:true
>ev()
>etc.
>
>At 02:29 PM 11/25/2013, Stavros Macrakis wrote:
>>It's really much simpler than that. trigreduce understands products of trig and products of hyperbolic, but not mixed products. Pushing in %i is not necessary. It's a SMOP to add the mixed cases like:
>>
>> trigreduce(sin(x)*cosh(y)) == sin(%i*y+x)/2 sin(%i*y x)/2
>>
>>Are you volunteering? Code is in trgred.lisp.
>>
>> -s
>>
>>On Mon, Nov 25, 2013 at 4:52 PM, Henry Baker <hbaker1 at pipeline.com> wrote:
>>I'm curious as to why trigreduce doesn't work right now. Somewhere, someone is noticing %i and doing something different.
>>
>>Maxima needs a series of tools that work _reliably_. Trigexpand & trigreduce have a few nits here & there that need to be fixed so that they can be relied upon.
>>
>>The problem seems to be that during trigexpand, %i needs to be pushed outward (e.g., sin(%i*p) => %i sinh(p)), whereas during trigreduce, %i needs to be pushed inwards (e.g., %i*sinh(p) => sin(%i*p)).
>>
>>%iargs simply turns "pushing out" off, but doesn't turn "pushing in" on.
>>
>>At 01:18 PM 11/25/2013, Stavros Macrakis wrote:
>>>I never said that %iargs controls trigreduce; it simply prevents trigexpand from resulting in cosh/sinh.
>>>
>>>I understand that you would like trigreduce to handle this case. But by mentioning regression tests, you're implying that it used to handle this case, and there has been an undetected regression which causes it not to handle it any more. If so, it would be helpful if you could identify the version of Maxima in which it did handle this case.
>>>
>>>But as far as I know, Maxima has never handled the mixed hyperbolic/trigonometric case, though it is a perfectly reasonable feature request.
>>>
>>> -s
>>>
>>>On Mon, Nov 25, 2013 at 3:38 PM, Henry Baker <hbaker1 at pipeline.com> wrote:
>>>The setting of %iargs doesn't help. This is still a bug.
>>>
>>>Maxima 5.28.0-2 http://maxima.sourceforge.net
>>>using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
>>>Distributed under the GNU Public License. See the file COPYING.
>>>Dedicated to the memory of William Schelter.
>>>The function bug_report() provides bug reporting information.
>>>(%i1) %iargs:false;
>>>(%o1) false
>>>(%i2) cos(p+q*%i);
>>>(%o2) cos(%i q + p)
>>>(%i3) trigexpand(%);
>>>(%o3) cos(p) cos(%i q) - sin(p) sin(%i q)
>>>(%i4) %,%iargs=true;
>>>(%o4) cos(p) cosh(q) - %i sin(p) sinh(q)
>>>(%i5) trigreduce(%);
>>>(%o5) cos(p) cosh(q) - %i sin(p) sinh(q)
>>>(%i6)
>>>
>>>At 11:16 AM 11/25/2013, Stavros Macrakis wrote:
>>>>Are you saying that this example used to work as you expected? In what version?
>>>>
>>>>Not sure what this has to do with the simplifier. Except maybe if you're talking about %iargs -- if you set %iargs:false, then sin(%i*x) does not simplify to %i*sinh(x), so trigreduce(trigexpand(sin(a+b*%i))) => sin(a+b*%i). Are you saying that the default value of %iargs has changed?
>>>>
>>>> -s
>>>>
>>>>On Mon, Nov 25, 2013 at 12:52 PM, Henry Baker <hbaker1 at pipeline.com> wrote:
>>>>Hi Stavros:
>>>>
>>>>Could we please include this trigexpand/trigreduce problem in the Maxima regression test problem set?
>>>>
>>>>Examples like these need to be constantly checked every time a change is made to the Maxima "simplifier".
>>>>
>>>>At 08:10 AM 11/25/2013, Stavros Macrakis wrote:
>>>>>Workaround:
>>>>>
>>>>>subst(q/%i,qi,trigreduce(subst(%i*qi,q,%o2)))
>>>>>
>>>>>On Mon, Nov 25, 2013 at 9:58 AM, Henry Baker <hbaker1 at pipeline.com> wrote:
>>>>>What is the antidote for trigexpand with complex arguments?
>>>>>
>>>>>trigreduce doesn't seem to work here.
>>>>>
>>>>>Maxima 5.28.0-2 http://maxima.sourceforge.net
>>>>>using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
>>>>>Distributed under the GNU Public License. See the file COPYING.
>>>>>Dedicated to the memory of William Schelter.
>>>>>The function bug_report() provides bug reporting information.
>>>>>(%i1) cos(p+q*%i);
>>>>>(%o1) cos(%i q + p)
>>>>>(%i2) trigexpand(%);
>>>>>(%o2) cos(p) cosh(q) - %i sin(p) sinh(q)
>>>>>(%i3) trigreduce(%);
>>>>>(%o3) cos(p) cosh(q) - %i sin(p) sinh(q)
>>>>>(%i4)