| Thread Closed |
Mathematica Problem, please help me! |
Share Thread |
| Apr28-08, 12:18 PM | #1 |
|
|
Mathematica Problem, please help me!
I've been having this problem for about a week now, and would love to hear from anyone who is familiar with Mathematica and can offer some insight:
I think the basic concept is simple. I have two variables, let's call them x and y, related in the following way: y/(Exp[y] -1) = Log[1+x]/x I know the value of x, and I would like to know the value of y. Thus I can employ FindRoot: FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}] If I have specified the value of x already, i get a good response from FindRoot, for example In: x = -.6 FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}] Out: {y -> -.916291} However, what I really want is a function called F[x], such that when I feed any value of x to it, it will apply FindRoot and give the numerical value of y. I have tried the following equation: F[x] := FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}] and the equation F[x] := x /. FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}] and also the equation F[x] /. FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}] All of these give me an error, unless I have "preassigned" a numerical value of x. But I don't want to have a preassigned value of x, I want to be able to enter any value of x that I choose into F[x] and have FindRoot spit out a numerical value for y. Is this possible? Can anyone better at Mathematica than I am give me some advice? I would be forever in your debt, this has been driving me crazy. Thanks, Claire |
| Apr28-08, 05:19 PM | #2 |
|
|
Write F[x_] instead.
Code:
F[x_]:=y/.FindRoot[y/(Exp[y] -1) == Log[1+x]/x, {y, 1}];
|
| Apr28-08, 06:06 PM | #3 |
|
|
Ah, thank you so much, I really appreciate it.
|
| Thread Closed |
Similar discussions for: Mathematica Problem, please help me!
|
||||
| Thread | Forum | Replies | ||
| Mathematica problem | Math & Science Software | 0 | ||
| Can Someone Pls Help With This Mathematica Problem? | Math & Science Software | 8 | ||
| Mathematica problem | Math & Science Software | 2 | ||
| problem with mathematica | Math & Science Software | 0 | ||
| Mathematica 5.0 problem | Math & Science Software | 1 | ||