slow and fast growing sheet computation time - Сообщения

CB
Just use "eval" function in for loops:
x(i)=x(i-1)-eval(...
y(i)=y(i-1)-eval(...
The symbolic engine will produce complicated expressions in this case and slow down the speed. The symbolic engine will be avoided and, therefore, the speed of the numerical calculation will be drastically increased.
Regards,
Radovan
WroteHello CB,
Just use "eval" function in for loops:
x(i)=x(i-1)-eval(...
y(i)=y(i-1)-eval(...
The symbolic engine will produce complicated expressions in this case and slow down the speed. The symbolic engine will be avoided and, therefore, the speed of the numerical calculation will be drastically increased.
Regards,
Radovan
Using eval() will work but it negates the advantage of using SMath Studio, that the sheet looks like the equations in the statement of the problem. With eval's the code sheet is only little more usefull in explaining things that standard Matlab like code.
CB
WroteUsing eval() will work but it negates the advantage of using SMath Studio, that the sheet looks like the equations in the statement of the problem. With eval's the code sheet is only little more usefull in explaining things that standard Matlab like code.
Regarding to the most recent Andrey's efforts about Enabling and Disabling optimization of Symbolic library http://en.smath.info/forum/default.aspx?g=posts&t=393, I wonder if there could be also an option for a Math region to force numerical calculation of the right hand side instead of symbolical, besides the "eval" function.
Regards,
Radovan
WroteHello,
WroteUsing eval() will work but it negates the advantage of using SMath Studio, that the sheet looks like the equations in the statement of the problem. With eval's the code sheet is only little more usefull in explaining things that standard Matlab like code.
Regarding to the most recent Andrey's efforts about Enabling and Disabling optimization of Symbolic library http://en.smath.info/forum/default.aspx?g=posts&t=393, I wonder if there could be also an option for a Math region to force numerical calculation of the right hand side instead of symbolical, besides the "eval" function.
Regards,
Radovan
I've seen that post and think that will solve whatever is geing wrong here as well.
CB
WroteI've seen that post and think that will solve whatever is going wrong here as well.
CB
I hope you are right. It would be very good if only the disabling of Symbolic optimization will increase the calculation speed of your examples and, therefore, causing no need of using "eval". As far as I could see, loops with more complicated iterating formulas can cause problems concerning calculation speed.
Regards,
Radovan
WroteWroteI've seen that post and think that will solve whatever is going wrong here as well.
CB
I hope you are right. It would be very good if only the disabling of Symbolic optimization will increase the calculation speed of your examples and, therefore, causing no need of using "eval". As far as I could see, loops with more complicated iterating formulas can cause problems concerning calculation speed.
Regards,
Radovan
The reason that I think that disabling symbolic optimisation will work here is that the obvious reason for the problem is that SMath is trying to unfold the loop (I could be wrong but ...)
See the pic:

CB
This is exactly I was thinking about. Yes, that was the point. Unfolding the loop can make quite complicated expression (as you presented just with few iterations). Just like you, I am not sure what would disabled optimization do in this case.
Regards,
Radovan
Here is what I've got after disabling optimization of the last Math Region:
This will help with performance (because symbolic library will not try to simplify the result), but expression is still rather large.
Regards.
We are getting back to the point that sometimes numerical calculation is inevitable avoiding Symbolic preprocessor. This is calculating in no time.
I could make some of my impressions concerning the comments about this issue:
1. We can do all by symbolic calculation first.
2. Symbolic calculations (Optimised or not) are useful here in order to see, say, if we've done this correct or not.
3. If the calculation is to slow, we could disable optimization or use "eval", "round" to force it numerically.
4. CB pointed out that using these functions is not so ellegant, because they are visible and might distract the "paper-like" intention of SMath. I suppose that
- making it unvisible might be the solution or
- having the option for a given math region (as I mentined) to disable Symbolic library and using just strict numerical calculation
Regards,
Radovan
Default option will be defined through the global settings file and user will be able to change it manually.
Regards.
I think this would be great and desirable for most of the users

Regards,
Radovan
In fact, the solution we have invented here makes SMath Studio more flexible then ever. User will be able to use the most usable logic for specific expression definition.
Regards.
If I understood you well, the new SMath version will include pure numerical calculation as an option, skipping the symbolical engine. Am I right? If this is the case, I think the combination of symbolical and numerical calculation will bring new flexibility, usability etc. This would be really great

Regards,
Radovan

Figure 1: Setting of optimization option using main menu.
Figure 2: Setting of optimization option using context menu.
Figure 3: Results of evaluation.
Updated (Performance tests):
If "i" defined within the range from 2 to 10:
- Numeric optimization - takes 0.016 sec. to evaluate.
- Symbolic optimization, with eval(..) function - takes 0.015 sec. to evaluate.
- Symbolic optimization - takes about an infinity (interrupted after 13 min. elapsed) to evaluate.
- Without optimization (None) - takes 2 min. 53 sec. to evaluate.
If "i" defined within the range from 2 to 1000:
- Numeric optimization - takes 29.97 sec. to evaluate.
- Symbolic optimization, with eval(..) function - takes 17.352 sec. to evaluate.
- Symbolic optimization - senseless action.
- Without optimization (None) - senseless action.
RonL

Regards,
Radovan
-
Новые сообщения
-
Нет новых сообщений