Question about Mathematica
Hi,
I have a question about fitting in Mathematica.I have a function like this: F=T*Y^(0.5) T is temperature but Y obtained from this coupled equation 1u*Y=u(1u/Y^.4)^.5*Y I have T and F from experimental data.so I want to obtain u from fitting. could you please advise me how can I do it by Mathematica. Thank you 
Re: Question about Mathemtica
You don't need to fit this. You can solve for u in terms of T and F eliminating Y.
Try something like: Solve[equation1, u] /. Solve[equation2, Y] This will solve the second equation for Y and substitute that into the solution for u. 
Re: Question about Mathemtica
Quote:
1u*Y=u(1u/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. 
Re: Question about Mathemtica
personally I prefer matlab or excel for numerical solutions over mathematica; mathematica can do it but I find mathematica better for analytical solutions.
My advice is just make the fit in excel and get an equation for Y, then plug that into mathematica to get an expression for u. 
Re: Question about Mathemtica
Quote:
In your case T and F are knowns and u and Y are unknowns. You have two equations in two unknowns, so you cant do fitting, there is nothing to fit, you just solve the equations. The only thing close to a "fit" that you can do in this case is to average the results. 
Re: Question about Mathemtica
Not solving your question, just typing your equations like i would on paper, to be sure you get your initial equations communicated to us (and for easier viewing), please check if i made an error:
Your first equation: (1) [tex]f=t\cdot\sqrt{y}[/tex] Your second equation: (2) [tex]1\left(u \cdot y\right)=u \cdot y^{0.45} \cdot \sqrt{1\frac{u}{y^{0.4}}}[/tex] Again with your statement from your first post, "i got f and t from experimental data" you should already be able to solve equation (1) for y, right? 
Re: Question about Mathemtica
Yes.I apology again I forget a very Important one let me write the exact equation,just because I wanted to simplify it I made mistake the exact equation is:
1(1u)*Y=u(1a/(t*Y^.32))^0.5*Y^.45 so this one is exact one as you can see the y depeds on T and u.actually I solve my problem in just by hand.I am seeking to alternative way.it is important for me once again I apologies for my mistake,I really appreciate it 
Re: Question about Mathemtica
OK, here is the process:
1) solve the first equation for y 2) substitute into the second equation 3) solve the second equation for f to get an expression for f in terms of t, a, and u 4) put your data in the form {{t1,f1},{t2,f2},...} 5) use FindFit[data,expr,{a,u},{t}] 
Re: Question about Mathemtica
I write this small program in mathematica
F[p_, k_] := Block[{y}, Solve[k*y  1 == 0, y]; p^2*y] but when I write this F[.2, .4] I get 0.04 y Do somebody know where I made mistake? thanks 
Re: Question about Mathemtica
Yes, you forgot to substitute the expression for y into the output expression.

Re: Question about Mathemtica
could please you explain more?
thank you 
Re: Question about Mathemtica
In the first line you solved for y, but then you never did anything with that solution. You didn't set y to anything. So when it came time to evaluate the second line y had not changed and was just left as the symbol y. You can fix that one of two ways:
F[p_, k_] := Block[{y}, p^2*y /. Solve[k*y  1 == 0, y]] or F[p_, k_] := Block[{y}, y=1/k; p^2*y] In the first one you set the value of y by substitution (/.), and in the second you set the value of y directly (=). 
Re: Question about Mathemtica
thank you

Re: Question about Mathemtica
Hi
what is meaning of this term in [Block]for example: f[,]=Block[variable{},...] what is meaning of {} here for variable thank you 
Re: Question about Mathemtica
The {} simply denotes a list. Mathematica uses very consistent notation, [] always denotes function arguments, () always denotes operator precedence.

Re: Question about Mathemtica
I have defined this function
F[p_, k_] := Block[{y}, p^2*y /. Solve[k*y  1 == 0, y]] I want to minimize it, so I write: Minimize[F, k] and the answer is {F, {k > 0}} I know I can write it very simply. But I want to know where I made mistake in this way of writing. Thank you 
Re: Question about Mathemtica
Remember that F is not defined. What is defined is F[_,_]. Since F is not defined it is not a function of k and all values of k qualify as a minimum.

Re: Question about Mathemtica
Hi,
Thank you , but I think I define it before,when I inserted F[p_,k_]. could you please explain more how can I get correct result by this way? Thank you very much 
All times are GMT 5. The time now is 06:49 PM. 
Powered by vBulletin Copyright ©2000  2014, Jelsoft Enterprises Ltd.
© 2014 Physics Forums