Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10842 > unrolled thread
| Started by | Dana DeLouis <dana01@me.com> |
|---|---|
| First post | 2012-07-08 23:17 +0000 |
| Last post | 2012-07-14 05:27 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Sum of terms --> list Dana DeLouis <dana01@me.com> - 2012-07-08 23:17 +0000
Re: Sum of terms --> list bar@ANTYSPAM.ap.krakow.pl - 2012-07-14 05:27 +0000
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Date | 2012-07-08 23:17 +0000 |
| Subject | Re: Sum of terms --> list |
| Message-ID | <jtd4ec$9r3$1@smc.vnet.net> |
> LB[z_] := List @@ B[z]
> LB[3] (* NOT OK*)
> LB[3] gives 11/3 - this is a sum of term again - why ?
Hi. I believe B[3] is evaluated first to
1/(2-3) + 3/(4-3) + 5/(6-3)
Which is immediately reduced to 11/3.
Then the function -List- is applied to this reduced form, which returns just 11/3
One needs to hold the evaluation, or perhaps just:
B[z_]:=1/(2-z)+3/(4-z)+5/(6-z)
LB[z_]:=(List@@B[#1]) /. #1 -> z
LB[x]
{1/(2-x), 3/(4-x), 5/(6-x)}
LB[3]
{-1, 3, 5/3}
= = = = = = = = = =
HTH :>)
Dana DeLouis
Mac & Math 8
= = = = = = = = = =
On Jul 7, 5:31 am, b...@ANTYSPAM.ap.krakow.pl wrote:
> I have found this thread, an I heve additional question about List@@
>
> see on example:
>
> ----------
> ClearAll["`*"];
> B[z_] := 1/(2 - z) + 3/(4 - z) + 5/(6 - z);
> B[z] (*OK*)
> LB[z_] := List @@ B[z]
> LB[z] (*OK*)
> LB[z] /. z -> 3 (*OK*)
>
> LB[3] (* NOT OK*)
> ------------------------
>
> LB[3] gives 11/3 - this is a sum of term again - why ?
> Is a simply way to convert B[z] ---> LB[z]
> where LB[z] is a list of simple functions of z ?
>
> greetings, Olaf
[toc] | [next] | [standalone]
| From | bar@ANTYSPAM.ap.krakow.pl |
|---|---|
| Date | 2012-07-14 05:27 +0000 |
| Message-ID | <jtqvva$ba1$1@smc.vnet.net> |
| In reply to | #10842 |
Dana DeLouis <dana01@me.com> wrote:
> > LB[z_] := List @@ B[z]
> > LB[3] (* NOT OK*)
[...]
> One needs to hold the evaluation, or perhaps just:
> B[z_]:=1/(2-z)+3/(4-z)+5/(6-z)
> LB[z_]:=(List@@B[#1]) /. #1 -> z
> LB[x]
> {1/(2-x), 3/(4-x), 5/(6-x)}
> LB[3]
> {-1, 3, 5/3}
> = = = = = = = = = =
> HTH :>)
> Dana DeLouis
> Mac & Math 8
> = = = = = = = = = =
After help from Thomas G. i have found a simple solution
I have used
B[z_] := 1/(2 - z) + 3/(4 - z) + 5/(6 - z);
LB[z_] = List @@ B[z] (* = instead := in function definition*)
LB[3]
It gives good solution,
I'm not sure if this way can have bad consequences ..
Olaf
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web