So im trying to make one equation equal another to solve for all physically realistic values of XX. Hill function is:

F(X)=11+(XK)n

F(X)=\frac{1}{1+(\frac{X}{K})^n}

and Gene Z equation is:

Z(X)=−14X+0.8

Z(X) = -\frac{1}{4} X + 0.8

for X=0X = 0 to 44, n=6n = 6, K=1K = 1…(I assume “physically realistic values” means real values). I am actually unsure of how to put a limit restriction on the XX values so that would be a great help, otherwise I feel like this is relatively simple, just need some guidance on whether or not I’ve done this correctly :).. Here’s some code.

clear [n];

n = 6;

k = 1;

Z[x_] := -x/4 + 0.8

z = Z[x];

F[k_, n_, x_] := 1/(1 + (x/k)^n)

hillf = F[1, n, x];

Reduce[hillf == z, x, Reals]

Thank you!

=================

=================

1 Answer

1

=================

1) The Clear function starts with an uppercase C; in general all built-in functions in Mathematica start with an uppercase letter.

2) Generally speaking it’s good practice not to start your own variable names with uppercase letters to avoid confusion. In particular, it’s a good idea never to have single-letter uppercase symbols. These can generate sneaky conflicts with built-in ones (N, D, K, C, E, I, and I’m sure many more that I can’t recall off the top of my head).

3) You also had an unnecessary definition of the function Z which was then assigned to the symbol z. I am not sure what you were trying to accomplish there.

4) Domain restrictions can be expressed as inequalities and added to the set of equations for Solve or Reduce.

Having said that, you can use the following:

Clear[n, k, x, z, f];

z[x_] := -x/4 + 0.8

f[k_, n_, x_] := 1/(1 + (x/k)^n)

Reduce[{f[1, 6, x] == z[x], 0 <= x <= 4}, x, Reals] (* Out: x == 0.96072 || x == 3.19625 *) Sometimes it may also be useful to get a feeling for the functions you are dealing with by plotting them over the region of interest: Plot[{z[x], f[1, 6, x]}, {x, 0, 4}, PlotLegends -> “Expressions”]

Much appreciated!

– Steve

May 25 ’15 at 8:49

@Steve glad it helped

– MarcoB

May 25 ’15 at 8:51

Actually, you only missed one from your list of reserved capital letters: O[]. 😉

– J. M.♦

May 25 ’15 at 13:26