Results 1 to 7 of 7

Thread: Algebraic expression

  1. #1

    Thread Starter
    Member Ohfoohy's Avatar
    Join Date
    Mar 2009
    Posts
    50

    Algebraic expression

    okay, so, I'm not got at all with coding in VB 08 and I need help!
    I'm was trying to figure out the amount of "charge" my iPod touch can hold from it's original state.
    I used y = Ce^(kt) to model it.

    Here it is:

    ln(%/100)/(ln(4/5)/400)=c

    The variables are % and c

    % = the percent of change you are aiming at multiplied by 100 (i.e 50% = .5*100 = 50, so the percent without the percent sign)

    c = how many charges it will take to reach that capacity percent

    Now with than and simple algebra you can figure out when your battery reach a desired capacity.

    How I got the formula:

    First, things I assumed:

    1. Battery capacity exponentially decreases
    2. Battery capacity goes from 100% to 80% in 400 charges



    OK, here is the math stuff:

    y = Ce^(kt)
    or
    % = Ce^(kc)

    Plug In the info we know

    80 = 100e^(kc)
    80 = 100e^(k400)
    (80/100) = e^(k400)
    ln(80/100) = k400
    (ln(80/100)/400) = k

    again

    % = Ce^(kc)

    % = 100e^((ln(80/100)/400))c
    %/100 = e^((ln(80/100)/400))c
    ln(%/100) = ((ln(80/100)/400))c
    ln(%/100)/(ln(80/100)/400) = c

    80/100 simplifies to 4/5

    ln(%/100)/(ln(4/5)/400)=c



    SOURCES:
    Charge Cycles

    A properly maintained iPod battery is designed to retain up to 80% of its original capacity at 400 full charge and discharge cycles.
    http://www.apple.com/batteries/ipods.html



    ALL HELP APPRECIATED!!!

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Algebraic expression

    Quote Originally Posted by Ohfoohy View Post
    okay, so, I'm not got at all with coding in VB 08 and I need help!

    ALL HELP APPRECIATED!!!
    What kind of help? You haven't told us a thing about what you want done. If your looking for some code to do that it's very simple.

    Code:
            Dim Percentage As Decimal
            Dim Charges As Decimal
            Decimal.TryParse(PercentTextBox.Text, Percentage)
            Charges = Math.Log(Percentage / 100) / (Math.Log(4 / 5) / 400)
            chargeLabel.Text = Charges
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3

    Thread Starter
    Member Ohfoohy's Avatar
    Join Date
    Mar 2009
    Posts
    50

    Re: Algebraic expression

    Thats it?

  4. #4

    Thread Starter
    Member Ohfoohy's Avatar
    Join Date
    Mar 2009
    Posts
    50

    Re: Algebraic expression

    How would I display the answer?

  5. #5
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Algebraic expression

    Quote Originally Posted by Ohfoohy View Post
    How would I display the answer?
    Make a Label named chargeLabel, a TextBox named percentTextBox, and a button named calcButton.

    Double click the calcButton in designer mode to view the Click Event and put that code in. The very last part, chargeLabel.Text = Charges, will display the answer inside the chargeLabel.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  6. #6

    Thread Starter
    Member Ohfoohy's Avatar
    Join Date
    Mar 2009
    Posts
    50

    Re: Algebraic expression

    Just as I suspected! Thanks!

  7. #7
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Algebraic expression

    Quote Originally Posted by Ohfoohy View Post
    Just as I suspected! Thanks!
    No problem, post if you have any more questions about the program.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width