Hello!
is there any way to implement the maximize function to find or search for the max values of a linear fit or in a polynomial graph?
Thanks
When working interactively you might do this with the profiler. Create a column with the formula you want to maximize, then open the profiler, set desirability functions, and then maximize desirability.
Table with formula:
In profiler of y, show desirability functions:
Control+click (in windows) on the desirability function, set it to maximize and give it a range to search:
Adjust the axis settings and then run maximize desirability:
Which does identify the value of X that maximizes Y:
Here is code to recreate the chart:
Names default to here(1); dt = New Table( "WithFormula", Add Rows( 1 ), New Column( "X", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1] ) ), New Column( "Y", Numeric, "Continuous", Format( "Best", 12 ), Formula( 15 - (:X-3) ^ 2 ) ) ); // show the interaction dt << Graph Builder( Size( 533, 456 ), Show Control Panel( 0 ), Variables( X( :X ), Y( :Y ) ), Elements( Formula( X, Y, Legend( 5 ) ) ), SendToReport( Dispatch( {}, "X", ScaleBox, {Format( "Best", 12 ), Min( -5.83914231679298 ), Max( 5.61125768320702 ), Inc( 2 ), Minor Ticks( 0 )} ), Dispatch( {}, "Y", ScaleBox, {Format( "Best", 12 ), Min( -22.4207925102041 ), Max( 16.6726794897959 ), Inc( 10 ), Minor Ticks( 0 )} ) ) ); // Use the profiler with a desirability function to indicate that the Y variable should // be maximized and give a range in which to maximize it prof = dt << Profiler( Y( :Y ), Profiler( 1, Desirability Functions( 1 ), Y << Response Limits( {Lower( -100, 0.066 ), Middle( 0, 0.5 ), Upper( 100, 0.9819 ), Goal( "Maximize" ), Importance( 1 )} ), Term Value( X( 0, Min( -10 ), Max( 10 ), Lock( 0 ), Show( 1 ) ) ) ) ); prof << Maximize Desirability;