Just wanted to mention that the caracas package *may* be better at solving this
problem
Best
S?ren
-----Original Message-----
From: Konrad via R-help <r-help at r-project.org>
Reply-To: Konrad <konrad_kraemer at yahoo.de>
To: R-help at r-project.org
Subject: [R] computer algebra in R
Date: Tue, 28 Nov 2023 11:03:36 +0100
Dear all,
I'm currently working on converting mathematica code
(https://github.com/ASDSE/thermosimfit/blob/master/Packages/thermoHD-Comp/thermoCacheHD-1Comp.m)
to R. The code is related to solve algebraic systems.
> eqthermo = {h0 == h + hd + hga, d0 == d + hd, ga0 == ga + hga, kga =>
???? hga / (h * ga), kd == hd / (h * d)};
>
> (* IDA HD*)
> sthdIDAcacheHD[fkd_, fkga_, fh0_, fd0_] :=? sthdIDAcacheHD[fkd, fkga,
> fh0, fd0] > ?? ??? ?? ??? ?Module[{eliHD, solvHD},
> ?? ??? ??? ??? ?eliHD > ?? ??? ????? Eliminate[
> ?? ??? ?????? eqthermo /. {d0 -> fd0, h0 -> fh0, kd -> fkd, kga
->
> fkga}, {h, d, hga, ga}];
> ?? ??? ??? ??? ?solvHD = hd /. NSolve[eliHD, hd];
> ?? ??? ??? ??? ?Return[solvHD];
> ?? ??? ??? ??? ?];
??I tried to use the Ryacas package. However, I'm struggling with the
Elimination step. Within this step a system of equations:
0.3==h+hd+hga,0.4==d+hd,ga0==ga+hga,0.2==hga/(ga h),0.1==hd/(d h) is
transformed to: -12.+1040. hd+2575. hd^2-250. hd^3==ga0 hd (-200.+500. hd).
My question is whether someone has experience with yacas and can tell me
how to do this step in R. Beyond that, I would be grateful for every
hint how to transfer this into R.
All the best,
Konrad
______________________________________________
R-help at r-project.org?mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
S?ren H?jsgaard
Head of Department of Mathematical Sciences
Aalborg University, Denmark.
Chair of the Danish Statistical Society