Feel free to contribute here in news:comp.lang.javascript, if you ever have anything useful to say; but not otherwise.
Feel free to contribute here in news:comp.lang.javascript, if you ever have anything useful to say; but not otherwise.
I don't see any code there (a few busted links). What sort of algorithm is it that you are trying to converge?
See
It seems almost instant now.
Check that you are taking full advantage of symmetry, and not calculating anything more than once - but I expect you did that. Don't recalculate pi/180 or 180/pi - in fact, work entirely in radians and cycles, except for I/O, of which there is little.
Minimise object lookups - e.g. document.mainform.fp1e.value = p1ed ; document.mainform.fp2s.value = p2sd ; ... becomes dmf = document.mainform // done only once
dmf.fp1e.value = p1ed ; dmf.fp2s.value = p2sd ; ...
For me, setting Q = Math.sin globally and using Q(0.1) instead of Math.sin(0.1) makes a small improvement.
p1e = eval (document.mainform.fp1e.value) // why eval? use p1e = +document.mainform.fp1e.value // see FAQ
Many, at least, of your eval calls are obviously not inner-loop; but I doubt whether any are needed.
I agree with what other CLJ users wrote - for a better S/N, post only there (FU set).
I did not have time to determine your iteration algorithm, and that's where the greatest gains must lie.
It appears, from that page, that it deals with something related to work I used to do - but perhaps you already know that. The page desperately needs a SMALL box near the top saying what a Magic Sinewave is (mainly for those who know the subject but not the term) with a link to .
I tried your code on my automatic re-indenter, but it seemed to be taking infinite time on that amount.
Once upon a time, I made a 16 2/3 Hz PSD (mains-locked) by switching (with reeds!) positive for one cycle of 50 Hz, off for half a cycle, negative for one cycle, off for half a cycle, repeated. Earlier, I built a three-phase oscillator with (IIRC) three OC71 transistors and 6 resistors - it generated 200 kHz trapezium waves, more or less.
http://66.102.9.104/search?q=cache:gPOJH3E6QSkJ:
Was it really *that* hard to paste:
...?
-Lost
Have something to add? Share your thoughts — no account required.
Ask the community — no account required