Message Boards Message Boards

0
|
3965 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to run 1- 855 data points into my function? Thanks :)

Posted 9 years ago

First of all, I would like to thank you in advance for spending your time answering my question and I will really appreciate your help. I am very new to Mathematica and I just couldn't figure out the solution for the following problem.

I am trying to calculate the ellipticity( last formula) for each of my temp and denaturant (both column imported from an excel file). I have two column in my excel file. 1st column: temp (1- 855 data points), 2nd column : den (1-855 data points). I have attempted to calculate the ellipticity by importing the values. However, the program only return a value. I need the ellip values for each of my temperature and denaturant concentration. Note: my formula starts from theta F to ellip.

My question is how do I run 1-855 data points of temp and den into the ellip formula so that it will return values for each data point?

Below is my Mathematica script that I have written. I have also the script and the excel file to this post.

a = -29846.66713137483;

b = 49.10083342826049;

c = -5927.651357897106;

d = 9402.228131251579;

e = -36.722337085166785;

f = 0.029490823878660512;

g = -528.5106658275561;

dCp = 19.731822683160715;

dH = 0.2566239190680801;

m = 0.995288747060038;

Tm = 372.92653842275854;

temp= Import["/Users/Justin Yeoh/Documents/Professor \Szyperski/Research/CD/CombinedThermalMelt_h2A.xlsx",{"Data",1,Range[1, 855], {1}}];

den = Import["/Users/Justin Yeoh/Documents/Professor \ Szyperski/Research/CD/CombinedThermalMelt_h2A.xlsx", {"Data", 1,Range[1, 855], {2}}];

thetaF[a_, b_, c_, temp_, den_] := a + btemp + cden

thetaU[d_, e_, f_, g_, temp_, den_] := d + etemp + ftemp^2 + g*den

dG[dH_, dCP_, m_, Tm_, temp_, den_] := dH*(1 - temp/Tm) - dCP*((Tm - temp) + temp*Log[temp/Tm]) + (-m)*den;

ellip[a_, b_, c_, d_, e_, f_, g_, dH_, dCP_, m_, Tm_, temp_,den_] := (thetaF[a, b, c, temp, den] + thetaU[d, e, f, g, temp, den]* Exp[-dG[dH, dCP, m, Tm, temp, den]/(0.00198*temp)])/(1 + Exp[-dG[dH, dCP, m, Tm, temp, den]/(0.00198*temp)])
Attachments:
POSTED BY: Jun Hui Yeoh
2 Replies

Jun,

First, since all those other parameters have fixed values, I would not list them as arguments (the effect of including them is probably very small, but it slows things down a bit, it is also more messy to look at). What I mean is that I would define the functions thetaF, thetaU, dG, and ellip as functions of temp and den only, by writing (for example):

thetaF[tempv_,denv_]:= some expression of all your parameters and tempv and denv

Of course, you can still use one function in the definition of another, just as you show above. Notice that I also prefer to give the abstract variables in the function definition a slightly different name than the variables themselves (I do this for clarity for myself; it is not required).

I would then use a way to map this to the list of values. The most natural thing that comes to my mind is MapThread:

myresult=MapThread[ellip, {temp,den}]

If you have defined ellip as a function of many other parameters, then you would have to turn it into a function of only two parameters when you use it inside MapThread:

myresult=MapThread[ellip[a,b,c,...,Tm,#1,#2]&,{temp,den}]

Before you run MapThread, make sure temp and den are simple lists of numbers, like this:

{temp1, temp2, temp3,..., tempN}

and NOT matrices of one column like this:

 {{temp1},{temp2},{temp3},...,{tempN}}

Best,

OL.

POSTED BY: Otto Linsuain
Posted 9 years ago

Try

fullData = Import["/Users/Justin Yeoh/Documents/Professor Szyperski/Research/CD/CombinedThermalMelt_h2A.xlsx"];
Map[({temp, den, dontcare} = #; ellip[a, b, c, d, e, f, g, dH, dCp, m, Tm, temp, den]) &, fullData[[1]]]

and verify if that correctly computes ellip for each of the rows in your Excel sheet.

Map takes each item from a list, performs a function on that, and returns a list of the results.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract