Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Nestwhile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57201] Nestwhile
  • From: Pratik Desai <pdesai1 at umbc.edu>
  • Date: Fri, 20 May 2005 04:44:10 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
I am having problem with using NestWhile in a code which basically boils 
down to finding values for the variables (e,dw)  for which a function 
d[e, dw] is "minimized" while one variable (e) goes up to 1. I have been 
using the following approach, which unfortunately loops for 1 
iteration..There is definitely a better probably a simpler  way to do 
this...Thanks in advance for your help

Here is the attempt :

d[ e, dw] =
Abs[0. + 1143.8189785870038/((-2.0224920432639264 + 
e)*(22.50249204326393 + e)) +
   (e^3*(-2.3561944901923435 - 
1.3322676295501878*^-15*w))/((-2.0224920432639264 + 
e)*(22.50249204326393 + e)) -
   56.548667764616276*w - (2573.5927018207585*dw)/((-2.0224920432639264 
+ e)*(22.50249204326393 + e)) +
   (e^2*(-73.38760438785755 + 
56.54866776461624*dw))/((-2.0224920432639264 + e)*(22.50249204326393 + 
e)) +
   (e*(-407.4855111216201 + 
1158.1167158193412*dw))/((-2.0224920432639264 + e)*(22.50249204326393 + 
e))] +
 8.*Abs[0. + 0./((-2.0224920432639264 + e)*(22.50249204326393 + e)) +
    (0.*dw)/((-2.0224920432639264 + e)*(22.50249204326393 + e)) +
    e^2*(0./((-2.0224920432639264 + e)*(22.50249204326393 + e)) + 
(0.*dw)/((-2.0224920432639264 + e)*
        (22.50249204326393 + e))) + e*(0. + 0./((-2.0224920432639264 + 
e)*(22.50249204326393 + e)) +
      (0.*dw)/((-2.0224920432639264 + e)*(22.50249204326393 + e)))] +
 Abs[0. + (e*(-107.23302924253159 - 
7.105427357601*^-14*dw))/((-2.0224920432639264 + e)*(22.50249204326393 + 
e)) +
   (e^3*(2.3561944901923453 - 
4.440892098500626*^-16*dw))/((-2.0224920432639264 + 
e)*(22.50249204326393 + e)) +
   e^2*(48.25486315913923/((-2.0224920432639264 + e)*(22.50249204326393 
+ e)) +
     (0.*dw)/((-2.0224920432639264 + e)*(22.50249204326393 + e)))]

Module[{e = 0.05, dw = 0.04}, NestWhile[{e += 0.01,dw += 0.1},
   d[ e, dw],10^-2 <d[ e,  dw] <0&&e==1 ]; Print[dw,d[ e, dw],e]; 
Return[d[j, e, dw], Module]]

0.14
25.415

-- 
Pratik Desai
Graduate Student
UMBC
Department of Mechanical Engineering
Phone: 410 455 8134



  • Prev by Date: Re: NonLinearRegress and constraint parameters
  • Next by Date: Re: Crossing of 3D functions
  • Previous by thread: Re: four approaches to do a simple sum
  • Next by thread: Re: Nestwhile