Re: Extracting just the value of the variable from the result of Solve/NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg62822] Re: [mg62803] Extracting just the value of the variable from the result of Solve/NDSolve
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 6 Dec 2005 00:03:22 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Pradeep,
Try First.
eqn = {F == 2*T};
T = 300;
sol = First@Solve[eqn, F];
F /. sol
600
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Pradeep Suresh [mailto:pradeep at purdue.edu]
To: mathgroup at smc.vnet.net
Hi all,
i am facing a peculiar problem with the curly brackets of the output of
Solve and NDsolve commands....the result of Solve/NSolve/DSolve/NDSolve
all are in the form of {{y->a}} format and at best by doing a y/.soln, i
can get it to {a}, but for my purposes of passing this result to
JAVA(using J/Link), i need the value of the variable as just 'a' and not
'{a}'(i hope i am making myself clear).
E.g.
eqn={F==2*T};
T = 300;
sol = Solve[eqn, F]
F /. sol
gives me {600}, as i said earlier i need the answer 600(which is
different in datatype compared to {600} even though for all practical
purposes {600} is the same as 600). When i use J/link to extract value,
the {600} is not considered an integer/string/double/function,...so i
cannnot use getInteger,getString etc.
Can someone plz suggest a solution this problem, however triveal as it
may sound, it is an important problem in using J/Link to talk with
Mathematica.
Thank you very much in advance!!
Regards,
Pradeep