Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.math.maple > #186

Re: Multiple plots with stepped parameters

From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Multiple plots with stepped parameters
Date 2011-06-19 13:46 -0700
Organization A noiseless patient Spider
Message-ID <874o3lim7o.fsf@san.rr.com> (permalink)
References <SalmonEgg-4EE972.11212019062011@news60.forteinc.com> <9671hcFjfmU1@mid.individual.net>

Show all headers | View raw


Axel Vogt <&noreply@axelvogt.de> writes:

> On 19.06.2011 20:21, Salmon Egg wrote:
>> My example will based upon blackbody radiation. Suppose the emission at
>> a frequency nu at various temperatures goes like
>>
>> J := 1/(exp(nu/T)-1)
>>
>> How do I plot J against nu for all T in a list like
>>
>> {0.5, 1.0. 2.0, 5.0, 10.0}?
>>
>> I think I see how to do that if I listed separate functions in the plot
>> command. ie
>>
>> 1/(exp(nu/0.5)-1), 1/(exp(nu/1.0)-1), ...
>>
>
> You may have a scaling problem for showing it, but for example:
>
> L:=[0.5, 1.0. 2.0, 5.0, 10.0]; # use an ordered list, not a set
>
> P:=NULL;
> for t in L do        # run through the list
>   eval(J, nu=t);     # evaluate expression
>   plot(%, T=0 .. 1); # plot for each
>   P:=P, %;           # remember it
> end do:
>
> plots[display](P);   # print

A minor comment.  Axel's solution is fine for this application, but
building a list like that, term by term, is an O(n^2) process, so that
if L gets long enough, you could have issues.  Fortunately, the list
building can be done in O(n) by using seq:

plots:-display(seq(plot(eval(J,nu=t),T=0..1), t in L));

That is unlikely to be an issue here since the number of plots one is
likely to create in one graph is presumably fairly small.  Because most
of the time is in the plot building (and that is O(n) with either
approach), Axel's method is suitable.

-- 
Joe Riel

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Multiple plots with stepped parameters Salmon Egg <SalmonEgg@sbcglobal.net> - 2011-06-19 11:21 -0700
  Re: Multiple plots with stepped parameters Axel Vogt <&noreply@axelvogt.de> - 2011-06-19 21:38 +0200
    Re: Multiple plots with stepped parameters Joe Riel <joer@san.rr.com> - 2011-06-19 13:46 -0700
  AW: Multiple plots with stepped parameters "Michael Komma" <komma@oe.uni-tuebingen.de> - 2011-06-20 23:34 +0200
    Re: AW: Multiple plots with stepped parameters Salmon Egg <SalmonEgg@sbcglobal.net> - 2011-06-20 17:33 -0700
      Re: AW: Multiple plots with stepped parameters "Barister Mine" <me@privacy.net> - 2011-06-21 07:45 +0300
      AW: AW: Multiple plots with stepped parameters "Michael Komma" <komma@oe.uni-tuebingen.de> - 2011-06-21 11:15 +0200
      Re: AW: Multiple plots with stepped parameters Axel Vogt <&noreply@axelvogt.de> - 2011-06-21 23:04 +0200
  Re: Multiple plots with stepped parameters Roman <wfrisch@gmx.net> - 2011-06-21 00:50 -0700

csiph-web