|
|
Choosing A Webhost: |
Re: Mathmatical Question, Formula to multiply a number by smaller amounts?: msg#00194windows.devel.dotnet.cx
oh and about the newsgroup. Well i asked here due to it being generally program related, it was going to go further into program talk.. but immediately it seems were getting stuck on the formula. Well, "we" are due to my lack of explanation skills. Hopefully were clear now :o I cant waste anymore time tomorrow so if i have to bite the bullet and waste some resources i'll have to. I cant afford to sit on my arse starring at a problem if i do have a workaround. I just hate giving into problems in the said subject. On 9/29/05, Zeusbwr <zeusbwr@xxxxxxxxx> wrote: > In reply Sven, i do not know how to use powers in this case. > > For example, a loop was a bad example. There is no "loop". It was just > a code to give an example. Through time, the user's "dNumber" grows, > however i want it to grow by a smaller amount each time. There in lies > the trick, because the only information you have is dNumber, the > integer "i" does not exist. So using powers with the assumption of > "times executed" (or somethin similar) would be impossible. > > Keep the loop for example, but pretend the integer i didnt exist. How > could you make dMod multiply ( end product is to increase ) dNumber by > a smaller amount as dNumber grows. > > All the knowledge that is at hand for the formula is how much the > modifier equals, and the number to modify. There is no knowledge of > how many times it has been done, there for giving simple Power > formulas a hard time.. > > Anyway.. ya.. Any ideas? > > On 9/28/05, Sven Devriese <desfen@xxxxxxxxxx> wrote: > > On Wed, 28 Sep 2005 14:35:08 -0700, Zeusbwr <zeusbwr@xxxxxxxxx> wrote: > > > > >double dMod = 1.05; // Modifier > > >double dNumber = 1; // Number i wish to modify > > > > > >for( int i = 0; i < 5; i++ ){ > > > > > > dNumber = dNumber * dMod; > > > Console.Writeline( "Here is your {0} number: {1}, i, dNumber ); > > > dMod = dMod * 0.95; > > > > > >} > > > > > > > > >Now what i want to do is exactly that, each iteration i want to > > >multiple a number by a ever smaller number. But the thing is, dMod > > >cant change. > > > > > >Would it be possible to accomplish what is done with that loop, > > >without modifying dMod? > > > > Well, if I understand you correctly you just need to use powers > > (which are essentially repeated multiplications, if the exponent > > is an integer). > > > > double dMod = 1.05; // Modifier > > double dNumber = 1; // Number i wish to modify > > > > for( int i = 0; i < 5; i++ ) > > { > > dNumber = dNumber * (dMod ^ (i + 1)); > > Console.Writeline( "Here is your {0} number: {1}, i, dNumber ); > > } > > > > So, you never modify dMod but you get the same results. > > My C++ is rusty so you need to look up the > > exact syntax for raising a number to an integer power. > > If I recall correctly C(++) has no built-in support for raising > > a number to a non-integer power but you don't need that. > > (You can work around that by using exp and ln anyway.) > > > > BTW, this is hugely off-topic. In the future you're better off > > asking such things in any newsgroup that has "math" in its name > > (e.g. comp.sci.math) > > > > HTH > > > > Sven > > > > =================================== > > This list is hosted by DevelopMentor(r) http://www.develop.com > > > > View archives and manage your subscription(s) at http://discuss.develop.com > > > > > -- > Zeusbwr[at]gmail.com, > http://www.google.com/talk/ > > Project Blog: http://zeusbwr.blogspot.com/ > -- Zeusbwr[at]gmail.com, http://www.google.com/talk/ Project Blog: http://zeusbwr.blogspot.com/ =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Mathmatical Question, Formula to multiply a number by smaller amounts?, Zeusbwr |
|---|---|
| Next by Date: | Re: Mathmatical Question, Formula to multiply a number by smaller amounts?, phil paxton |
| Previous by Thread: | Re: Mathmatical Question, Formula to multiply a number by smaller amounts?, Zeusbwr |
| Next by Thread: | Re: Mathmatical Question, Formula to multiply a number by smaller amounts?, phil paxton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |