Fitting solution function of NDSolve with a curve

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Curve Fitting Function
Click For Summary
SUMMARY

This discussion focuses on fitting the solution function generated by NDSolve in Mathematica to a power function of the form ##at^b## over the domain ##t \in [0, 1]##. The user successfully implemented the NDSolve function to solve an initial value problem, resulting in the function f3[x]. They initially estimated the fit as ##t^{0.6}## but refined their approach using the FindFit function, ultimately obtaining the parameters ##a = 0.96556## and ##b = 0.573358##. The method involved generating a table of values from f3[x] and applying FindFit to determine the best-fitting curve.

PREREQUISITES
  • Familiarity with Mathematica and its syntax
  • Understanding of initial value problems (IVP)
  • Knowledge of curve fitting techniques
  • Experience with the FindFit function in Mathematica
NEXT STEPS
  • Explore advanced features of NDSolve in Mathematica
  • Learn about different curve fitting methods, including nonlinear regression
  • Investigate the use of the Table function for data generation in Mathematica
  • Study the implications of parameter estimation in mathematical modeling
USEFUL FOR

Mathematics students, data scientists, and researchers involved in numerical analysis and curve fitting using Mathematica.

member 428835
The following solves an IVP, giving the output as the function f3[x]:

Code:
s3 = NDSolve[{(-z1[t]^(3/2) + (1 + z1[t]^2)^(3/4))/(
    3 (-z1[t] + Sqrt[1 + z1[t]^2])) == z1[t] z1'[t], z1[0] == 0.0001},
   z1, {t, 0, 30}

f3[x_] := z1[x] /. First[s3];
My question is, how do I curve fit f3[x] to the function ##at^b## over domain ##t\in[0,1]##? Looks like ##t^{0.6}## does a good job (by eye) but is there a better way?
 
Physics news on Phys.org
Nevermind, the solution is here: https://reference.wolfram.com/language/ref/FindFit.html which gives: ## 0.96556 t^{0.573358}##

FYI for future people I used

Code:
Table[f3[x], {x, 0, 1, 0.01}];
FindFit[%, a x^b, {a, b}, x]
and then used the ##a,b## output as ##a(100t)^b## where I used 100 since I incremented by 0.01, or 1/100.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
6K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K