W. Mathematica 8 stays running and does not evaluate

In summary, the conversation discusses using Mathematica for Structural Mechanics calculations and a problem with slow integration of a long expression. Possible solutions suggested include using NIntegrate or Simplify, and trying to integrate the expanded version of the expression. The final result is a simplified expression for the integration.
  • #1
SCC10
2
0
Hi

I am a user of Mathematica as a tool for calculation in Structural Mechanics. I had a problem recently in the integration of expressions a bit long, and honestly I do not understand what might be causing the slowdown.

I want to just evaluate this:

iR7y0.png

This is for the Raileygh-Ritz method for rectangular plates. Then, i use the following code:

U=(1/2)*D1*Integrate[((D[W,{x,2}]+D[W,{y,2}])^2-2*(1-v)*(D[W,{x,2}]*D[W,{y,2}]-(D[W,x,y]^2))), {x, -a, a}, {y, 0, b}]

, were W is function of x and y


The problem is that the program continues running without answering over several minutes.
Anyone have any solution or advise that could make my process more agile?

Thank you in advance!
 
Physics news on Phys.org
  • #2
The symbolic integration of Integrate can take a very long time for complex functions, and in fact may never find an answer. If you know the values of all of the parameters, NIntegrate will run much faster and always will return an answer. You will need to assign all of the parameters beforehand, so that NIntegrate is just dealing with numbers, not symbolic expressions. I don't know if this is possible for you or not.

If you can't use NIntegrate, you might try Simplify on the symbolic expression before you use Integrate. Sometimes this helps.
 
  • #3
SCC10 said:
Anyone have any solution or advise that could make my process more agile?

Thank you in advance!

Yep.

(1) We have a sub-forum "Computing and Tech/Math and Science software" down below. They're really good. Maybe this should be moved to that.

(2) No doubt in my mind even if the assignment was to find an analytic solution and I couldn't after some effort, I'd try and numerically solve it with just any old reasonable values for the necessary parameters, just to get a handle on it. In that case, use NIntegrate to see what's up.

(3) Re-cast the problem entirely in terms of a Mathematica problem and NIntegrate, try and solve it, if you run into problems, post a thread in the Science software forum describing where you're having problems.
 
  • #4
SCC10 said:
The problem is that the program continues running without answering over several minutes.

Attach the simplest notebook you can which includes the definition of W
 
  • #5
Thank you for the answers

I have a problem with using the command NIntegrate, is that later I will need the W again for other calculations and for this reason I need to use symbolic integration.

Here is the nb whit the definition of W, Wxy in case


Sorry about the location of the post, I am new here... Can any moderator move the topic to the correct location?

Thanks!
 

Attachments

  • estrutural2_novo10.nb
    12.7 KB · Views: 412
  • #6
Part of the reason it is taking so long is that your integrand
((D[Wxy,{x,2}]+D[Wxy,{y,2}])^2 - 2*(1-v)*(D[Wxy,{x,2}]* D[Wxy,{y,2}]-(D[Wxy,x,y]^2)))
is 2 1/2 pages of expression and this
Expand[ ((D[Wxy,{x,2}]+D[Wxy,{y,2}])^2 - 2*(1-v)*(D[Wxy,{x,2}]* D[Wxy,{y,2}]-(D[Wxy,x,y]^2)))]
is about 40 pages of expression.

It is fortunate that in the Expanded version all the terms are fairly simple and have no denominators containing anything but small integer constants and Pi.

I had already waited a while and finally written "I suggest trying to Integrate the Expanded version and give it a day or three to see if you get an answer" when I was astonished to see:

In[8]:= Timing[U = (1/2)*d* Integrate[Expand[ ((D[Wxy,{x,2}] + D[Wxy,{y,2}])^2 - 2*(1-v)*(D[Wxy, {x, 2}]* D[Wxy,{y, 2}] - (D[Wxy,x,y]^2)))], {x, -a, a}, {y, 0, b}]]

Out[8]= {237.952*Second, (128*d*(739200*C3^2 + 335301120*C4^2 + 335301120*C4*C5 + 339440640*C4*C6 + 4139520*C5*C6 + 4139520*C6^2 + 242457600*C3*C7 + 1687910400*C7^2 + 2956800*C3*C8 + 1687910400*C7*C8 + 5913600*C3*C9 + 1708748800*C7*C9 + 20838400*C8*C9 + 20838400*C9^2 + 637560*C3^2*Pi^2 + 25138080*C4^2*Pi^2 + 4181760*C4*C5*Pi^2 + 5239080*C5^2*Pi^2 + 4646400*C4*C6*Pi^2 + 464640*C5*C6*Pi^2 + 2793120*C6^2*Pi^2 + 3801600*C3*C7*Pi^2 + 117152640*C7^2*Pi^2 + 380160*C3*C8*Pi^2 + 11658240*C7*C8*Pi^2 + 26373600*C8^2*Pi^2 + 4086720*C3*C9*Pi^2 + 12953600*C7*C9*Pi^2 + 1295360*C8*C9*Pi^2 + 13016960*C9^2*Pi^2 + 493020*C3^2*Pi^4 + 1880208*C4^2*Pi^4 + 3206016*C4*C5*Pi^4 + 1848528*C5^2*Pi^4 + 3237696*C4*C6*Pi^4 + 3206016*C5*C6*Pi^4 + 1880208*C6^2*Pi^4 + 2376000*C3*C7*Pi^4 + 8333760*C7^2*Pi^4 + 2344320*C3*C8*Pi^4 + 15152640*C7*C8*Pi^4 + 8276160*C8^2*Pi^4 + 2803680*C3*C9*Pi^4 + 15210240*C7*C9*Pi^4 + 15152640*C8*C9*Pi^4 + 8333760*C9^2*Pi^4 + 13365*C3^2*Pi^6 + 1980*C4^2*Pi^6 + 7920*C5^2*Pi^6 + 17820*C6^2*Pi^6 + 3600*C7^2*Pi^6 + 14400*C8^2*Pi^6 + 35640*C3*C9*Pi^6 + 32400*C9^2*Pi^6 + 2970*C2^2*Pi^2*(315 + 158*Pi^2 + 2*Pi^4) + 1485*C1^2*(40320 + 3864*Pi^2 + 332*Pi^4 + Pi^6) + 2640*C2*(1120*C9 + 2835*C8*Pi^2 + 144*C9*Pi^2 + 1038*C8*Pi^4 + 888*C9*Pi^4 + 6*C8*Pi^6 + 24*C7*(3780 + 54*Pi^2 + 37*Pi^4) + C3*(280 + 84*Pi^2 + 270*Pi^4)) + 1320*C1*(362880*C7 + 181440*C8 + 183680*C9 + 27864*C7*Pi^2 + 2592*C8*Pi^2 + 2880*C9*Pi^2 + 2124*C7*Pi^4 + 1776*C8*Pi^4 + 1800*C9*Pi^4 + 3*C7*Pi^6 + 108*C2*(420 + 14*Pi^2 + 5*Pi^4) + 2*C3*(22960 + 840*Pi^2 + 279*Pi^4))))/(155925*Pi^4)}

That is on a fairly old slow machine. You need to verify this for yourself.

My thinking is that Integrate might be faster on an integrand with very simple terms, in spite of having lots of them, than it is on products of powers of D[] that it might be evaluating repeatedly, although it isn't supposed to be doing that.

So try it with and without Expand. Throw a dozen minutes or an hour at each version and see if you get an answer both ways.
 
  • #7
I also got it to evaluate by simplifying the terms first and then forcing it to integrate term by term. The notebook is attached. I think it may be the same result as Bill Simpson's. here's the final result:

Code:
1/(155925 \[Pi]^4)
  128 d (739200 C3^2 + 335301120 C4^2 + 335301120 C4 C5 + 
    339440640 C4 C6 + 4139520 C5 C6 + 4139520 C6^2 + 
    242457600 C3 C7 + 1687910400 C7^2 + 2956800 C3 C8 + 
    1687910400 C7 C8 + 5913600 C3 C9 + 1708748800 C7 C9 + 
    20838400 C8 C9 + 20838400 C9^2 + 637560 C3^2 \[Pi]^2 + 
    25138080 C4^2 \[Pi]^2 + 4181760 C4 C5 \[Pi]^2 + 
    5239080 C5^2 \[Pi]^2 + 4646400 C4 C6 \[Pi]^2 + 
    464640 C5 C6 \[Pi]^2 + 2793120 C6^2 \[Pi]^2 + 
    3801600 C3 C7 \[Pi]^2 + 117152640 C7^2 \[Pi]^2 + 
    380160 C3 C8 \[Pi]^2 + 11658240 C7 C8 \[Pi]^2 + 
    26373600 C8^2 \[Pi]^2 + 4086720 C3 C9 \[Pi]^2 + 
    12953600 C7 C9 \[Pi]^2 + 1295360 C8 C9 \[Pi]^2 + 
    13016960 C9^2 \[Pi]^2 + 493020 C3^2 \[Pi]^4 + 
    1880208 C4^2 \[Pi]^4 + 3206016 C4 C5 \[Pi]^4 + 
    1848528 C5^2 \[Pi]^4 + 3237696 C4 C6 \[Pi]^4 + 
    3206016 C5 C6 \[Pi]^4 + 1880208 C6^2 \[Pi]^4 + 
    2376000 C3 C7 \[Pi]^4 + 8333760 C7^2 \[Pi]^4 + 
    2344320 C3 C8 \[Pi]^4 + 15152640 C7 C8 \[Pi]^4 + 
    8276160 C8^2 \[Pi]^4 + 2803680 C3 C9 \[Pi]^4 + 
    15210240 C7 C9 \[Pi]^4 + 15152640 C8 C9 \[Pi]^4 + 
    8333760 C9^2 \[Pi]^4 + 13365 C3^2 \[Pi]^6 + 1980 C4^2 \[Pi]^6 + 
    7920 C5^2 \[Pi]^6 + 17820 C6^2 \[Pi]^6 + 3600 C7^2 \[Pi]^6 + 
    14400 C8^2 \[Pi]^6 + 35640 C3 C9 \[Pi]^6 + 32400 C9^2 \[Pi]^6 + 
    2970 C2^2 \[Pi]^2 (315 + 158 \[Pi]^2 + 2 \[Pi]^4) + 
    1485 C1^2 (40320 + 3864 \[Pi]^2 + 332 \[Pi]^4 + \[Pi]^6) + 
    2640 C2 (1120 C9 + 2835 C8 \[Pi]^2 + 144 C9 \[Pi]^2 + 
       1038 C8 \[Pi]^4 + 888 C9 \[Pi]^4 + 6 C8 \[Pi]^6 + 
       24 C7 (3780 + 54 \[Pi]^2 + 37 \[Pi]^4) + 
       C3 (280 + 84 \[Pi]^2 + 270 \[Pi]^4)) + 
    1320 C1 (362880 C7 + 181440 C8 + 183680 C9 + 27864 C7 \[Pi]^2 + 
       2592 C8 \[Pi]^2 + 2880 C9 \[Pi]^2 + 2124 C7 \[Pi]^4 + 
       1776 C8 \[Pi]^4 + 1800 C9 \[Pi]^4 + 3 C7 \[Pi]^6 + 
       108 C2 (420 + 14 \[Pi]^2 + 5 \[Pi]^4) + 
       2 C3 (22960 + 840 \[Pi]^2 + 279 \[Pi]^4)))
 

Attachments

  • estrutural2_novo10_new.nb
    45.7 KB · Views: 404

1. Why is my Mathematica 8 staying running and not evaluating?

There could be several reasons for this. One possibility is that your code contains an infinite loop, causing Mathematica to continuously run without producing a result. Another possibility is that you have set up a long-running calculation, in which case you may need to wait for it to finish before seeing the results. Additionally, if you are using a large amount of memory or processing power, Mathematica may appear to be stuck or frozen while it is actually still working.

2. How can I make Mathematica 8 evaluate my code faster?

There are a few things you can try to improve the speed of your code. First, make sure you are using the most efficient functions and algorithms for the task at hand. You can also use parallel computing techniques to distribute the workload across multiple cores or processors. Another option is to use Compile to create optimized code for specific calculations. Additionally, reducing the amount of data being processed or increasing the available memory can also help speed up evaluation.

3. My Mathematica 8 code is giving me errors. How can I troubleshoot them?

The first step in troubleshooting errors is to carefully read the error message and try to understand what it is telling you. Sometimes, the error message will provide a suggestion for how to fix the problem. If not, you can use the Wolfram Language documentation or search online for more information on the specific error. It can also be helpful to break your code into smaller parts and check each part individually to identify where the error is occurring.

4. I am new to Mathematica 8. Where can I find resources to learn how to use it?

The Wolfram website offers a variety of resources for learning Mathematica, including tutorials, videos, and documentation. There are also many online forums and communities where you can ask questions and get help from experienced users. Additionally, there are books and online courses available for purchase that can provide in-depth instruction on using Mathematica.

5. Can I use Mathematica 8 for data analysis and visualization?

Yes, Mathematica is a powerful tool for data analysis and visualization. It offers a wide range of built-in functions for statistical analysis, data manipulation, and visualization. You can also use the Wolfram Language to import data from various sources and create custom visualizations. Additionally, there are specialized packages available for specific types of data analysis, such as machine learning or financial analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
137
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top