Group Abstract Group Abstract

Message Boards Message Boards

Mathematica won't give me a numerical result

GROUPS:

Hello everyone, I have a problem with Mathematica 9. For my thesis I have to work with a rather big, but not too complicated equation, but Mathematica just won't give me numerical results for it, even if I assign values to every single variable. Even when I use the N-function, it still won't give me a simple numerical result, but a product containing a square root and some sums. Has anyone else encountered such a problem and does anybody know a solution? Thank you in advance!

POSTED BY: Daniel Tausend
Answer
2 months ago

Hi Daniel, would it be possible for you to post the equation, It is very difficult to give any meaningful answers if we can't see anything.

Paul.

POSTED BY: Paul Cleary
Answer
2 months ago

Hi Paul,

so this is the equation with all the variables except for a and b.

10 Sqrt[5] \[Sqrt]((215. + 43.566 a + 
37.336 b) (0.25 (5/(2 a) +
1500 (1/800 - (-1 + a)/(1000 a)) TextCell[""]) +
0.25 (5/(2 b) +
1250. (1/700 - (-1 + b)/(1000 b)) TextCell[""])))

Now if I set a=1 and b=1 Mathematica gives me this:

384.644 Sqrt[
0.25 (5/2 + 1.78571 TextCell[""]) + 0.25 (5/2 + (15 TextCell[""])/8)]

Using the N-function results in:

384.644 Sqrt[
0.25 (2.5 + 1.78571 TextCell[""]) + 0.25 (2.5 + 1.875 TextCell[""])]

But that doesn't really help me. Do you know where the problem is? Thanks.

POSTED BY: Daniel Tausend
Answer
2 months ago

TextCell[" "] is the problem.

f[a_, b_] := 
10 Sqrt[5] \[Sqrt]((215. + 43.566 a +
37.336 b) (0.25 (5/(2 a) +
1500 (1/800 - (-1 + a)/(1000 a)) ) +
0.25 (5/(2 b) + 1250. (1/700 - (-1 + b)/(1000 b)) )))

So f[1,1] yields: 565.986

You rule assignment would work for the expression, e.g.

f[u, v] /. {u -> 1, v -> 1}
POSTED BY: Mark Dooris
Answer
2 months ago

Hi Daniel,

Is there any reason you include the TextCell[""]? removing it then prints a numeric answer. I am suspecting that using TextCell is preserving the format.

Paul.

POSTED BY: Paul Cleary
Answer
2 months ago

Ah great. Thank you guys, this actually helps a lot. I'll just remove it then.

POSTED BY: Daniel Tausend
Answer
2 months ago

On a side note, we could let MMa try and simplify the expression, and replace decimals with fractions, i.e. 43.566 with 43566/1000. the result is more compact though not necessarily what you want.

we get

f[a_, b_] := 
N[1/(4 Sqrt[14])
Sqrt[((107500 + 21783 a + 18668 b) (224 b + 3 a (70 + 17 b)))/(
a b)]]

Paul.

POSTED BY: Paul Cleary
Answer
2 months ago