Results 1 to 4 of 4

Thread: How do I code this formula properly

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2009
    Posts
    124

    How do I code this formula properly

    I already know each variable and constantName:  Ams2001glos-Me16.png
Views: 298
Size:  2.8 KB

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I code this formula properly

    Addition in VB is `+`, subtraction is `-`, multiplication is `*` and division is `/`. Exponentiation is `^` and parentheses work exactly how you would expect. That's all that's used in that formula so where exactly is the difficulty? They teach you in primary school how to write formulas like that on a single line so pick up a pen and paper and do exactly that. The VB code will be pretty much exactly the same.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2009
    Posts
    124

    Re: How do I code this formula properly

    This is a college level math formula that calculates the wet adiabatic lapse rate in thermodynamics.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I code this formula properly

    Quote Originally Posted by supercell1970 View Post
    This is a college level math formula that calculates the wet adiabatic lapse rate in thermodynamics.
    It doesn't matter that the formula itself is used in college maths. It still only uses the four fundamental operators (+, -, *, /) as well as exponentiation and parentheses. You might have to be in college to know what it means but, if you've done primary school maths, you can write it out in one line. If you think you can't then you haven't really given it much thought. Let's take just the enumerator of the main fraction. That can be written as:
    Code:
    1 + ((Lv * rv) / (R * T))
    or, with superfluous parentheses removed:
    Code:
    1 + Lv * rv / (R * T)
    Are you really telling me that you have to be in college to do that? The rest is more of the same.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

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