Message Boards Message Boards


Attempting to input a complex equation into W|A, both of us are stumped.

Posted 9 years ago
12 Replies
5 Total Likes

Hi all,

Will someone please get this monstrosity down W|A's gob in a constructive fashion?

Solve[P = x (-((a x)/V^2) + (R T)/(V - b x)) 


a=0.2420*((atm*dm^6)/(mol^2)), b=((2.65*10^-2)*((dm^3)/mol), 

for x

I've tried everything I know how to do so far, and I even caved and payed for pro -- and it didn't help one wit. SOMEONE please get this thing through wolfram's head -- then pleeeeease tell me how you did it.

POSTED BY: Joshua Patyten
12 Replies

Ok, i've ALMOST got it... but W|A is balking at the final step.

Input[1]: (1.0atm) = x(-(((0.2420[((atmdm^6)/(mol^2))])x)/(113097dm^3)^2) + (((77057.6)((dm^3atm)/(Kmol)))(298.2K))/((113097dm^3)-((2.6510^-2)((dm^3)/mol))x))

Output: 1 atm= x^2 ((298.2 K1 dm^3atm77058/(Kmol)*(per kelvin moles))/(113097 dm^3 (cubic decimeters)-0.142292 x 1 dm^3 (cubic decimeter) 1/mol (reciprocal mole))+x 1/mol^2 (per mole squared) 1 dm^6atm (decimeter to the 6 atmosphere) -1.892×10^-11/dm^6 (per decimeters to the 6))

Input[2] solve for x; 1atm=[((298.2K(dm^3)atm77058/(Kmol))/(113097(dm^3)(-0.142292)(x)(dm^3)(1/mol))+(x(1/mol^2)(dm^6atm)-(1.892×10^-11/(dm^6)))(x^2)]

Output: Wolfram|Alpha doesn't understand your query

Once more, I ask for help with getting input[2] to produce a value for x. (also, once more, * does not mean italics in this context, ergo Kmol is not intended to mean kilo-mole, but Kelvin-Mole, as such. K=Kelvin)

POSTED BY: Joshua Patyten

I think at this point, if you have the units consistent, you can drop them and just go for the numeric solution. Youwill know what are the correct units, for x, from the fact that it must agree with the units for V/b (so that that denominator has consistent units).

POSTED BY: Daniel Lichtblau

I attempted your initial suggestion of doing it piecewise, using the bare values for the homogonized units... but the result dosen't seem to make sense.

Input[1] a=0.2420; b=2.6510^-2; r=8.20573610^-5; v=113097; t=298.2; x(-a x/v^2+r t/(v-b x))

Output--> (0.05633/(794823.-1. x)-1.89197x10^-11 x) x

input[2] p=1 solve for x: p=(0.05633/(794823.-1. x)-1.89197x10^-11 x) x


That's a bit of an eyepopping output for me, given that my understanding is that that SHOULD come out to units of mols... I'm going to doublecheck now and see if that's... sane...

POSTED BY: Joshua Patyten

I think the problem is that you have a mix of meters and d-meters, and also moles and k-moles. If I am correct, just convert to one via k-moles-->100*moles, etc. to get consistent units. Then rinse and repeat.

POSTED BY: Daniel Lichtblau

actually that's kelven*moles, believe it or not. Also i think I managed to root out and convert all the instances of meter to dm.

apologies for that, I went back and made that a bit more clear. totally my mistake. (and that the coding of the forum seems to think that k*mol means something along the lines of italicization.)

*Edit 1 nope, you're right, there was still a m^3 unit in the R term. Thank you so much for helping me with this. I've been working on this problem for so ling i feel like i'm going crosseyed. I'm going to try it again now, with all the units PROPERLY converted this time.

POSTED BY: Joshua Patyten

The units are in need of minor conversions to like units, but the fundamental units are all the same (m^3 -> dm^3, for example), but the fundamental structure of the equation is functionally correct (it's pulled from a text book). If I remember right, I did try preconverting everything into matching units at one point, but was stymied by "W|A does not understand your input"more than likely because the input string remains half as long as my arm.

Converting everything to like units gives these: p=x (-a x/v^2 + r t/(v-b x)) a=0.2420((atm*dm^6)/(mol^2)) b=((2.6510^-2)*((dm^3)/mol) P=(1.0*atm) R=((8.20573610^-5)*((m^3atm)/(k * mol))) T=298.2*K V=(113097*dm^3)]

*edited because there was a minor error in the text. Second edit: kmol should have been K * mol

POSTED BY: Joshua Patyten

Units. Units. Units. Units. and one more time units. I need the units of n to come out, and come out correctly. If excel can do that, that's news to me (although, admittedly, I'm not as well versed in excel as I should be, nonetheless if it can automatically convert decimeters to meters and the like-- I'd be mildly impressed.). This isn't just solving the equation mathematically, this is dimensional analysis nightmare too. I need a CAS that can do both - the only ones that I know of that can do that are W|A and Mathematica. Given that I don't have any training (or a software license) for Mathematica, I'm here, now with a tertiary puzzle on top of it all of how in gods name to wheedle this into a form W|A can properly swallow. Is there some form of extended interface I can use to input this kind of thing? All I need are these 3 things: "input equation" and "define variables WITH UNITS", and "solve for which variable?"

How do I do that? Please and thank you!

(clarification: originally I was using n instead of x, but made the switch to x in an attempt to make it easier on W|A -- if I've referenced solving for n or x, the meaning is meant to be interchangeable: x=n.)

POSTED BY: Joshua Patyten

You can get the numerical values as already indicated (dropping all units, that is). Presumably any part of the input that gives compatibility conditions on the units will show what they must be. For example, the denominator V-b*x shows that x must have same units as V/b.

All this requires that the input be preprocessed so that units are all expressed in the same system e.g. CGS. And that the equation be dimentionally correct to begin with. If you want to actually demonstrate that (e.g. you want to show there was no error in the input) then I suspect Alpha will not be the tool of choice. Not sure about Alpha Pro though.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

I apologize. I looked at your equations and units, incorrectly assumed that all the units would neatly resolve themselves and tried to show you one way to coax WolframAlpha into submission.

I have now briefly tried to translate your units into the exact form Mathematica demands, guessed a little what some of those might be, and see whether it shows any sign of being able to provide a satisfactory solution. A caution, using units in Mathematica has been problematic with many new users trying to use units reporting problems and confusion.

My impression is that it isn't looking good. I'm guessing you would put in substantially more time and aggravation than the two other options I would recommend, a bright motivated student or in extreme cases a bright motivated grad student will likely be the least aggravating path to a solution.

If you are still bent on doing it yourself and you still have, or can re-create, your SI unit version of the problem then you could look at some of the documentation for using units with Mathematica. This or this might be a place to start. That could let you explore how much time and energy it might take to put a problem into a form where Mathematica might deal with your units. If you get that far and can post a nice clean example of the (almost) Mathematica-ready code (finding out how to use ctrl-K to create a box to put code into a post so it is less mangled) then I or someone else could take a few seconds to throw that at Mathematica and show you what the result was.

POSTED BY: Bill Simpson
Posted 9 years ago

One trick to get around some limitations of WolframAlpha is to let it do part of your calculation, scrape the result and use that to build a final calculation that gives you the answer you really want.

Go to WolframAlpha and paste

a=0.2420; b=2.6510^-2; r=8.20573610^-5; v=113.097; t=298.2; x(-a x/v^2+r t/(v-b x))

Gently slide the mouse over the result until you see "Copyable plaintext" and click and scrape

(0.05633 x)/(794.823-x)-0.0000189197 x^2

Then give WolframAlpha input

p=1;solve for x: p= (0.05633 x)/(794.823-x)-0.0000189197 x^2

tle last part of which is what you scraped from above and then get

x= -52854.9

x= 0


Or just quit fighting this sillyness and let Excel give you the answer

POSTED BY: Bill Simpson^2+%2B+r+t%2F%28v-b+x%29%29

My input was

solve for x: p=x (-a x/v^2 + r t/(v-b x))

My suggestion when entering input to W|A: make things as simple as possible.

POSTED BY: Daniel Lichtblau

aye, I did this at one point and got probably that exact output. What i'm looking to do is have it CALCULATE that equation given the following definitions for each of the variables: a=0.2420((atmdm^6)/(mol^2)) b=((2.6510^-2)((dm^3)/mol) P=(1.0atm) R=((8.20573610^-5)((m^3atm)/(kmol))) T=298.2*K V=(113.097m^3)] specifically WITH the units going along for the ride. As you can tell from the solution above, running this by hand is a NIGHTMARE. I need a CAS to chew this out.

POSTED BY: Joshua Patyten
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract