Message Boards Message Boards

0
|
1652 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Problems with SetPrecision and ReplaceAll

Posted 2 years ago

I'm working with the complex equation in figure (Prova1). This equation is function of different variables. If I evaluate the equation in all the variables except A and wel4, I obtain an equation in function of A and wel4 (Prova2). If now evaluate this second expression in A = 1 and wel4 = -1 setting the precision to 64 digits, I obtain a result (Prova3). If I evaluate the same expression without setting the precision, the result is different (Prova4).

If now I try to replace in the equation Prova1 all the variables except A, I obtain an equation in function only of A (Prova5). If I evaluate this equation in A = 1, the final result is different from those obtained previously.

Can someone help me to understand why it happens? Thanks

Start Equation

Some test on the equations and strange results

POSTED BY: Donato D'Aprile
3 Replies

Get conclusions from my attached file:

POSTED BY: Mariusz Iwaniuk

Thank You for the Notebook.

Sorry, but I don't understand which is the rule of N in the equations. I attach a new Notebook with some additional tests.

You can notice that the formats 0.005 or 5/1000 have a strong impact on the result! And N is a command that impacts only in the representation format of the number. Is it correct?

Than I want to ask you an other question. If now I want to transfer the Prova1 equation from Mathematica to Matlab, I use the package ToMatlab' which writes a .m file with the equation in Matlab format. If then I calculate the expression Prova 1 in Matlab in the same values of the variables, I obtain a different result respect to Mathematica. Do you know the reason?

POSTED BY: Donato D'Aprile

I add the Notebook with the code if someone wants to do some tests

Wolfram Notebook

POSTED BY: Donato D'Aprile
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract