Re: how to pull real numbers out of a linear funktion ?
- To: mathgroup@smc.vnet.net
- Subject: [mg11171] Re: [mg11092] how to pull real numbers out of a linear funktion ?
- From: BobHanlon@aol.com
- Date: Wed, 25 Feb 1998 03:31:44 -0500
Clear[f]; f[c_ x_] /; (Head[c] === Real || Head[c] === Integer) := c f[x] f[c_ x_] /; (Head[c] === Complex) := -c f[x] {f[2x],f[2.x],f[(3+4I)x],f[8], f[2(3+4I)],f[(6+7I)(3+4I)],f[x y]} {2 f[x],2. f[x],(-3-4 I) f[x],f[8],f[6+8 I],f[-10+45 I],f[x y]} It is not clear what you want done if the factors are implied or the order of the factors is ambiguous. For example, Is f[8] supposed to be f[8] or 8 * f[1] or 4 f[2] or 2 f[4]? Is f[2(3+4I)] supposed to be f[6+8I] or 2 * f[3+4I] or (-3-4I) * f[2] or 2 * (-3-4I) * f[1] ? Is x supposed to be restricted to being a symbol? If so, Clear[f]; f[c_ x_Symbol] /; (Head[c] === Real || Head[c] === Integer) := c f[x] f[c_ x_Symbol] /; (Head[c] === Complex) := -c f[x] Bob Hanlon