Javascript EA - calculate log() base 10?


I am writing an algorithm to calculate the value and the graduations on the y-axis of a dynamic chart.

For the calculation, the cleanest way, I need to be able to calculate a log() with a base of 10.

JavaScript has a logarithmic base-10 - Math.log10 - function as a constant - Math.LN10 - and to open a session can be calculated for any base - Math.log (number, base). Unfortunately, none of them seem to work in version Edge lead CC of javascript.

Can someone tell me how to get the log of a number in base 10 on board animate CC?

TIA,

Carolyn

You should have regular access to all javascript mathematical functions on the edge. I tried the ones you mention and they return the correct values. Outside Math.log (number, base) which I have never seen elsewhere. The following should work as well:

function getBaseLog (num, base) {}

return Math.log (y) / Math.log (x);

}

Math.log - JavaScript | DND

There may be another error in your code - what results you get if you write in the console?

Tags: Edge Animate

Similar Questions

  • Series R FPGA, calculate log base 10 number > = 1

    Hi all

    I'm stuck on a problem with the calculation of a log base 10 of a number greater than 1.  It seems that natural logarithm in the high throughput math library is limited to the range of 1/1.  There must be others who need to work outside this range - how do we?

    Thank you

    George

    Hey gharris,.

    The only way I know to do this is through lookup tables.

    You want to probably use BlockRAM and use VI initialization, as described here. You also have a table of logarithms, which covers the range that you expect to encounter. For values outside of your table, you'll need to interpolate.

    To get this right for your application may take a bit of tweaking, especially if you have a tight deadline or a need for high precision.

  • Calculation of log base 2 of 35 s new

    I would like to calculate the necessary resolution for an ADC with analog input will accept a +/-10V swing with a background noise of 0.4mV. The counties of RMS are 20.0V/0.0004V = 50 000 points - just easy. To set the 50 000 RMS number of bits is: bits = log2 (50,000). How can I make my new imagination 35 s to calculate log base 2 of 50 000? Help is appreciated - thanks.

    Hello

    To calculate LOG2(A) use LOG (A) / log (2) or LN (A) /LN (2).

    Here is a program to do this (run in RPN mode):

    To use, type number and XEQ, then, ENTERED.

    HTH

  • JavaScript to calculate a field value

    Hello world

    I'm trying to write a small javascript to calculate a value in field based on another field value, similar to Denes Kubicek example on the next page:

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:71:3928458344147956:no

    My model is:

    Champ_1 (source of calculation). Champ_2 (calculated value)

    The calculation is as follows:

    Champ_1 X 2 = Champ_2

    Of course, I'm a newbie to JavaScript, but I need help.

    Thanks in advance for your advice!

    Charles

    Hello Charles,

    Depending on the number you use you must don't like Dene fact (use of tank and getVal Parse).
    But that would be a very simple example: $x.value ('P1_FIELD2') = $v ('P1_FIELD1') * 2;

    Kind regards
    Dimitri
    ----------------------------------
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    AWARDS: Don't forget to mark correct or helpful messages on the forum

  • JavaScript to calculate the DEPOSITS REGULAR CALCULATOR

    Looking for a JavaScript calculator that calculates compound interest results with a base amount, annual interest rate (which allows the user to calculate monthly or annually), set the period of calculation, regular monthly deposit and interest rates. The user would have the opportunity to increase the annual deposits with Inflation and change compound monthly or annual interval.

    That is to say

    Basic amount: $30,000

    Annual interest rate: 3%

    Calculation period: 10 years

    Regular monthly deposit: $200

    Inflation rate: 3%

    Increase deposits annually with Inflation or not

    Compound interval monthly or annual

    JavaScript is a computer language, so we write their own code to perform a specific task. You will need to provide more information such as field names, preparation time, etc..

  • PDF Acroform Javascript (WIN): Calculate the Date of next Tuesday

    03/06/10

    Greetings;

    I found a javascript script that will calculate the date of next Tuesday, but I can't seem to make it work in Acrobat Pro v8 (Acroforms).

    Any help / guidance you can provide is appreciated the most.

    Script:

    http://Christian.lassem.com/js/JavaScript-next-Tuesday/

    JavaScript to find next Tuesday?


    function find_date_of_next_tuesday() {}
    var today = new Date();
    today.setDate (today.getDate () + 1);
    While (today.getDay ()! = 2) {}
    today.setDate (today.getDate () + 1);
    }
    return (today.toDateString ());
    }

    Thanks in advance.

    You just need to call this function, and then use the string that it returns. What

    does not work, exactly?

  • JavaScript to calculate the average of a column

    I have my PDF file I'm trying to calculate the average in a column of fields.

    My problem is that there are 7 areas, but all 7 can be omitted, so I think I need some sort of statement 'if' that would only count the number of fields containing values.  Then, somehow working in the rest of my calculation...

    That's what I have so far...

    (function () {}

    Get all the field values, as numbers
    var v1 = + getField("column.0").value;
    var v2 = + getField("column.1").value;

    var v3 = + getField("column.2").value;

    var v4 = + getField("column.3").value;

    V5 var = + getField("column.4").value;

    var V6 = + getField("column.5").value;

    v7 var = + getField("column.6").value;

    var V8 = + getField("column.7").value;

    Calculate the result and the value of this field
    Event.Value = (v1 + v2 + v3 + v4 + v5 + v6 + v7) / the number of fields that have been filled;

    })();

    I'm pretty new to javascript. Any help would be greatly appreciated! Thank you

    First of all, I woul write this function withou field reference to make it more universal, and then I have a funcion of document level so it could be used more than once in a PDF document and easily put into another PDF file.

    function Avg() {}
    average computer of the last non-empty field names
    var sum = 0; sum of the fields
    var number = 0; meter for non-empty fields
    for (i = 0; i< arguments.length;="" i++)="">
    iField var = arguments [i]; get the element of arguments passed
    var fField = this.getField(arguments[i]).value;
    If (!) isNaN (fField)))) {}
    field is a number
    If (fField.ToString ()! = ") {}
    field is not null or empty
    sum += Number (fField); Add to the sum
    Count ++; County of increment
    } / / do not blank end
    } / / end of number
    } / / end of loop iterative arguments
    If (count! = 0) {}
    calculate the average if there is one or more items on average
    to return the sum / count; Returns the average
    } else {}
    return ";
    } / / no end no average calculated
    } / / end of function Avg

    Your custom calculation script would then become:

    Event.Value = Avg ("column. 0', 'column.1', 'column.2', 'column.3', 'column.4', 'column.5', 'column.6', 'column.7');

  • The use of Javascript to calculate monthly payments on form

    I have a form one page where I want to be able to allow the user to choose between making a time payment or monthly payments for an amount defined by the user. I could easily penetrate the shape of two pages and calculate the value of monthly payments and post it on the second page, if the user has selected the monthly payment option. What I would like is a single page where the monthly payment is determined on the fly when the user selects the box of monthly payment option or the user defined amount is entered.

    I think I have the function determined to do the calculation for the monthly payment, but I'm not sure how to get CF to read or display the value. I tried to use the following with no luck:

    < input type = radio name = value of payments = "Yes" tabindex = 1 onClick = "calculatemonthlypayment (return [0].). DonationAmount) ">"

    < script type = "text/javascript" >
    function calculatemonthlypayment (donation)
    {
    monthlypayment =(donation/12)
    }
    return monthlypayment
    < /script >

    You try the result like this:

    < cfoutput > < input type = "text" readonly = "yes" value = "#dollarformat (monthlypayment) #" > < / cfoutput >

    No idea I'm doing wrong or missing? Or is there a better way to do this?

    >

    You can't do that. CF code runs on the server (the first). The javascript that results (html, css,...) is sent to the browser where it is running. Given that the javascript code is executed in the client browser, after the CF code is already completed, the variable "monthlypayment" does not exist that CF is concerned.

    You can use javascript to read the amount of the donation text field and calculate the amount of "monthlypayment" to display. Here's a simple example. You will need to add validation and formatting number.

  • Series LOG (base 10)

    Hi all

    I'm embarrassed to ask this, but I know not all math, I used to know.  I want to create a series of N points of X to Y, with an increase of NEWSPAPER, and Yes, I implement it in LabVIEW (7.1, please post a picture instead of a VI if you want to see an example).  I started with LOG(Y/X)/n and adding tried various additions, multiplications, etc. but I can't understand this.  Would be it someone please let me know the correct calculation?  Thank you!

    Michael Tracy

    Synergy microwave

  • vmware var log base file

    Hello

    Trying to do a cleaning on our box ESX3.  There are a lot of old log files accumulate so we removed most of them.  Can someone explain the "core" file/s in/var/log/vmware /?  There are much more like core.1234, core.8793 etc and we are not really sure what they are since then, except that they were 2007 unlike the one below;

    # ls - lh, / var/log/vmware

    total of 206 M

    -rw - 1 root root 163M 13 April 2009 core

    service console core dumps unannounced? You can remove...

    Duncan

    VMware communities user moderator | VCP | VCDX

    -

  • calculate the base on a mc on a mc

    Hey people,

    I have a running total. When a mc hits the table or hand it will adjust the total. The problem is that I want only the total in order to take into account when an object is placed on the mc of the hand. If I remove something from him, delete its value altogether. Now to be smart I have add when a mc hits the hand and remove a value if a mc hits the table. The problem, if I never touch the hand and continue to drop the mcs on the table, I get a negative value. Is there a way to calculate a total only when a mc is based on the mc of the hand and remove the appropriate otherwise value on that?

    This error does not seem to relate to your metering code.  It indicates that a function you have expects an argument to be passed to it, and no argument is passed.  Go to your publication settings and select the option to enable debugging.  The messade of error can then include the line number where the problem arises.

  • Apply the condition on the page to allow access if Javascript is enabled

    Hi, is there a way I can put a condition on the page to allow access allow access only if java script is enabled?

    I have a heavy use of Javascript to calculate different values in a page and want to ensure that if Javascript is not enabled in the browser they do not get to use the page.

    Using Apex 4.1.1

    See you soon.

    Xrc xarg wrote:
    Hi, is there a way I can put a condition on the page to allow access allow access only if java script is enabled?

    I have a heavy use of Javascript to calculate different values in a page and want to ensure that if Javascript is not enabled in the browser they do not get to use the page.

    APEX is JavaScript-dependent, it is unlikely that users will even be able to log in and access this page, unless you already take steps throughout the application to allow it to work with JS disabled.

    Also note that for security reasons all depends on the JS in the browser must be verified on the server when the page is sent.

  • SQL and Log!

    Hi all
    I am facing problem in the calculation of LOG base 2 for 0.33

    I used this
     
    select log(0.33,2) from dual;
    the results that showe me is
    -0.62521
    but the correct answer is
    -1.58
    y at - it an idea.

    Thank you very much
    Isabelle

    Hi, Isabelle,

    Isabelle wrote:
    Hi all
    I am facing problem in the calculation of LOG base 2 for 0.33

    Whenever you have a problem with a built-in function, check the Manual of the SQL language to know if you uisng it correctly. I find certain features not intuitive.

    I used this

    
    select log(0.33,2) from dual;
    

    The first argument of JOURNAL is the basis. I think you have the opposite arguments.

    the results that showe me is

    -0.62521
    

    but the correct answer is

    -1.58
    

    Do you mean - 1.5994621...? (Remember,.33 is not quite equal to 1/3).

    y at - it an idea.

    Try

    LOG (2, .33)
    

    or

    LOG (2, 1/3)
    
  • Generate the log file for the dialog box

    Hi all


    I'm generating information for the dialog box as a .txt log file format. That means that if the box is checked, the log file will be give ' checkbox1 - 01.»   Check the report, sizes against the information on tickets and slug jobs"is checked


    If the checkbox is not checked, the log file will be give ' checkbox1 - 01.»   Check the report, sizes against ticket and slug information on employment"is not checked


    and also the entry "myText2" also needs to generate the log file


    Can someone help on this... Help would be appreciated!



    var l is new window ('dialogue');.

    myGroup1 var = w.add ("panel", undefined, ' P & & G check the list ');

    myGroup1.alignChildren = 'left ';

    CheckBox1 var = myGroup1.add ("checkbox", not defined, '01.   (Check the ratio, size against the information on tickets and slug jobs");

    CheckBox2 var = myGroup1.add ("checkbox", not defined, '02.   "" "Check images are linked");

    var checkbox3 = myGroup1.add ("checkbox", not defined, '03.   Visually check the progress of KV/model/CP images");

    var checkbox4 = myGroup1.add ("checkbox", not defined, '04.   Visually check the progress of other elements such as Logo and bottle");

    var checkbox5 = myGroup1.add ("checkbox", not defined, '05.   Check the positioning of the markup language");

    var checkbox6 = myGroup1.add ("checkbox", not defined, '06.   Ensure that all measures are calculated Live based area");

    var checkbox7 = myGroup1.add ("checkbox", not defined, '07.   After that the resizing of the picture KV frame open to cut and bleed");

    var checkbox8 = myGroup1.add ("checkbox", not defined, '08.   Complete Magenta if there is insufficient image');

    var checkbox9 = myGroup1.add ("checkbox", not defined, '09.   ("To ensure that the document's bleed, crop gutter and slug information brands ');

    var checkbox10 = myGroup1.add ("checkbox", not defined, '10.   Make sure that the final work is updated on the server");

    var checkbox11 = myGroup1.add ("checkbox", not defined, '11.   ("Enter time cmd");

    var myGroup2 = w.add ('panel', undefined, 'The operator name');

    var myText2 = myGroup2.add ("edittext", undefined, "");

    myText2.characters = 25;

    myGroup2.orientation = 'left ';

    var buttons = w.add ("group");

    Buttons.Add ('button', undefined, 'Export to PDF', {name: 'ok'});

    Buttons.Add ('button', undefined, 'Cancel');

    w.Show ();

    ~ group();

    ~ If (myGroup1.alignChildren.value! = true) {}

    ~ alert ('yes')

    //~ }


    myDoc = app.activeDocument;

    w = [];


    DESCRIPTION: Make a TXT file

    myDoc = app.activeDocument;

    Log1 = makeLogFile (app.activeDocument.name.split('.') ([0], myDoc, true);

    log (log1, app.activeDocument.name);

    ~ log2 = makeLogFile ("test", myDoc, false);

    ~ Journal (log2, "Text file log base 2");

    Log1. Execute();

    ~ log2.execute ();

    function makeLogFile (aName, aDoc, deleteIt) {}

    var logLoc; path to the folder that will contain the log file

    try {}

    logLoc = aDoc.filePath;

    } catch (e) {}

    logLoc = getmyDoc (). parent.fsName

    }

    var queue = aFile (logLoc + "/" + name + ".txt");

    If {(deleteIt)

    aFile.remove ();

    return aFile;

    }

    var n = 1;

    so that {(aFile.exists)

    aFile = File (logLoc + "/" + String (n) + ".txt" aName);

    n ++

    }

    return aFile

    }

    function getScriptPath() {}

    try {}

    Return app.activeScript;

    } catch (e) {}

    Return File (e.fileName);

    }

    }

    function log (aFile, message) {}

    var today = new Date();

    If (! aFile.exists) {}

    do the new log file

    aFile.open ("w");

    aFile.write (String (today) + "\n");

    aFile.close ();

    }

    }

    function log (aFile, message) {}

    var text = o;

    If (! aFile.exists) {}

    do the new log file

    aFile.open ("w");

    aFile.write (message + "\n" + "\n" + String (w) + "\n");

    aFile.close ();

    }

    ~ aFile.open ("e");

    ~ aFile.seek (0.2);

    ~ aFile.write ("\n" + message);

    ~ aFile.close ();

    }

    myDoc.close (SaveOptions.no);

    Thanks in advance

    Steve

    Hi Steve,.

    There are some errors in your code.

    1. function 'getmyDoc' is used, but not created.
    2. fucntion 'getScriptPath' is created but not used. (In any case, this will not give you error)
    3. function 'journal' has defined two times with the same length of the parameter.

    etc...

    Here, I have modified your code. Try this.

    var w = new Window ("dialog");
    var myGroup1 = w.add('panel', undefined, 'P&&G Check List');
    myGroup1.alignChildren = "left";
    var checkbox1 = myGroup1.add ("checkbox", undefined, "  01.  Check the ratio, sizes against job ticket and slug information");
    var checkbox2 = myGroup1.add ("checkbox", undefined, "  02.  Check images are linked");
    var checkbox3 = myGroup1.add ("checkbox", undefined, "  03.  Visually check the progression of KV/Model/CP images");
    var checkbox4 = myGroup1.add ("checkbox", undefined, "  04.  Visually check the progression of other elements like Logo and Bottle");
    var checkbox5 = myGroup1.add ("checkbox", undefined, "  05.  Check the placement of Language Tagging");
    var checkbox6 = myGroup1.add ("checkbox", undefined, "  06.  Ensure that all measurements are calculated based on Live area");
    var checkbox7 = myGroup1.add ("checkbox", undefined, "  07.  After resizing the KV image frame opened up to trim and bleed");
    var checkbox8 = myGroup1.add ("checkbox", undefined, "  08.  Fill Magenta if there is inadequate image");
    var checkbox9 = myGroup1.add ("checkbox", undefined, "  09.  Ensure the document has bleed, crop marks, gutter marks and slug information");
    var checkbox10 = myGroup1.add ("checkbox", undefined, "  10.  Ensure the final artwork is updated in the Server");
    var checkbox11 = myGroup1.add ("checkbox", undefined, "  11.  Enter time in CMD");
    var myGroup2 = w.add('panel', undefined, ' Operator Name');
    var myText2 = myGroup2.add("edittext", undefined, "");
    myText2.characters = 25;
    myGroup2.orientation = "left";
    var buttons = w.add ("group");
    buttons.add ("button", undefined, "Export PDF", {name: "ok"});
    buttons.add ("button", undefined, "Cancel");
    w.show ();
    myDoc = app.activeDocument;
    log1 = makeLogFile(app.activeDocument.name.split('.')[0], myDoc, true);
    log(log1, app.activeDocument.name);
    log1.execute();
    function makeLogFile(aName, aDoc, deleteIt)
    {
        var logLoc = "";
        try
        {
            logLoc = aDoc.filePath;
            } catch (e) {}
        var aFile = File(logLoc + "/" + aName + ".txt");
        var n = 1;
        while (aFile.exists)
        {
            aFile = File(logLoc + "/" + aName + String(n) + ".txt");
            n++;
            }
        return aFile
        }
    function log(aFile, message)
    {
        var text = w;
        var rep = "";
        if (!aFile.exists)
        {
            aFile.open("w");
            var today = new Date();
            rep += String(today) + "\n";
            rep += message + "\n" + "\n\n";
            for(var i =0;i
    

    Kind regards

    Cognet

  • using toFixed in javascript in a table

    Hi all

    I have a tabular presentation in a javascript on a column calculation.
    Column 9 = column 5 * column 7 
    See below (onchange) javascript code:
    <script language="JavaScript" type="text/javascript">
    <!--
    function calcit(pThis)
    {
    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
    
    document.getElementById('f09_'+vRow).value = document.getElementById('f05_'+vRow).value* document.getElementById('f07_'+vRow).value;
    
    
    }
    //-->
    </script>
    The columns are number 5,234.10 format

    Now, users have the abbilty to enter number like 5,234.10455 etc.
    The calculation is then made out based on what the user has entered.
    But I want the calculation is made according to 2 decimal places (as the specified number format).

    I read that this can be done with toFixed.
    Where in my code should I put the toFixed?
    I tried to put it like this document.getElementById('f07_'+vRow).value.toFixed (2), but then my javascript calculation calculates is no longer.

    I could really grateful for the help on this.

    Thank you
    Diana

    Edited by: dianap 10 August 2012 08:06

    Hello

    Try to use: parseFloat (document.getElementById('f07_'+vRow).value) .toFixed (2)

    Erick

Maybe you are looking for