logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
wabbit  
#21 Posted : Friday, December 23, 2005 11:37:46 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I was playing around with the idea to find out which LinReg is the highest.... and came up with this monster: [code:1:bcac8a5669]x1:= Max(LinearReg(C,13), Max(LinearReg(C,14), Max(LinearReg(C,15), Max(LinearReg(C,16), Max(LinearReg(C,17), Max(LinearReg(C,18), Max(LinearReg(C,19), Max(LinearReg(C,20), Max(LinearReg(C,21), Max(LinearReg(C,22), Max(LinearReg(C,23), Max(LinearReg(C,24), Max(LinearReg(C,25), Max(LinearReg(C,26), Max(LinearReg(C,27), Max(LinearReg(C,28), Max(LinearReg(C,29), Max(LinearReg(C,30), Max(LinearReg(C,31),LinearReg(C,32)))))))))))))))))))); x2:= Max(LinearReg(C,33), Max(LinearReg(C,34), Max(LinearReg(C,35), Max(LinearReg(C,36), Max(LinearReg(C,37), Max(LinearReg(C,38), Max(LinearReg(C,39), Max(LinearReg(C,40), Max(LinearReg(C,41), Max(LinearReg(C,42), Max(LinearReg(C,43), Max(LinearReg(C,44), Max(LinearReg(C,45), Max(LinearReg(C,46), Max(LinearReg(C,47), Max(LinearReg(C,48), Max(LinearReg(C,49),LinearReg(C,50)))))))))))))))))); x3:=Max(x1,x2); if(x3=LinearReg(C,13),13, if(x3=LinearReg(C,14),14, if(x3=LinearReg(C,15),15, if(x3=LinearReg(C,16),16, if(x3=LinearReg(C,17),17, if(x3=LinearReg(C,18),18, if(x3=LinearReg(C,19),19, if(x3=LinearReg(C,20),20, if(x3=LinearReg(C,21),21, if(x3=LinearReg(C,22),22, if(x3=LinearReg(C,23),23, if(x3=LinearReg(C,24),24, if(x3=LinearReg(C,25),25, if(x3=LinearReg(C,26),26, if(x3=LinearReg(C,27),27, if(x3=LinearReg(C,28),28, if(x3=LinearReg(C,29),29, if(x3=LinearReg(C,30),30, if(x3=LinearReg(C,31),31, if(x3=LinearReg(C,32),32, if(x3=LinearReg(C,33),33, if(x3=LinearReg(C,34),34, if(x3=LinearReg(C,35),35, if(x3=LinearReg(C,36),36, if(x3=LinearReg(C,37),37, if(x3=LinearReg(C,38),38, if(x3=LinearReg(C,39),39, if(x3=LinearReg(C,40),40, if(x3=LinearReg(C,41),41, if(x3=LinearReg(C,42),42, if(x3=LinearReg(C,43),43, if(x3=LinearReg(C,44),44, if(x3=LinearReg(C,45),45, if(x3=LinearReg(C,46),46, if(x3=LinearReg(C,47),47, if(x3=LinearReg(C,48),48, if(x3=LinearReg(C,49),49,50))))))))))))))))))))))))))))))))))))))))))))))))))));[/code:1:bcac8a5669] If I edit a formula with this entire code section it takes literally hours (4 hours so far, and counting) for MS to come back from its extended thinking time and say its finished thinking about this formula. If I break it into two parts, it takes only minutes to think about when editing the formula, but plots really quickly? I am curious and patient, so I am going to let this run overnight and see what happens in the morning. It doesn't explain though, why MS takes soooo long just to 'save' this formula after editing? Windows Task Manager shows MSWin.exe has 99% of my CPU. I wonder what it is doing? wabbit :D P.S. Don't try this one at home folks! UNLESS, of course you want to see what happens if you do it on your machine? Maybe I have a glitch somewhere that you don't have. You have been warned though!
mstt  
#22 Posted : Friday, December 23, 2005 6:51:12 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Wabbit The cause of slowness for a formula like this is, in my opinion at least, the huge number of nested expressions. The reason why I assembled my formula the way I did was to keep the number of nested formulas to a practical limit of 10 or so. This is particularly important with If() functions but it's a factor to keep in mind with other functions as well. Regards Roy MetaStock Tips & Tools
wabbit  
#23 Posted : Saturday, December 24, 2005 6:03:47 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I agree its the nested expressions, but what is MS doing after I have edited the formula, before its even displayed. It takes ages (quit at 16 hours) to evaluate the expression whilst saving the formula, but it takes less than a second to displat the formula resultant on the graph, after the save operation has been completed? Anyway, here's a version that takes an acceptable amount of time to "evaluate" [code:1:16d58db365]x1:= Max(LinearReg(C,13), Max(LinearReg(C,14), Max(LinearReg(C,15), Max(LinearReg(C,16), Max(LinearReg(C,17), Max(LinearReg(C,18), Max(LinearReg(C,19), Max(LinearReg(C,20), Max(LinearReg(C,21), Max(LinearReg(C,22), Max(LinearReg(C,23), Max(LinearReg(C,24), Max(LinearReg(C,25), Max(LinearReg(C,26), Max(LinearReg(C,27), Max(LinearReg(C,28), Max(LinearReg(C,29), Max(LinearReg(C,30), Max(LinearReg(C,31),LinearReg(C,32)))))))))))))))))))); x2:= Max(LinearReg(C,33), Max(LinearReg(C,34), Max(LinearReg(C,35), Max(LinearReg(C,36), Max(LinearReg(C,37), Max(LinearReg(C,38), Max(LinearReg(C,39), Max(LinearReg(C,40), Max(LinearReg(C,41), Max(LinearReg(C,42), Max(LinearReg(C,43), Max(LinearReg(C,44), Max(LinearReg(C,45), Max(LinearReg(C,46), Max(LinearReg(C,47), Max(LinearReg(C,48), Max(LinearReg(C,49),LinearReg(C,50)))))))))))))))))); x3:=Max(x1,x2); x4:= If(x3=LinearReg(C,13),13, If(x3=LinearReg(C,14),14, If(x3=LinearReg(C,15),15, If(x3=LinearReg(C,16),16, If(x3=LinearReg(C,17),17, If(x3=LinearReg(C,18),18, If(x3=LinearReg(C,19),19, If(x3=LinearReg(C,20),20, If(x3=LinearReg(C,21),21, If(x3=LinearReg(C,22),22, If(x3=LinearReg(C,23),23, If(x3=LinearReg(C,24),24, If(x3=LinearReg(C,25),25, If(x3=LinearReg(C,26),26, If(x3=LinearReg(C,27),27, If(x3=LinearReg(C,28),28, If(x3=LinearReg(C,29),29, If(x3=LinearReg(C,30),30, If(x3=LinearReg(C,31),31, If(x3=LinearReg(C,32),32,99)))))))))))))))))))); x5:= If(x3=LinearReg(C,33),33, If(x3=LinearReg(C,34),34, If(x3=LinearReg(C,35),35, If(x3=LinearReg(C,36),36, If(x3=LinearReg(C,37),37, If(x3=LinearReg(C,38),38, If(x3=LinearReg(C,39),39, If(x3=LinearReg(C,40),40, If(x3=LinearReg(C,41),41, If(x3=LinearReg(C,42),42, If(x3=LinearReg(C,43),43, If(x3=LinearReg(C,44),44, If(x3=LinearReg(C,45),45, If(x3=LinearReg(C,46),46, If(x3=LinearReg(C,47),47, If(x3=LinearReg(C,48),48, If(x3=LinearReg(C,49),49, If(x3=LinearReg(C,50),50,99)))))))))))))))))); Min(x4,x5);[/code:1:16d58db365] Hope this helps, someone! wabbit :D
Users browsing this topic
Guest (Hidden)
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.