Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Problem with condition in function definition !

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4149] Problem with condition in function definition !
  • From: a_kowald at chemie.fu-berlin.de (Axel Kowald)
  • Date: Fri, 7 Jun 1996 02:09:05 -0400
  • Organization: Kristallographic Institute FU Berlin
  • Sender: owner-wri-mathgroup at wolfram.com

Hi everybody

For some reason I'd like to define a function with condition in the following way:

b=1
bla[t_]/;(t<b) := {a,b,c}

bla[0] gives {a,b,c}, fine. But now I want to clear b, Clear[b], and still get 
the same result. So really I want to type 1 instead of b, but for some reason
can't do it.

Any idea what I have to do ?



DETAILS:
The reason why I want to do it in the above described way is that within a Do loop
I use NDSolve to integrate an ODE from t0 to t1, change some start values, 
integrate from t1 to t2, change some start values, integrate from t2 to t3,
and so on...
So for each interval I get an InterpolatingFunctionObject. Finally I want to plot 
my solutions ranging from t0 to tn and have to make sure that I use the correct
InterpolationFunctionObject for the right interval. I thought a solution would be
to define a function (bla[]) which is defined section wise (using the
conditionals) and which calls the InterpolatingFunctionObjects which are valid
for the given interval. 
"b" in the above example corresponds to the index variable of the Do loop.
Unfortunately this doesn't work because after the Do loop I do NOT have several 
function definitions for t0 to t1, t1 to t2, and so on. 
If there is another easy way to solve my problem I would appreciate any help.


	Many thanks in advance

		Axel Kowald

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Forthcoming book - "Experiments in Undergraduate Mathematics"
  • Next by Date: Announcing TMath: Tcl and C++ Interfaces to Mathematica
  • Previous by thread: Forthcoming book - "Experiments in Undergraduate Mathematics"
  • Next by thread: Re: Problem with condition in function definition !