Fitting Temperature and Experimental Data in Mathematica: How-To Guide

  • Mathematica
  • Thread starter aminbkh
  • Start date
  • Tags
    Mathematica
In summary: I told you this a coupled equation,I apology because in formula I forgot something the second formula is something like this:1-u*Y=u(1-u/Y^.4)^.5*Y^.45 and then I should put this in this equation F=T*Y^(0.5).Now could you please me tell what to do.I appreciate it.When you do a fit you need to have more unknowns than equations.
  • #36


aminbkh said:
Hi thanks for your help,I have attached the file
I would appreciate it if you could help me.

If I try this

B[t_, Y_] := Y^(3/4)*t;t = 10; g = Random[Real, {.01, 3}]; u = Random[Real, {.01, 3}];
B[10, Y] /. NSolve[1 - (1 - u)*Y == u*(1 - g/(t*Y^.3))^.5*Y^.32, Y]

just to see how long your innermost step might take, it does not finish in several minutes. That does not give me a good feeling for how long it might take when NMinimize might want to do several hundred or tens of thousands such evaluations looking for a minimum.

When I then do this

Table[1 - (1 - u)*Y - u*(1 - g/(t*Y^.3))^.5*Y^.32, {Y, -10, 10, .1}]

it completes in a fraction of a second and I can see from the result that it does look like that crosses zero. But it looks like trying to understand why your NSolve takes so long is the first thing to do. If that can be fixed then your problem may be solved. But I am a little worried about what will happen in the situation when there is no solution from the NSolve. Then you will be trying to minimize something that is undefined in some domains.

So can you make any progress on speeding up the NSolve step?
 
Last edited:
Physics news on Phys.org
  • #37


Thank you for your answer.
First most of the time Nsolve should have answer because it has physical meaning.other thing is that Y vary from 0 to 1just between these two number.do you think this make the program faster, at first I used Findroot but it doesn't work for this case.
 
  • #38


Unless there is some physical bound on the value of u it appears that the minimum can become as negative as you like by letting u become as large as you like and finding appropriate values for the other variables.

For example, with 0<Y<1, t=10, 0<g<10
{minvalue, Y, u, g}={-30.8269, 0.173812, 79.9291, 0.0294438} for 0<u<80
{minvalue, Y, u, g}={-62.0829, 0.216682, 158.867, 0.0124873} for 0<u<160
{minvalue, Y, u, g}={-125.834, 0.167075, 319.935, 0.0223538} for 0<u<320
etc.

Each of those were obtained from a very simple fast brute force Monte Carlo run, just to cross check other calculations.

Depending on the range of g and t your 1 - (1 - u)*Y - u*Sqrt[1 - g/(t*Y^.3)]*Y^.32 is complex 10-25% of the time. If that were not the case then a bisection root finder for Y would be simple. It is feasible to calculate the minimum value of Y to ensure that this will be Real with a lower bound on Y of (g/t)^(10/3). With that lower bound on Y bisection seems to work well on your problem.

So are there other constraints on u and g? Or is this appearing to be unbounded the end of your problem?
 
Last edited:
  • #39


Hi,
Thank you for your very helpful answer.I really appreciate it
 

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
261
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
764
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
3K
Back
Top