Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

20 Pages«<56789>»
Options
Go to last post Go to first unread
Offline Davide Carpi  
#121 Posted : 22 May 2013 13:07:20(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,272
Man
Italy
Location: Italy

Was thanked: 1151 time(s) in 755 post(s)
Originally Posted by: mkraska Go to Quoted Post
For now my conclusion is a new survival rule:
"Do not use eval() in functions that you want to plot with xyplotregion."

I don't know if that is a bug or a feature of function definitions in general (dummy argument namespace concept), of eval() in particular or of the plugin. Of course, the fact that the internal plot function works with eval(), is sort of a hint...

In the same way you cannot use eval() with my Nonlinear Solvers, if eval() contains undefined variables (this behavior was noticed by omorr some month ago).

[edit] this is true also for the built-in solve() function.


best regards,

w3b5urf3r

Edited by user 22 May 2013 13:30:49(UTC)  | Reason: Not specified

Davide Carpi attached the following image(s):
eval.png
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 22/05/2013(UTC)
Offline mikekaganski  
#122 Posted : 22 May 2013 14:27:26(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
The same inability to use eval() may be seen in functions as arguments:

f.1(x):x

f.2(x):eval(x)

k(f(x),y):f(y)

k(f.1(x),5)=5

k(f.2(x),5)=# -- x - not defined
Best regards,
Mike Kaganski
thanks 2 users thanked mikekaganski for this useful post.
on 22/05/2013(UTC),  on 22/05/2013(UTC)
Offline omorr  
#123 Posted : 22 May 2013 14:56:18(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,734
Man
Serbia

Was thanked: 312 time(s) in 266 post(s)
Thank you for mentioned this once more Good

We discussed about this many times with lots of examples of this contradictory situation. To make long story short, I think we are in some kind of "Catch-22" situation with eval() here. There are many situations where:

a ) if you do not use eval() you can not get the result
b ) the obtained result can not be used if you used eval()

and of course vice versa, more or less...

The question is. Is there any chance to get out of this paradoxal situation ?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 3 users thanked omorr for this useful post.
on 22/05/2013(UTC),  on 22/05/2013(UTC),  on 23/05/2013(UTC)
Offline Davide Carpi  
#124 Posted : 22 May 2013 15:00:09(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,272
Man
Italy
Location: Italy

Was thanked: 1151 time(s) in 755 post(s)
Originally Posted by: mikekaganski Go to Quoted Post
The same inability to use eval() may be seen in functions as arguments

Yes, I suppose because the arguments preprocessing of user functions works like as I've explained in the post #120 about plugins functions Good

Edited by user 22 May 2013 22:23:13(UTC)  | Reason: Not specified

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 23/05/2013(UTC)
Offline uni  
#125 Posted : 23 May 2013 00:14:37(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,029
Man
Russian Federation

Was thanked: 924 time(s) in 526 post(s)
The source code for the function eval():



Therefore, it makes no sense to use this function where needed purely symbolic (pre)processing. This function is a numeric (TNumber eq = SMath.Math.Numeric.Expression.Calculate(args[0], store); ). Accordingly, the standard plot region is also numeric. X-Y Plot Region is not numeric since it uses a symbolic (pre)processing.
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 2 users thanked uni for this useful post.
on 23/05/2013(UTC),  on 01/02/2016(UTC)
Offline mikekaganski  
#126 Posted : 23 May 2013 02:49:08(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
Originally Posted by: uni Go to Quoted Post
The source code for the function eval():


Thank you for this useful information.

The problem, however, remains unresolved. There are cases when one must use eval() in a function (like the case I posted here) because there's no other way to obtain result (in my case it was too large number in the middle of a calculation). In the same time one must use tools like solve() or w3b5urf3r's NonlinearSolvers (or may like to use your wonderful extension).

So, the question is not why this is impossible (we kind of already guessed it), but how to change it from current unacceptable state in a satisfactory way.

The problem must not be totally unsolvable. If you use my example above like this:

Code:
k(eval(x);5)


then if x is undefined before the call, you get the standard "x - not defined" error, but if you define x previously, then the error will say "Variables should be defined for argument-functions" (as a side note, I must say that Russian translation of this text makes more sense - "You cannot pass values inside argument-functions" ). This means that Andrey has means to differentiate cases when a function is passed as argument, and not its value. In this case, if unresolved (throwing "x - not defined" error) eval() inside such function is detected, its processing must be postponed until its invocation, in which place the usual rules should be applied to the eval() called with actual defined parameters. In other words, when preparing functions, the resulting pseudo-code must still have all unresolved eval()s inherited from its "parents" in the corresponding places, and not preprocessed results of such eval()s.

This would eliminate a lot of frustration and limitations, and allow for much higher usability and intuitivity. SMath will simply be useful, and not just a toy.

Edit:
1. I might guess that the preparation of a function creates a representation where all user-defined functions are expanded, all extension (dll) functions are represented as their entry points and all special functions are processed like in the source code that you provided above. If so, then it would make sense to define yet another dll function "eval" that would take simply SMath-syntax text and act like a "SMath inside SMath". It would be used when the conditions depicted above are met instead of usual processing.
2. The same technique could be used for other special functions that create problems inside argument-functions, like str2num().

3. It is already possible for SMath to correctly process expressions which have some placeholders not filled (consider time(#) call that in this partial form yields correct results). Thus, it could be useful to allow syntax like this: k(f(#);5) to work without throwing errors. This would avoid cases when a formal parameter name happens to be previously defined.

Edited by user 23 May 2013 04:24:46(UTC)  | Reason: Not specified

Best regards,
Mike Kaganski
thanks 2 users thanked mikekaganski for this useful post.
on 23/05/2013(UTC),  on 23/05/2013(UTC)
Offline uni  
#127 Posted : 23 May 2013 04:28:17(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,029
Man
Russian Federation

Was thanked: 924 time(s) in 526 post(s)
In my opinion there is one solution. The function should only work with numerical optimization. In all other cases the argument must be returned as is.

time(#) - this is a bug Good

Edited by user 23 May 2013 04:31:28(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline mikekaganski  
#128 Posted : 23 May 2013 04:43:12(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
This is a bug that would be nice to turn into a feature Good This would make syntax of formal placeholders clean.

As to your solution - I seem to fail to follow you. Could you please show me what do I need to do to make XYPlot to show me a graph of the function ν(x*'MPa,300*'K) from this file?
Best regards,
Mike Kaganski
Offline uni  
#129 Posted : 23 May 2013 05:03:54(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,029
Man
Russian Federation

Was thanked: 924 time(s) in 526 post(s)
Originally Posted by: mikekaganski Go to Quoted Post
As to your solution - I seem to fail to follow you. Could you please show me what do I need to do to make XYPlot to show me a graph of the function ν(x*'MPa,300*'K) from this file?

In earlier versions SMath Studio support the long integers. But the implementation is too slow, so Andrey lowered accuracy and range of integers. I think that this is the main problem. You bypass the big integers by using the eval(). Andrey promised to try to return long integers reworking their implementation.
My suggestion - it is an additional opportunity to skip this function without any exceptions.

Edited by user 23 May 2013 05:06:01(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 3 users thanked uni for this useful post.
on 23/05/2013(UTC),  on 23/05/2013(UTC),  on 23/05/2013(UTC)
Offline mikekaganski  
#130 Posted : 23 May 2013 05:38:07(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
To summarize, this solution will only be universally possible when the results of any thinkable expression that contains eval()s will be exactly same as of the same expression with eval()s removed (with only possibly different calculation time).

That would be a great time!
Best regards,
Mike Kaganski
thanks 2 users thanked mikekaganski for this useful post.
on 23/05/2013(UTC),  on 23/05/2013(UTC)
Offline omorr  
#131 Posted : 23 May 2013 11:44:38(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,734
Man
Serbia

Was thanked: 312 time(s) in 266 post(s)
Originally Posted by: mikekaganski Go to Quoted Post
To summarize, this solution will only be universally possible when the results of any thinkable expression that contains eval()s will be exactly same as of the same expression with eval()s removed (with only possibly different calculation time).

That would be a great time!

One more "hedeach-giving" example of this symptomatic behavior.

Regards
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline mkraska  
#132 Posted : 26 May 2013 13:30:02(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,581
Germany

Was thanked: 856 time(s) in 544 post(s)
SMath crash on accessing context menu (try to switch on input display)

Error message details in attached text file

Edited by user 26 May 2013 13:32:11(UTC)  | Reason: Not specified

File Attachment(s):
welle.txt (11kb) downloaded 39 time(s).
Konische Welle.sm (121kb) downloaded 44 time(s).
mkraska attached the following image(s):
konische welle.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline PompelmoTell  
#133 Posted : 26 May 2013 13:45:55(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 202
Man
Italy
Location: italy

Was thanked: 73 time(s) in 61 post(s)
Hello Martin,
I have no problems with Win7 and Smath 0.96 build 4884

Sergio
Offline omorr  
#134 Posted : 26 May 2013 13:47:56(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,734
Man
Serbia

Was thanked: 312 time(s) in 266 post(s)
I can confirm this - 0.96 build 4884, Win7(32). XY-plugin 0.1.4884.13578

I think Martin already mentioned this "Continue" thing. Context menu will produce this error, but we can choose "Continue".
BTW, plot should be selected first - just left click into it, then right click.

Regards,
Radovan

Edited by user 26 May 2013 13:53:45(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline mkraska  
#135 Posted : 26 May 2013 13:55:33(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,581
Germany

Was thanked: 856 time(s) in 544 post(s)
Originally Posted by: omorr Go to Quoted Post

I think Martin already mentioned this "Continue" thing. Context menu will produce this error, but we can choose "Continue".


Right, but there is no way to access the context menu to switch on the input area and change the input expressions :-(
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline omorr  
#136 Posted : 26 May 2013 13:57:56(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,734
Man
Serbia

Was thanked: 312 time(s) in 266 post(s)
Originally Posted by: mkraska Go to Quoted Post
Originally Posted by: omorr Go to Quoted Post

I think Martin already mentioned this "Continue" thing. Context menu will produce this error, but we can choose "Continue".


Right, but there is no way to access the context menu to switch on the input area and change the input expressions :-(


Yes, you are right. Trying to select, copy or whatever will be impossible. Quite annoying

Edited by user 26 May 2013 14:02:12(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline mkraska  
#137 Posted : 26 May 2013 14:00:48(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,581
Germany

Was thanked: 856 time(s) in 544 post(s)
Originally Posted by: PompelmoTell Go to Quoted Post
Hello Martin,
I have no problems with Win7 and Smath 0.96 build 4884

Sergio


Sergio, can you please switch on the input area of both plots, save the file and post it (or send it to kraska@fh-brandenburg.de)?
Currently I almost rebuilt the plots from scratch, but would be interesting if that would be an option to recover a file.

Thanks, Martin
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline omorr  
#138 Posted : 26 May 2013 14:10:57(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,734
Man
Serbia

Was thanked: 312 time(s) in 266 post(s)
Hmm... a bit puzzling Shok

I used Martin's previous version (SMath with plugins - 0.96.4875 and XY plugin 0.1.4883.2883) and it works. See the picture and the attached file
File Attachment(s):
Konische Welle-debug.sm (142kb) downloaded 51 time(s).
omorr attached the following image(s):
Konische Welle-debug.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 26/05/2013(UTC)
Offline PompelmoTell  
#139 Posted : 26 May 2013 14:13:24(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 202
Man
Italy
Location: italy

Was thanked: 73 time(s) in 61 post(s)
Hello Martin,
I had mistakenly understood that the problem is on the plot ' geometries '
It was working fine
now trying on "spannungen" plot, I have the same problem
I apologize
Sergio
thanks 1 user thanked PompelmoTell for this useful post.
on 26/05/2013(UTC)
Offline PompelmoTell  
#140 Posted : 26 May 2013 14:21:57(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 202
Man
Italy
Location: italy

Was thanked: 73 time(s) in 61 post(s)
the file posted by Radovan works correctly even with Win7(64) and Smath 0.96 build 4884
Sergio
Users browsing this topic
Similar Topics
X-Y Plot Region Plugin (Extensions)
by ndtma 24/06/2018 06:00:49(UTC)
X-Y Plot Region Plugin Problem (Questions)
by ndtma 20/06/2018 19:38:44(UTC)
20 Pages«<56789>»
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.