<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing an equation in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696391#M53988</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To get user input in python, can use raw_input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
W = raw_input("Enter Weight in kg. --&amp;gt;")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If running within a tool, you would probably need the GetPrameters... and set the parameters in the script itself.&amp;nbsp; Would suggest the help files for info on that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000004000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000004000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:19:04 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2021-12-12T05:19:04Z</dc:date>
    <item>
      <title>Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696388#M53985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to python, and need some help writing an equation into python.&amp;nbsp; The algorithm calculates the energetic costs of human movement over different terrains.&amp;nbsp; I would like to create a script with this where I can allow users to input different values for the various variables.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;M= 1.5W + 2.0(W+L)(L/W)^2+n(W+L)(1.5V^2+0.35VS)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;M= metabolic rate in watts (kilojoules/minute)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;W=the weight of the person in kilograms&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;L=the load carried by the person in kilograms&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;n=value reflecting the terrain&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;V=the speed of waling in m/s&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;S=percentage gradient&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is probably a lot easier than I am making it, but I am also in a time crunch (need it in a week), and as of yet have had no luck figuring it out.&amp;nbsp; I would greatly appreciate any help that I can get . &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ginger&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 15:58:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696388#M53985</guid>
      <dc:creator>VirginiaMoore</dc:creator>
      <dc:date>2013-07-09T15:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696389#M53986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This works, but you will have to check with your numbers to make sure it is working "correctly"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
m = (1.5 * W + 2 * (W + L) * (L / W)**2 + n * (W + L) * (1.5 * V**2 + 0.35 * V * S))
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696389#M53986</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-12T05:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696390#M53987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response.&amp;nbsp; I was also wanting to allow for user input to change the values of the variables.&amp;nbsp; How would I go about doing that?&amp;nbsp; I know that I can create a toolbox that runs the script, but I am not sure how to write it in python.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 18:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696390#M53987</guid>
      <dc:creator>VirginiaMoore</dc:creator>
      <dc:date>2013-07-09T18:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696391#M53988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To get user input in python, can use raw_input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
W = raw_input("Enter Weight in kg. --&amp;gt;")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If running within a tool, you would probably need the GetPrameters... and set the parameters in the script itself.&amp;nbsp; Would suggest the help files for info on that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000004000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000004000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696391#M53988</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-12T05:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696392#M53989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I forgot to mention that I am using this to create a cost surface.&amp;nbsp; Tried just making it into a vertical factor table, but when i run the path distance tool with my table I get an arcSOCP exe. error.&amp;nbsp; So...I was wondering if anyone had any suggestions on how to fix this.&amp;nbsp; I would really like to just program it python where it does the calculations and creates the cost surface all in one go, but I am afraid that is beyond my skill level at this point in time.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Virginia&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 20:33:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696392#M53989</guid>
      <dc:creator>VirginiaMoore</dc:creator>
      <dc:date>2013-07-12T20:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an equation in Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696393#M53990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Believe that error is related to using background geoprocessing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcMap, Geoprocessing menu, un-check Enable on Background Processing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 16:57:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-an-equation-in-python/m-p/696393#M53990</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-07-15T16:57:06Z</dc:date>
    </item>
  </channel>
</rss>

