Campbell Ritchie wrote:Welcome to the Ranch
That isn't pseudocode, as people have already told you. But it isn't assembly either. You would have to ask your lecturer for an explanation and what language that is. Please use the code button, which will preserve any indentation in the original code,and will by magic make that code intelligible. That last bit was a lie But the code button will make it look better.
Liutauras Vilda wrote:@OP
I must say you were very brave to even attempt this exercise or maybe prank (which feels more of the case).
What is the module/class name? Which language is being used there?
Dave Tolls wrote:That's not pseudocode.
It's pretty much unintelligible.
Looks more like some form of assembly.
Tim Moores wrote:Well, that pseudocode is impossible to make sense in a reasonable amount of time as. What is it supposed to do? What do the 7 parameters do?
Not so humorous aside: if a method has 7 parameters, it's probably missing a few more.
Campbell Ritchie wrote:Despite what your lecturer says, that isn't pseudocode. Please explain what the modified false positive method is supposed to do, and also what these seven variables mean: xl, xu, es, imax, xr, iter, and e
I am afraid, I think you do need to explain what the modified false position algorithm is supposed to do. Most of us are not experts in numerical methods and don't know anything about that algorithm.Iron Nokana wrote:. . . I hardly to explain about modified false position . . .
Now, that is pseudocode. It appears to be called the Regula Falsi method, which sounds as though it had been invented by two people in Italy. The name of the method seems to change from link to link. That pseudocode is however incomplete. It doesn't, for example, tell us what the convergence criterion in line 2 is. I would suggest you decide on a convergence criterion, which must be consistent with the precision of the datatypes you are using, and create a method to implement that. Maybe you should call it needsToConverge, and this is a possible implementation:If the old result is 123.4567 and the new result is 123.4444 and the proportion is 0.000001 (=10⁻⁶), then you are not within the convergence criterion and it will return true. You will obviously have your own convergence criterion. Remember the precision limits of doubles, particularly if you approach (±)Double#MAX_VALUE and even more so if the absolute value of your number is ≤Double#MIN_NORMAL.picture taken on https://nptel.ac.in/courses/122104019/numericalanalysis/Rathishkumar/ratish1/f3node4.html
Campbell Ritchie wrote:Despite what your lecturer says, that isn't pseudocode. Please explain what the modified false positive method is supposed to do, and also what these seven variables mean: xl, xu, es, imax, xr, iter, and e
Still totally incomprehensible to anybody unfamiliar with that algorithm. I could understand something like Σx, but there isn't even anything like that in itDave Tolls wrote:. . . Possibly some sort of mathematical pseudocode? . . .
I see,does regular false method and modified false method are different ?Campbell Ritchie wrote:
I am afraid, I think you do need to explain what the modified false position algorithm is supposed to do. Most of us are not experts in numerical methods and don't know anything about that algorithm.Iron Nokana wrote:. . . I hardly to explain about modified false position . . .
Now, that is pseudocode. It appears to be called the Regula Falsi method, which sounds as though it had been invented by two people in Italy. The name of the method seems to change from link to link. That pseudocode is however incomplete. It doesn't, for example, tell us what the convergence criterion in line 2 is. I would suggest you decide on a convergence criterion, which must be consistent with the precision of the datatypes you are using, and create a method to implement that. Maybe you should call it needsToConverge, and this is a possible implementation:If the old result is 123.4567 and the new result is 123.4444 and the proportion is 0.000001 (=10⁻⁶), then you are not within the convergence criterion and it will return true. You will obviously have your own convergence criterion. Remember the precision limits of doubles, particularly if you approach (±)Double#MAX_VALUE and even more so if the absolute value of your number is ≤Double#MIN_NORMAL.picture taken on https://nptel.ac.in/courses/122104019/numericalanalysis/Rathishkumar/ratish1/f3node4.html
actually this is true because im lack of understanding pseducodeIn my collge my lecturer never teach us about pseducode,just basic programming,except some subject has a lesson about code in pseducode,I dont have choice but force to learn and study,so im apology if I posted itCampbell Ritchie wrote:
Still totally incomprehensible to anybody unfamiliar with that algorithm. I could understand something like Σx, but there isn't even anything like that in itDave Tolls wrote:. . . Possibly some sort of mathematical pseudocode? . . .
That link is caused by somebody not understanding what pseudocode is, then adding things like Σx to it as shorthand to write on the board, then somebody else deciding to give it a name. You end up with something different from pseudocode called pseudocode. But even the example in Wikipedia is much easier to understand than what we have here.
[edit]Move, “ as shorthand” into its correct location.
What regular false method? It says Regula Falsi method in the links you have supplied. If you search for that title you may find out more information.Joxsel Marico wrote:. . . I see,does regular false method and modified false method are different ?
Sresh Rangi wrote:It would make a lot more sense with these characters being replaced.
Yes, it does . That .doc link you posted shows obvious implemented code. Don't know what language it is. It looks like something procedural, but that is a much less serious problem. Working out what the ~= operator means would also help; I suspect it means, “is approximately equal to”.Sresh Rangi wrote:. . . It would make a lot more sense with these characters being replaced.
Campbell Ritchie wrote:Working out what the ~= operator means would also help; I suspect it means, “is approximately equal to”.
Paul Clapham wrote:
Campbell Ritchie wrote:Working out what the ~= operator means would also help; I suspect it means, “is approximately equal to”.
Or it could mean "is not equal to"... the ~ character is commonly used by mathematicians as the "not" operation. So yeah... we need to know what it really means.
Did you ever grow anything in the garden of your mind?  Fred Rogers. Tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/globalsolutionshomebackyard
