MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: sum up

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69751] RE: [mg69716] sum up
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 22 Sep 2006 01:04:22 -0400 (EDT)

Dimitris,

I was going to say that the functions that are Listable are those that have
a single argument. But actually the functions can have more than one
argument, but in this case equal length lists must be given for EVERY
argument. An example of this is:

Power[{x, y, z}, {2, 3, 4}]
{x^2, y^3, z^4}

Commands like Integrate and Plot do not allow you do have a list for the
second argument, the iterator. So the commands are not Listable. Actually it
would be nice if Plot was Listable because then you could plot different
expressions over different domains in one Plot statement!

Rather, I think that Integrate and Plot are overloaded commands in the sense
that they have one definition for the case of a non-List expression in the
first slot and a different definition when the first slot contains a list.
If you look up Plot in Help you will actually see the two different
definitions.

So now I've learned something.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: dimmechan at yahoo.com [mailto:dimmechan at yahoo.com]
To: mathgroup at smc.vnet.net

Hello.


1) Why built-in functions like Plot, Integrate and NIntegrate exhibit
listability although they do not have the Attribute Listable?

lst = {1/x, 1/x^2};
Integrate[lst, {x, 1, 2}]
{Log[2], 1/2}
NIntegrate[Evaluate[lst], {x, 1, 2}]
{0.693147180559947, 0.5000000000000211}
Plot[Evaluate@lst, {x, 1, 2}];
({#1, Attributes[#1]} & ) /@ {Integrate, NIntegrate, Plot}
{{Integrate, {Protected, ReadProtected}}, {NIntegrate, {HoldAll,
Protected}},
{Plot, {HoldAll, Protected}}}

To me (at least now) look more normal the behavior of
CauchyPrincipalValue.

Needs["NumericalMath`"]
lst2= {1/x, 1/Sin[x]};

Both of these fail to produce Output (apart from the NIntegrate::inum
messages).

CauchyPrincipalValue[lst, {x, -1, {0}, 2}]
CauchyPrincipalValue[Evaluate[lst], {x, -1, {0}, 2}]


Regards
Dimitris Anagnostou




  • Prev by Date: Off[General::spell1] and StyleSheet Notepad
  • Next by Date: Off[General::spell1] and StyleSheet Notepad
  • Previous by thread: Re: sum up
  • Next by thread: Re: Typesetting on the Mathematica users wiki