×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

TK Solver

TK Solver

TK Solver

(OP)
All,
being recently introduced to tk solver, i really need a better book than what was provided by uts.
anyone have any recommended suggestions for books, forums, or technical articles?
the immediate need is how to multiply two tables or list of values, similar to computing moleweight for a hydrocarbon gas (i.e. mole fraction(i) x moleweight(i)).
I want to convert some excel workbooks to using tk.
-pmover

RE: TK Solver

1. You can use the TK Solver List Solve Wizard to generate tables of solutions based on sets of equations.
2. You can write a procedure function to loop through a set of assignment statements which reference arrays.

The best solution depends upon whether you are looking to solve a problem once or are looking to build a more versatile application.  Let me know and I can give you an example.

What TK book are you trying to use?  The TK Solver User's Guide which comes with TK4 includes details on both of the solutions suggested above.

RE: TK Solver

(OP)
tksolver,
objective:  in process of converting 2 spreadsheets to tk solver as iterations and significant calcs are required.  what i'm trying to determine is moleweight of a gas mixture.  mw of mixture is the sum of mixture components mole fraction multiplied by mixture component molecular weight (i.e. MW mixture = sum of x(i) * MW(i), where i=1 to 15 gas mixture components).
there are two input lists, one named moleweight, which contains the mole weights of hydrocarbon gases and the other named molefractions, which contains the percent mixture mole fraction.
Rule Sheet has:
MW=moleweight[4]*molefraction[4], which works just fine, but only the 4th component.  this calc needs to be accomplished for each mixture component.
What is needed is a table that contains the resultant value of each component moleweight, and then displayed on variable sheet the total mixture moleweight.
i thought i had your email address, but must have misplaced it.  will be glad to send tk file, but thought this posting would suffice for now.
by the way, i noticed the tk forum - good job!  i was familiar with tk as a former employer uses it extensively, but that was 5 years ago and ...
-pmover

RE: TK Solver

The built-in DOT function returns the sum of products of the elements of two lists.  For example, if list A contains the values {1,3,6,8,4} and list B contains the values {5,6,2,3,9} then the expression DOT('A,'B) returns 95.  You can set up your data in a table to make it easier to edit.  

I remembered an example you might be interested in from IIT's TK Tutorial.  This little procedure is used in a model for computing dew point or bubble point of a mixture.

Q = 0
k = 2*(type='b) - 1  ; type is input as 'b or 'd
for j = 1 to length('a)
  'vp[j] = 10^('a[j]-'b[j]/('c[j]+T))
  Q = Q + 'mfin[j]*'vp[j]^k
next i
P = Q^k
for j = 1 to length('a)
  'mfout[j] = 'mfin[j]*('vp[j]/P)^k
next i

Here is some sample data they used, with the columns representing component, mfin, and a, b, c coefficients from Antoine's equation.

benzene  .40  6.90565  1211.033  220.79
styrene  .35  6.92409  1420.000  206
toluene  .25  6.95334  1343.943  219.377

If you'd like to send me your model for more suggestions, send it to todd@uts.com.  I'll be happy to take a look.

RE: TK Solver

This kind of task is easily solved with MATHSERV
http://www.engs-comp.com/mathserv/index.html

For example, type in any word processor:
A = {1,3,6,8,4}
B = {5,6,2,3,9}
C = mattranspose(B)
D = matmult(A,C)
print using "####"; D
(this command returns a 5x5 matrix)
   5   6   2   3   9
  15  18   6   9  27
  30  36  12  18  54
  40  48  16  24  72
  20  24   8  12  36

E = matmult(C,A)
print E
(this command returns a scalar) 95.0000

To solve nonlinear equations online, see:
http://www.engs-comp.com/solvnonlinearequ/index.html

engcomp@ozemail.com.au
http://www.engs-comp.com/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources