<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Graph Forums — trying to create the inverse of a cubic equation]]></title>
		<link>https://forum.padowan.dk/viewtopic.php?id=714</link>
		<atom:link href="https://forum.padowan.dk/extern.php?action=feed&amp;tid=714&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in trying to create the inverse of a cubic equation.]]></description>
		<lastBuildDate>Sat, 01 Sep 2012 10:33:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: trying to create the inverse of a cubic equation]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=1879#p1879</link>
			<description><![CDATA[<p>Dear webmaster Ivan,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;I am terribly sorry for making you spend so much time&nbsp; on showing the inverse function. That was never my intention. <br />I was simply&nbsp; asking &quot;my maths being weak&quot;&nbsp; could I side step generating the inverse function by simply swapping the x and Y columns?</p><p>Before I enter into detail&nbsp; I must apologize for indiscriminate mixing of e and E. </p><p>As I said above , I was just asking why a set of real points produce&nbsp; &nbsp;a good fit third order equation. <br />But, If we interchange the data points columns making the y column become the x column and making&nbsp; the x column become the y column.&nbsp; <br />Then there is no&nbsp; equation for a good fit...?<br />None of the 6 basic function type offer a good approximation to the data points.</p><br /><p>X&nbsp; &nbsp; Y&nbsp; &nbsp; &nbsp;L&lt;-&gt;R&nbsp; &nbsp;X&nbsp; &nbsp;&nbsp; &nbsp;Y&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />0&nbsp; &nbsp; 1402&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1402&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />5&nbsp; &nbsp; 1426&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1426&nbsp; &nbsp; &nbsp; 5&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />10&nbsp; &nbsp; 1447&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1447&nbsp; &nbsp; &nbsp; 10&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />15&nbsp; &nbsp; 1465&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1465&nbsp; &nbsp; &nbsp; 15&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />20&nbsp; &nbsp; 1482&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1482&nbsp; &nbsp; &nbsp; 20&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />25&nbsp; &nbsp; 1496&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1496&nbsp; &nbsp; &nbsp; 25&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />30&nbsp; &nbsp; 1509&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1509&nbsp; &nbsp; &nbsp; 30&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />35&nbsp; &nbsp; 1519&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1519&nbsp; &nbsp; &nbsp; 35&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />40&nbsp; &nbsp; 1528&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1528&nbsp; &nbsp; &nbsp; 40&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />45&nbsp; &nbsp; 1536&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1536&nbsp; &nbsp; &nbsp; 45&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />50&nbsp; &nbsp; 1543&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1543&nbsp; &nbsp; &nbsp; 50&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />55&nbsp; &nbsp; 1548&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1548&nbsp; &nbsp; &nbsp; 55&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />60&nbsp; &nbsp; 1550&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1550&nbsp; &nbsp; &nbsp; 60&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />65&nbsp; &nbsp; 1553&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1553&nbsp; &nbsp; &nbsp; 65&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />70&nbsp; &nbsp; 1554&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554&nbsp; &nbsp; &nbsp; 70&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />75&nbsp; &nbsp; 1555&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1555&nbsp; &nbsp; &nbsp; 75&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />80&nbsp; &nbsp; 1554&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554&nbsp; &nbsp; &nbsp; 80&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />85&nbsp; &nbsp; 1552&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1552&nbsp; &nbsp; &nbsp; 85&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />90&nbsp; &nbsp; 1550&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1550&nbsp; &nbsp; &nbsp; 90&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />95&nbsp; &nbsp; 1547&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1547&nbsp; &nbsp; &nbsp; 95&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <br />100&nbsp; &nbsp; 1543&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1543&nbsp; &nbsp; &nbsp; 100</p><p>So using these two sets of data points, now free from my E = e error&nbsp; &nbsp;</p><p>As before ( two left hand data points&nbsp; columns ) produce a very good fit cubic equation. <br /> So good that my confidence level is very high to be able to&nbsp; use the&nbsp; cubic equation to get a good accuracy speed of sound at any temperature&nbsp; in the 0 -&nbsp; 100ºC range.</p><br /><p>I can also, using the two Right hand&nbsp; data points columns,&nbsp; get a curve which doubles back on itself. </p><p>As webmaster Ivan demonstrated in Fred.grf this curve can be synthesised using three&nbsp; sub-curves joining at the appropriate coordinates.</p><p>Chapeau&nbsp; &nbsp;Ivan.</p><p>From the programming point of view&nbsp; my mind boggles or as you neatly summed&nbsp; up....</p><p>&quot;Yes, this gets very complicated. It may be possible to simplify it, but I have not found out how.&quot;</p><p>Well&nbsp; after looking at&nbsp; the available literature such as wikipedia where they list&nbsp; attempts to solve from Babylonia&nbsp; <br />through Arab times and up to&nbsp; the renaissance Italians and Descartes, they had fun. <br />Today it looks as if for a simple program using the listed steps it is no-no.</p><p>Getting back to making the inverse function by swapping the x and&nbsp; y columns, I just note the dots double back on <br />themselves offering two temperatures for a given speed</p><p>I personally&nbsp; being of a cowardly nature (lazy? ) avoid this by&nbsp; interpolating the temperature from two know points&nbsp; of&nbsp; speed value.&nbsp; &nbsp;<br />Much quicker and&nbsp; hugely less number crunching.</p><p>From all of the above&nbsp; &nbsp;the answers to my two original questions are:-</p><p>a) this is not possible? ....... well yes but for the average mortal no !<br />b) I did this wrong ?&nbsp; ........ yes definitely</p><p> So dear webmaster my humble apologies for&nbsp; having put you to such creative effort and using so much time.</p><p>I will drop out of the thread.... but maybe a Pandoras box has been opened. Who knows?</p><p>Bye and many thanks<br />Fred<br />Madrid</p>]]></description>
			<author><![CDATA[null@example.com (fredfmah)]]></author>
			<pubDate>Sat, 01 Sep 2012 10:33:23 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=1879#p1879</guid>
		</item>
		<item>
			<title><![CDATA[Re: trying to create the inverse of a cubic equation]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=1877#p1877</link>
			<description><![CDATA[<p>You say Graph gives gives you the function f(x) = 1.2708e-6*x^3 - 5.0e-4*x^2 + 0.0482*x +14.0276, but that doesn&#039;t fit your points. Graph gives me the function f(x)=0.000127*x^3-0.046855*x^2+4.821215*x+1402.761999. Anyway I just want to point out that Graph interprets <em>e</em> in lower case as Euler&#039;s constant while <em>E</em> in capital is used for exponential notation. </p><p>But I think your real problem is that you assume the inverse of a third order polynomial is also a third order polynomial, and that is wrong. </p><p>If you have the generic function y=a*x^3+b*x^2+c*x+d the inverse is actually three functions:<br /></p><div class="codebox"><pre><code>x=(-(sqrt(3)*i)/2-1/2)*(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3)-(((sqrt(3)*i)/2-1/2)*(3*a*c-b^2))/(9*a^2*(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3))-b/(3*a)

x=((sqrt(3)*i)/2-1/2)*(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3)-((-(sqrt(3)*i)/2-1/2)*(3*a*c-b^2))/(9*a^2*(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3))-b/(3*a)

x=(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3)-(3*a*c-b^2)/(9*a^2*(sqrt(27*a^2*y^2+(-54*a^2*d+18*a*b*c-4*b^3)*y+27*a^2*d^2+(4*b^3-18*a*b*c)*d+4*a*c^3-b^2*c^2)/(6*sqrt(3)*a^2)-(a^2*(27*d-27*y)-9*a*b*c+2*b^3)/(54*a^3))^(1/3))-b/(3*a)</code></pre></div><p>Yes, this gets very complicated. It may be possible to simplify it, but I have not found out how.</p><p>I have attached a grf file that plots the functions. I use custom constants to specify a, b, c and d, so you can easily change the values for the original polynomial. Notice that <em>Calculate with complex numbers</em> in the <em>Edit|Axes</em> dialog must be checked.</p>]]></description>
			<author><![CDATA[null@example.com (Ivan Johansen)]]></author>
			<pubDate>Sat, 01 Sep 2012 00:44:32 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=1877#p1877</guid>
		</item>
		<item>
			<title><![CDATA[trying to create the inverse of a cubic equation]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=1872#p1872</link>
			<description><![CDATA[<p>Dear Gurus, in the past every thing about graph that I used was just about perfect.</p><p>This is&nbsp; the first time&nbsp; that&nbsp; &nbsp;I actually&nbsp; have to use cubic equations generated by my input data points.</p><p>The matching equation graph&nbsp; is very good.</p><p>I realised that&nbsp; I need to have&nbsp; &nbsp;the equation with Y as the&nbsp; variable, meaning I needed the inverse function of a cubic equation.</p><p>But here my maths are too poor. However I thought that using my original&nbsp; datapoints to create&nbsp; the new equation should side step the problem.</p><p>But when I swap the same&nbsp; x data with the y data....</p><p>The new cubic equation&nbsp; to my surprise&nbsp; &nbsp; has very poor&nbsp; accuracy&nbsp; .</p><p>I have pack the good cubic with graph and the bad cubic with graph in the&nbsp; attached pdf</p><p>I would be most greatfull if someone can point out <br />a) this is not possible<br />b) I did this wrong</p><p>Bye and thanks<br />Fred</p>]]></description>
			<author><![CDATA[null@example.com (fredfmah)]]></author>
			<pubDate>Thu, 30 Aug 2012 14:00:28 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=1872#p1872</guid>
		</item>
	</channel>
</rss>
