Maker Pro
Maker Pro

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

R

Robert Baer

Jan 1, 1970
0
Don said:
Many thanks to everyone. Using (form) rather than (this.form) did it.

Presently exploring how to get this code to converge faster.
Preferably instantly.
Any suggestions?

Latest working version is http://www.tinaja.com/demo28a.asp
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
(1+error)?
 
R

Randy Webb

Jan 1, 1970
0
Don Lancaster said the following on 3/25/2007 12:21 AM:

Presently exploring how to get this code to converge faster.

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:

theForm.fh07.value

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.
 
D

Don Lancaster

Jan 1, 1970
0
Robert said:
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
(1+error)?

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: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
D

Don Lancaster

Jan 1, 1970
0
Randy said:
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:

theForm.fh07.value

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.


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
notwithstanding.

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 http://www.tinaja.com/glib/msinexec.pdf 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: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
D

Dr J R Stockton

Jan 1, 1970
0
In comp.lang.javascript message <f0ja03d5kr35qjqll27vev1a84pponfdi4@4ax.
com>, Sat, 24 Mar 2007 09:05:21, MassiveProng <MassiveProng@thebaratthee
ndoftheuniverse.org> posted:
Depends on what version of java you have, and what you are developing
scripts under, and their co-compatibilities.

Feel free to contribute here in if you ever
have anything useful to say; but not otherwise.
 
P

Paul Hovnanian P.E.

Jan 1, 1970
0
Don said:
Many thanks to everyone. Using (form) rather than (this.form) did it.

Presently exploring how to get this code to converge faster.
Preferably instantly.
Any suggestions?

Latest working version is http://www.tinaja.com/demo28a.asp

I don't see any code there (a few busted links). What sort of algorithm
is it that you are trying to converge?
 
D

Don Lancaster

Jan 1, 1970
0
Paul said:
I don't see any code there (a few busted links). What sort of algorithm
is it that you are trying to converge?


See http://www.tinaja.com/glib/msinexec.pdf 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: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
M

MassiveProng

Jan 1, 1970
0
Feel free to contribute here in if you ever
have anything useful to say; but not otherwise.

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.
 
D

Dr J R Stockton

Jan 1, 1970
0
In comp.lang.javascript message said:
Presently exploring how to get this code to converge faster.
Preferably instantly.
Any suggestions?

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
<http://www.tinaja.com/glib/msinexec.pdf>.

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.
 
J

joseph2k

Jan 1, 1970
0
Don said:
Been there, done that.

The series polynomials are very high order.
Then maybe you want to use russian peasant method for your power series.
 
Top