[GiNaC-list] Symbolic functions with multiple outputs
john.pye at student.unsw.edu.au
Thu Sep 8 09:58:22 CEST 2005
Hi Chris, thanks for answering,
Chris Dams wrote:
>>Is it possible to create symbolic functions that have multiple, matrix,
>>or list outputs? Is there a way to assign the outputs of a
>>multiple-valued symbolic function to elements of a list?
>You could have a function that automatically evals into a list by
>supplying the appropriate eval_func. However, is there anything wrong
>with ex p=pressure_of_water(T,rho); and ex h=enthalpy_of_water(T,rho);?
By evaluating these at the same time in my final numerical evaluation
stage, I can optimise a bit on the evaluation of the power series which
is used to provide the steam properties I'm using, see
I've got other areas where this would be useful too - I am trying to
build very simplistic process simulator program, and if I could
encapsulate system components (such as pumps or pipes etc) as GiNaC
functions, then it would make it easier to express larger systems. This
might not be the most efficient approach, but it was an approach I was
thinking about, anyway. The more work I can get GiNaC to do, the easier
it will be to get my code initially working...
>In the list case, perhaps what you really would want to have is a
>symbolic function water_variables(p,h) that does not evalutate further
>but can be used to hold pressure and enthalpy as results.
Sorry, I don't understand what you mean here?
School of Mechanical and Manufacturing Engineering
The University of New South Wales
Sydney NSW 2052 Australia
t +61 2 9385 5127
f +61 2 9663 1222
More information about the GiNaC-list