<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Function from numbers</title>
    <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 01:35:38 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 01:35:38 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Function from numbers</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Function from numbers</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers</link>
    </image>
    <item>
      <title>ArrayInterpolation</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#answer130438</link>
      <itunes:summary>&lt;p&gt;Using a 2-d variant of &lt;a href="http://www.mapleprimes.com/posts/119554-Data-Interpolation"&gt;this&lt;/a&gt; post, you can construct a procedure that will take a scalar and return the interpolated value.&lt;/p&gt;
&lt;pre&gt;restart:

# independent data
indep := Vector([260., 270., 280., 290., 300., 310., 320., 330., 340., 350., 360.]):

# number of independent data points
numindeppts := LinearAlgebra:-Dimension(indep):

# some made up dependent data
dep := Vector(numindeppts, (i)-&amp;gt;evalf(sin(indep[i]^2)), datatype=float[8]):

# procedure which interpolates the data, on the fly
B := (a) -&amp;gt; CurveFitting:-ArrayInterpolation(
                               indep, Array(dep),
                               Array(1..1, 1..1, [[a]]),
                               'method' = 'spline')[1]:

ptsplot:=plots:-pointplot(Matrix(11,2,[[indep,dep]])):

plots:-display(plot(B,min(indep)..max(indep)),ptsplot);
&lt;/pre&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=130438/430152/interp2d.gif"&gt;&lt;img src="/view.aspx?sf=130438/430152/interp2d.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Using a 2-d variant of &lt;a href="http://www.mapleprimes.com/posts/119554-Data-Interpolation"&gt;this&lt;/a&gt; post, you can construct a procedure that will take a scalar and return the interpolated value.&lt;/p&gt;
&lt;pre&gt;restart:

# independent data
indep := Vector([260., 270., 280., 290., 300., 310., 320., 330., 340., 350., 360.]):

# number of independent data points
numindeppts := LinearAlgebra:-Dimension(indep):

# some made up dependent data
dep := Vector(numindeppts, (i)-&amp;gt;evalf(sin(indep[i]^2)), datatype=float[8]):

# procedure which interpolates the data, on the fly
B := (a) -&amp;gt; CurveFitting:-ArrayInterpolation(
                               indep, Array(dep),
                               Array(1..1, 1..1, [[a]]),
                               'method' = 'spline')[1]:

ptsplot:=plots:-pointplot(Matrix(11,2,[[indep,dep]])):

plots:-display(plot(B,min(indep)..max(indep)),ptsplot);
&lt;/pre&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=130438/430152/interp2d.gif"&gt;&lt;img src="/view.aspx?sf=130438/430152/interp2d.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <guid>130438</guid>
      <pubDate>Tue, 07 Feb 2012 22:25:12 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>Output option.</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#answer130439</link>
      <itunes:summary>&lt;p&gt;You might find useful the &lt;strong&gt;output&lt;/strong&gt; option of the &lt;em&gt;dsolve&lt;/em&gt; command. Setting &lt;strong&gt;'output'= piecewise&lt;/strong&gt; could be what you're looking for.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;You might find useful the &lt;strong&gt;output&lt;/strong&gt; option of the &lt;em&gt;dsolve&lt;/em&gt; command. Setting &lt;strong&gt;'output'= piecewise&lt;/strong&gt; could be what you're looking for.&lt;/p&gt;</description>
      <guid>130439</guid>
      <pubDate>Tue, 07 Feb 2012 22:34:03 Z</pubDate>
      <itunes:author>Jarekkk</itunes:author>
      <author>Jarekkk</author>
    </item>
    <item>
      <title>Exactly!</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#comment130463</link>
      <itunes:summary>&lt;p&gt;Thanks a lot, this is exactly what I have been looking for&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks a lot, this is exactly what I have been looking for&lt;/p&gt;</description>
      <guid>130463</guid>
      <pubDate>Wed, 08 Feb 2012 14:49:03 Z</pubDate>
      <itunes:author>ABond</itunes:author>
      <author>ABond</author>
    </item>
    <item>
      <title>nice</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#comment130481</link>
      <itunes:summary>&lt;p&gt;Good point!&lt;/p&gt;
&lt;p&gt;The attached worksheet has a comparison of two techniques. I was worried that doing many evaluations of a large piecewise would be relatively expensive. But the initial dsolve/numeric calculation take the bulk of the time.&lt;/p&gt;
&lt;p&gt;I'm only do plots because I wanted to show timing for doing many subsequent computations using the results. It's not supposed to be seen as an alternative to DEplot or odeplot.&lt;/p&gt;
&lt;p&gt;The output=piecewise is just easier to use. And there's not need to try and guess what kind of resolution is needed, unlike for the output=Array approach. (Presumably, the level of detail in the piecewise comes from dsolve/numeric's own cleverness about choosing step-sizes adaptively, and then forming piecewise interpolating polynomials.)&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=130481/430219/dscomp.mw"&gt;dscomp.mw&lt;/a&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Good point!&lt;/p&gt;
&lt;p&gt;The attached worksheet has a comparison of two techniques. I was worried that doing many evaluations of a large piecewise would be relatively expensive. But the initial dsolve/numeric calculation take the bulk of the time.&lt;/p&gt;
&lt;p&gt;I'm only do plots because I wanted to show timing for doing many subsequent computations using the results. It's not supposed to be seen as an alternative to DEplot or odeplot.&lt;/p&gt;
&lt;p&gt;The output=piecewise is just easier to use. And there's not need to try and guess what kind of resolution is needed, unlike for the output=Array approach. (Presumably, the level of detail in the piecewise comes from dsolve/numeric's own cleverness about choosing step-sizes adaptively, and then forming piecewise interpolating polynomials.)&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=130481/430219/dscomp.mw"&gt;dscomp.mw&lt;/a&gt;&lt;/p&gt;</description>
      <guid>130481</guid>
      <pubDate>Wed, 08 Feb 2012 20:12:09 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>@pagan Right;
However both variants do not</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#comment130658</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130437-Function-From-Numbers#comment130481"&gt;@pagan&lt;/a&gt; Right;&lt;/p&gt;
&lt;p&gt;However both variants do not solve my problem, since I need the analytical form of the function explictly as function of time.&lt;/p&gt;
&lt;p&gt;To this end the piecewise option is better, but since I use this function in further computatios this does not help either.&lt;/p&gt;
&lt;p&gt;I think I should proceed with polynomila interpolation of a solution structure given as an Array.&lt;/p&gt;
&lt;p&gt;Hopefully this will give me some polynomial and not piecewise function, which may be then will be simpler...&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130437-Function-From-Numbers#comment130481"&gt;@pagan&lt;/a&gt; Right;&lt;/p&gt;
&lt;p&gt;However both variants do not solve my problem, since I need the analytical form of the function explictly as function of time.&lt;/p&gt;
&lt;p&gt;To this end the piecewise option is better, but since I use this function in further computatios this does not help either.&lt;/p&gt;
&lt;p&gt;I think I should proceed with polynomila interpolation of a solution structure given as an Array.&lt;/p&gt;
&lt;p&gt;Hopefully this will give me some polynomial and not piecewise function, which may be then will be simpler...&lt;/p&gt;</description>
      <guid>130658</guid>
      <pubDate>Tue, 14 Feb 2012 14:54:39 Z</pubDate>
      <itunes:author>ABond</itunes:author>
      <author>ABond</author>
    </item>
    <item>
      <title>order</title>
      <link>http://www.mapleprimes.com/questions/130437-Function-From-Numbers?ref=Feed:MaplePrimes:Function from numbers:Comments#comment130668</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130437-Function-From-Numbers#comment130658"&gt;@ABond&lt;/a&gt;&amp;nbsp;Obtaining a single polynomial is not necessary for doing mosts sorts of further computation. And for many data points it would likely be either a poor approximation low order polynomial, or a high order polynomial that fits the many points by has far too many qualitatively unwanted inflections.&lt;/p&gt;
&lt;p&gt;The piecewise polynomial returned diretcly from dsolve/numeric is effective. The degrees of the pieces is based on the interpolants used by the solver for each time step (ie. accurate, and reasonably compact). Typical degrees&amp;nbsp;would reflect whether you'd used rkf45 or dverk78, etc (that's what those numbers in the name mean). The ArrayInterpolation apporach would use something like degree 3 pieces (but the querying process would act more like a black box).&lt;/p&gt;
&lt;p&gt;In both cases discussed, interpolation is being set up for you, with degree not too high (which is good). And as I showed in the worksheet attached above, both can be used to obtain a procedure which take a float input x to a float output y. You can integrate that procedure with evalf/Int, you can plot it, you can Optimize is, you can numerically diferentiate it ith evalf/D, and you can use it in subequent dsolve/numeric computations by using the `known=` option.&lt;/p&gt;
&lt;p&gt;Why do you think that you need to see the explicit algebraic form of such an interpolating procedure? For what exact purpose?&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130437-Function-From-Numbers#comment130658"&gt;@ABond&lt;/a&gt;&amp;nbsp;Obtaining a single polynomial is not necessary for doing mosts sorts of further computation. And for many data points it would likely be either a poor approximation low order polynomial, or a high order polynomial that fits the many points by has far too many qualitatively unwanted inflections.&lt;/p&gt;
&lt;p&gt;The piecewise polynomial returned diretcly from dsolve/numeric is effective. The degrees of the pieces is based on the interpolants used by the solver for each time step (ie. accurate, and reasonably compact). Typical degrees&amp;nbsp;would reflect whether you'd used rkf45 or dverk78, etc (that's what those numbers in the name mean). The ArrayInterpolation apporach would use something like degree 3 pieces (but the querying process would act more like a black box).&lt;/p&gt;
&lt;p&gt;In both cases discussed, interpolation is being set up for you, with degree not too high (which is good). And as I showed in the worksheet attached above, both can be used to obtain a procedure which take a float input x to a float output y. You can integrate that procedure with evalf/Int, you can plot it, you can Optimize is, you can numerically diferentiate it ith evalf/D, and you can use it in subequent dsolve/numeric computations by using the `known=` option.&lt;/p&gt;
&lt;p&gt;Why do you think that you need to see the explicit algebraic form of such an interpolating procedure? For what exact purpose?&lt;/p&gt;</description>
      <guid>130668</guid>
      <pubDate>Tue, 14 Feb 2012 20:25:20 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
  </channel>
</rss>