Connect with us

Why am I getting Javascript (form) or (this.form) errors?

Discussion in 'Electronic Design' started by Don Lancaster, Mar 24, 2007.

Scroll to continue with content
  1. Robert Baer

    Robert Baer Guest

    Find a way to make a crude guess that is not too far off and use
    binary search (but i assume you already knew that.
    If the crude guess is fairly close, maybe use Taylors series on
  2. Randy Webb

    Randy Webb Guest

    Don Lancaster said the following on 3/25/2007 12:21 AM:

    If by converging you mean execution speed, I didn't play very much but I
    was getting pretty instant results from the button clicks. You could
    remove some of the eval calls (I think there were 88 of them) where a
    lot of them appear to simply be eval'ing a string to convert it to a
    number. You could also look into some of the functions where you are
    referencing document.formName.elementName.value repeatedly with multiple
    elements. By storing a reference to document.formName you could speed up
    the look up time. In the reportToForm function you have lines like this:

    document.mainform.fh07.value = fixFloat (h07, numPoints) ;

    If, at the beginning of reportToForm you had a statement like this:

    theForm = document.mainform;

    Then you could change your references to this:


    Which would pick up some speed gains.

    After that, there are some other things I noticed in functions like
    hiHarm it appears you are doing some calculations and then calling
    another function. Are the p## variables changing each time you are
    calling that function? If not, move them outside the function and you
    don't have to repeatedly calculate them.
  3. MassiveProng

    MassiveProng Guest

    **** you, asswipe.
  4. Been there, done that.

    The series polynomials are very high order.

    Many thanks,

    Don Lancaster voice phone: (928)428-4073
    Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
    rss: email:

    Please visit my GURU's LAIR web site at

  5. No, the JavaScript execution speed is not the immediate goal.
    But thanks for the tips.

    The present goal is to find a fully deterministic solution to magic
    sinewave angles in a single step, rather than needing as many as five
    repeat (but remarkably fast converging) iterations.

    Using JavaScript exploration to find (or prove not) an underlying algorithm.

    Until recently, there was no reason to even suspect a deterministic
    solution equal to Magic Sinewave angles and Newton's method existed at
    all. 14x14 equations of multiple angle trig polynomials to the 28th
    power would not appear to offer trivial solutions. Chebycheff

    At present, Newton's Method works so extremely well that it strongly
    suggests a determnistic solution can be found. Finding one greatly
    simplifies extension to other numbers of pulses per quadrant.

    And is the "missing link" to a totally solid Magic Sinewave theory.

    Speed can come later. Speed is not an issue when zeroing out a few dozen
    low harmonics. Eventually the system can zero THOUSANDS of harmonics
    leading to a stunningly efficient means of digital sinewave generation.

    Calculation time currently goes up with the third or fourth power of the
    number of harmonics zeroed.

    See for a tutorial and the
    underlying equation set to be solved.

    Many thanks,

    Don Lancaster voice phone: (928)428-4073
    Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
    rss: email:

    Please visit my GURU's LAIR web site at
  6. In comp.lang.javascript message <[email protected]
    com>, Sat, 24 Mar 2007 09:05:21, MassiveProng <[email protected]> posted:
    Feel free to contribute here in if you ever
    have anything useful to say; but not otherwise.
  7. I don't see any code there (a few busted links). What sort of algorithm
    is it that you are trying to converge?

  8. See for a tutorial and the
    underlying 14 x 14 equation set to be deterministically solved.

    Many thanks,

    Don Lancaster voice phone: (928)428-4073
    Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
    rss: email:

    Please visit my GURU's LAIR web site at
  9. MassiveProng

    MassiveProng Guest

    Whatever. We run a huge Oracle system at work, and it has issues
    with the most recent java upgrade.

    It was the first thing that came to mind. Like I said, it was no
    big deal to have suggested it.
  10. 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 ;
    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.
  11. joseph2k

    joseph2k Guest

    Then maybe you want to use russian peasant method for your power series.
  12. -Lost

    -Lost Guest

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day