Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4393
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | Heike Gramberg <heike.gramberg@gmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Basic questions on _Plus and recursion |
| Date | Sun, 14 Aug 2011 12:20:18 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <j28ei2$3e7$1@smc.vnet.net> (permalink) |
| References | <201108131049.GAA25524@smc.vnet.net> |
| Lines | 41 |
| NNTP-Posting-Date | 14 Aug 2011 11:22:36 GMT |
| NNTP-Posting-Host | 27f338e0.news.twtelecom.net |
| X-Trace | DXC=_1mSX=OM2I08W0SG3emHW:C_A=>8kQj6==_1NR_H?JP=j>WA7MKjR;1EFiONJ7[Go66mfTCWVb>]6 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:4393 |
Show key headers only | View raw
You could try Distribute:
Distribute[f[a+b,c+d]]
out:
f[a, c] + f[a, d] + f[b, c] + f[b, d]
Heike.
On 13 Aug 2011, at 12:49, Ethan Dyer wrote:
> Hi. I'm sure these are common issues, but I haven't found them. Here
are the two, unrelated questions. Thank you for the help.
>
> 1) I want to use _Plus for a function with arbitrary arguments. ie I
want: f[a+b]=f[a]+f[b], f[a+b,c+d] to go to =
f[a,c]+f[a,d]+f[b,c]+f[b,d], ... Is there a standard way to do this?
>
> 2)Here I want to pull out scalars from a function. Something like
this:
>
> f[x__] :=(Times@@Select[{x},Scalar[#]==1&]) =
(f@@Select[{x},Scalar[#]!=1&])
>
> Where i have defined a function Scalar to =1 for some symbols.
>
> for instance say I had defined Scalar[a]=1 then f[a,b,c]= a
f[b,c].
>
> The above does not work, as it gives infinite recursion. Is there a
way to do this properly?
>
> Thank you again. Sorry if these are too common.
>
> Ethan
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Basic questions on _Plus and recursion Heike Gramberg <heike.gramberg@gmail.com> - 2011-08-14 12:20 +0000
csiph-web