<?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: Dealing with cycled or recurrent formulas in a table (a.k.a. circular references). in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/411318#M66085</link>
    <description>&lt;P&gt;The function you provided should work as is, without any warnings.&amp;nbsp; If you are in fact referencing column A in the formula for B and column B in the formula for A, then you might try writing that logic as a single formula or follow&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;'s advice and do that with a script instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table with your example formula, this should evaluate without warning or error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Untitled 16",
	Add Rows( 10 ),
	New Column( "X",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( If( Selected() == 1, 1, Row() == 1, 1, Lag( :X ) * 0.99 ) ),
		Set Selected
	),
	Set Row States( [0, 0, 0, 0, 1, 0, 0, 0, 1, 0] )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Aug 2021 17:17:46 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2021-08-19T17:17:46Z</dc:date>
    <item>
      <title>Dealing with cycled or recurrent formulas in a table (a.k.a. circular references).</title>
      <link>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/408314#M65824</link>
      <description>&lt;P&gt;I have a formula that is recurrent.&amp;nbsp;JMP can solve it, but it warns about cycles every time I create a new formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Force a new iteration?&lt;/LI&gt;&lt;LI&gt;Configure the number of iterations (or stopping criteria) to solve the recurrence?&lt;/LI&gt;&lt;LI&gt;Stop the evaluation from happening again? Suppress Eval option in the formula menu, did not work.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function is a bit more complex but not different from the following, which works without complaint.&lt;/P&gt;&lt;P&gt;X (k+1) = 0.99 * X(k)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Selected() == 1, 1,
	Row() == 1, 1,
	Lag( :X ) * 0.99
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:35:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/408314#M65824</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-06-10T23:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with cycled (or recurrent) formulas in a table</title>
      <link>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/410653#M66032</link>
      <description>&lt;P&gt;For reference, Excel offers the following options to deal with circular references.&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.microsoft.com/en-us/office/change-formula-recalculation-iteration-or-precision-in-excel-73fc7dac-91cf-4d36-86e8-67124f6bcce4#:~:text=Iteration%20is%20the%20repeated%20recalculation,is%20called%20a%20circular%20reference" target="_blank"&gt;https://support.microsoft.com/en-us/office/change-formula-recalculation-iteration-or-precision-in-excel-73fc7dac-91cf-4d36-86e8-67124f6bcce4#:~:text=Iteration%20is%20the%20repeated%20recalculation,is%20called%20a%20circular%20reference&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 19:22:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/410653#M66032</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2021-08-17T19:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with cycled (or recurrent) formulas in a table</title>
      <link>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/410727#M66038</link>
      <description>&lt;P&gt;JMP's formula evaluator works by first evaluating formula columns that only depend on non-formula columns, then by evaluating formula columns that depend on formula columns that are already evaluated. If column A's formula depends on column B, and column B's formula depends on column A, JMP can't choose which one to evaluate first. If you manage to trick JMP into creating a circular dependency, you can't be sure which column was using old data from the other column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMP evaluates a column from top to bottom. Within a formula you can use the lag function (or sub-scripting) to look at earlier rows and get the value previously calculated. I'm not sure what happens if you look at future rows, but that value has not been calculated yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are formulas you might think could work based on excel rules, but &lt;LI-MESSAGE title="JMP is Not a Spreadsheet" uid="214307" url="https://community.jmp.com/t5/Discussions/JMP-is-Not-a-Spreadsheet/m-p/214307#U214307" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; and plays by the rules above. If you need to make column A refer to a lag of column B and column B refer to a lag of column A, you should make A and B be non-formula columns and write JSL to fill them in. Add that JSL to a table script with a name like "Run Me When The Data Needs To Be Updated".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a recursive function, you can make a JSL function that calls itself. JSL has a fairly low limit on the allowed depth of recursion, 100 or so. You have to write your own if statement that decides when to stop the recursion. Typically a depth parameter is used to stop the recursion, something like (untested, and pointless...)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = function({depth}, if(depth &amp;lt; 10, /* do something */ f(depth + 1) ) );
f(0)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 00:51:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/410727#M66038</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-08-18T00:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with cycled or recurrent formulas in a table (a.k.a. circular references).</title>
      <link>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/411318#M66085</link>
      <description>&lt;P&gt;The function you provided should work as is, without any warnings.&amp;nbsp; If you are in fact referencing column A in the formula for B and column B in the formula for A, then you might try writing that logic as a single formula or follow&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;'s advice and do that with a script instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table with your example formula, this should evaluate without warning or error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Untitled 16",
	Add Rows( 10 ),
	New Column( "X",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( If( Selected() == 1, 1, Row() == 1, 1, Lag( :X ) * 0.99 ) ),
		Set Selected
	),
	Set Row States( [0, 0, 0, 0, 1, 0, 0, 0, 1, 0] )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:17:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dealing-with-cycled-or-recurrent-formulas-in-a-table-a-k-a/m-p/411318#M66085</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-08-19T17:17:46Z</dc:date>
    </item>
  </channel>
</rss>

