Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline omorr  
#1 Posted : 09 June 2012 17:15:21(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,

Here is one of my files (similar problems I frequently used and solved). Although I solved many of them already, this one is quite a puzzle for me.
Actually, I could not understand why and how there is an error in it - see the picture please.

typeconversionerror

here is the accompanied file

typeconversionerror.sm

Could someone check this out please. Am I doing anything wrong here?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline omorr  
#2 Posted : 11 June 2012 13:07:32(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,

I suspect that some similar problems are with the following example, therefore I also put it here.

The problem might be my mistake - but I can not see it and this drives me crazy at the moment Crazy

I also made another file and remained puzzled again. This time, I did the calculation, then I tried to do the same using the function - but there was an error I could not figure out again where it comes from.
Please look at the picture:

functionnotworking

To the left is the calculation and there is a result. To the right there is a function and the same calculation - but there is an error about non matching numbers of rows/columns. Can not say what went wrong because none of the trace() functions has executed and really can not figure out what was wrong with this function.

I made another one, and the problematic function again worked now ??? Shok .

functionnowworking

Here is the accompanied file:

functionnotworking.sm

Could someone try to reproduce this one as well, please Help.

Regards,
Radovan

Edited by user 11 June 2012 15:45:43(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#3 Posted : 12 June 2012 01:40:03(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Hi omorr,

I think that the use of "function of function" with virtual arguments it's very interesting Good


I don't know why, but the issue seems to be located in the first "if" statement and in "B" evaluation

With your "if" statement, a trace() check relative to the iter variable return this:

debug_1

there are no steps incremention, both "if" and "else" statements are not evaluated, but while cycle 3 times Wonder


if you put a fake statement (f.e. 3<1) the if/else evaluation work:

debug_2


if you look the trace() output you can see that in the third loop there is a "before B" but not an "after B", so I think the 2nd issue is in that if/else statement

the type conversion error disappear:
- if you put a line() in B
or
- if you directly put a 6x1 vector both in "h" and "z", but not if you put the vector in "h" or in "z" only


watch this file, and enable/disable the broyden functions to see the differences: typeconversionerror_debug.zip


I hope I helped you in some way Wacko

regards,

w3b5urf3r

Edited by user 18 September 2012 01:38:33(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline omorr  
#4 Posted : 12 June 2012 12:12:18(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Thank you w3b5urf3r

You helped, indeed. Actually, your checking gave me the idea where to track the things. It seems there is some error inside SMath or something else I could not figure out.

Here is the the screenshot of the example which is working and there is no problem about it.
typeconversionerror-good

As one can see, the h-value (which is inside the if(),btw.) is calculated as a vector of numbers - as it should be expected.
On the other hand, when using the problematic example:

typeconversionerror-wrong

As one can see, the h-vector is a nested matrix???. I can not figure out why is this happening. On the other hand, if we do that outside the function everything is fine, h-vector is a vector of numbers as it should be. Therefor, if() got confused and everything else broke down.

Here is the file with both examples typeconversionerror-1.sm

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#5 Posted : 12 June 2012 13:53:02(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
ok, another little step...

seems that the issue it's the different evaluation of f1(x0) (directly, outside the Broyden function) and f(x0) (indirectly, inside the Broyden function)

typeconversion_debug_3.png

I could not find a way to get out the correct result (eval/optimization/line...) Sad

here is the file with different chunked Broyden functions, enable/disble functions to see each output typeconversionerror-1_debug.zip


regards,

w3b5urf3r

Edited by user 18 September 2012 01:39:15(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 13/06/2012(UTC)
Offline omorr  
#6 Posted : 12 June 2012 16:48:32(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Thanks for answering Good

On the other hand, I begin to doubt in my common sense Sad
Look at this please:
howisthisposible

Believe or not, I can not see what I was doing wrong but this seems to me quite peculiar.
Am I right or not?

Here is the file howisthisposible

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline oscampo  
#7 Posted : 12 June 2012 17:27:06(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 246
Man
Colombia
Location: Cali, Colombia

Was thanked: 85 time(s) in 65 post(s)
Hi,
I think that is that numeric/simbolic optimization issue.

I modified definition of f(X) and turn on numeric optimization, and now answer is coorect:

howisthispossible

Regards,

Oscasr
thanks 1 user thanked oscampo for this useful post.
on 13/06/2012(UTC)
Offline omorr  
#8 Posted : 12 June 2012 18:22:05(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Thank you Oscar,

I think that the point is why my original simple example gives different results. Have no answer on that. Just imagine a bit more complicated functions (like my two examples above with questionable errors - 1.type conversion and 2.wrong vector/matrix dimensions). I am not sure but I suppose there is some bug in SMath. Have no idea at the moment what is going wrong. Just suspect that this simple example has some connection with them.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#9 Posted : 13 June 2012 00:34:50(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
bug found and reproduced! (I think)

see this file, and enable or disable evaluations of f1() to see three different behaviors (optimization indipendent) 0.94_arrays%20bug.sm.zip

all differences are in A definition (assigned multiplier / variable multiplier / variable multiplier with operations)

0.94_arrays bug


regards,

w3b5urf3r

Edited by user 18 September 2012 01:39:41(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 13/06/2012(UTC)
Offline oscampo  
#10 Posted : 13 June 2012 01:14:33(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 246
Man
Colombia
Location: Cali, Colombia

Was thanked: 85 time(s) in 65 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
bug found and reproduced! (I think)

see this file, and enable or disable evalutations of f1() to see three different behaviors (optimization indipendent)


I think that the bug is in "line" definition of function.

Look into this file, where I define f(x) without "line": 0.9_line_bug.sm

All answers are ok.

Oscar
thanks 1 user thanked oscampo for this useful post.
on 13/06/2012(UTC)
Offline Davide Carpi  
#11 Posted : 13 June 2012 10:16:00(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: oscampo Go to Quoted Post
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
bug found and reproduced! (I think)

see this file, and enable or disable evaluations of f1() to see three different behaviors (optimization indipendent)


I think that the bug is in "line" definition of function.

Look into this file, where I define f(x) without "line": 0.9_line_bug.sm

All answers are ok.

Oscar


Hi oscar,

you're right, the bug involve matrix products defined inside lines(), when the products are stored inside local variables

0.94_line products bug

I think now Andrey has enough elements to try to solve this issue Good


best regards,

w3b5urf3r

Edited by user 18 September 2012 01:40:12(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 2 users thanked Davide Carpi for this useful post.
on 13/06/2012(UTC),  on 13/06/2012(UTC)
Offline Andrey Ivashov  
#12 Posted : 14 June 2012 00:42:53(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Thank you! It's a great help for me.
Will fix this issue as soon as possible.

Regards.
thanks 1 user thanked Andrey Ivashov for this useful post.
on 14/06/2012(UTC)
Offline Andrey Ivashov  
#13 Posted : 16 June 2012 14:32:09(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
I've made a fix. Could someone test it before the next release (hope to share new version tomorrow)?
Put the file from this package to SMath Studio installation directory to test the results.

Regards.

Edited by user 16 June 2012 14:39:48(UTC)  | Reason: Not specified

File Attachment(s):
SyLib.7z (26kb) downloaded 27 time(s).
Offline Davide Carpi  
#14 Posted : 16 June 2012 15:29:03(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: smath Go to Quoted Post
I've made a fix. Could someone test it before the next release (hope to share new version tomorrow)?
Put the file from this package to SMath Studio installation directory to test the results.

Regards.


hi,

it seems to work properly Good


regards,

w3b5urf3r
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline omorr  
#15 Posted : 16 June 2012 17:50:29(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Thank you Andrey for considering these issues Good ,

Here is my testing of the files I've posted.

The first one is about type conversion #1
It seems it is working now. Here is the picture:
typeconversionerror-1
here is the file typeconversionerror-1.sm

The second one #2 gave me some headache. It gives me constantly the non matching dimension error. Finally, I just find out what causes the problem which I could not understand. The problem was in stack() as presented in this picture:
xxstacknotworking
here is the file xxstacknotworking.sm

I really can not understand why is that. If we just use stack() as a last command it will work but if we use XX:=stack() after that, this will not work Shok ???

The third one is about transpose #6. It is still the same situation for me here - still wrong. Here is the picture:
howisthisposible-1
Here is the file howisthisposible-1.sm

Regards,
Radovan



When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#16 Posted : 16 June 2012 18:08:12(UTC)
Davide Carpi


Rank: Advanced Member

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

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


The second one #2 gave me some headache. It gives me constantly the non matching dimension error. Finally, I just find out what causes the problem which I could not understand. The problem was in stack() [...]
here is the file xxstacknotworking.sm


I confirm, same issue with augment() Sad

Originally Posted by: omorr Go to Quoted Post


The third one is about transpose #6. It is still the same situation for me here - still wrong. [...]
Here is the file howisthisposible-1.sm


Confirmed, but I think can be considered as a separate (unsolved) bug ( Transpose functions bug) Good


regards,

w3b5urf3r

Edited by user 16 June 2012 18:11:08(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 16/06/2012(UTC)
Offline omorr  
#17 Posted : 16 June 2012 21:06:12(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
I confirm, same issue with augment() Sad w3b5urf3r

I mentioned some issues regarding augment() and stack() but not sure if there is any connection with this problem. To be honest, It was just a pure coincidence that I tried this - although seems quite non logical.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#18 Posted : 16 June 2012 22:24:46(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: omorr Go to Quoted Post
To be honest, It was just a pure coincidence that I tried this - although seems quite non logical.

I agree Biggrin

Originally Posted by: omorr Go to Quoted Post
Hello Andrey,

I wonder if the augment() and stack() could be made to receive a scalar argument in the case of merging vectors and scalars. This is not working at the moment *Array dimensions do not match*:

[...] Andrey, could you make that augment() and stack() could have scalars as their arguments as well, in the cases of merging row or column matrices (vectors)?

Regards,
Radovan

seem right, stack() and augment() should be able to treat a scalar (or a string) as a 1x1 matrix, if other input variables are vectors, scalars or strings Good


regards,

w3b5urf3r

Edited by user 16 June 2012 23:00:43(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 16/06/2012(UTC)
Offline Andrey Ivashov  
#19 Posted : 17 June 2012 13:25:35(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Issue with augment/stack is also fixed. See augment() and stack() for details.

Fixed.
Regards.
thanks 2 users thanked Andrey Ivashov for this useful post.
on 17/06/2012(UTC),  on 17/06/2012(UTC)
Offline omorr  
#20 Posted : 18 June 2012 14:27:51(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,

Just to mention something regarding this issue. I think this has some connection with it.

In v0.94 you will have

f(a):a*mat(b1,b2,b3,3,1)

f(a)=mat(a*b1,a*b2,a*b3,3,1)

f(mat(a1,a2,a3,1,3))=mat(mat(a1*b1,a2*b1,a3*b1,1,3),mat(a1*b2,a2*b2,a3*b2,1,3),mat(a1*b3,a2*b3,a3*b3,1,3),3,1)

f(mat(a1,a2,a3,3,1))=mat(mat(a1,a2,a3,3,1)*b1,mat(a1,a2,a3,3,1)*b2,mat(a1,a2,a3,3,1)*b3,3,1) or
f(mat(a1,a2,a3,3,1))=mat(mat(a1*b1,a2*b1,a3*b1,3,1),mat(a1*b2,a2*b2,a3*b2,3,1),mat(a1*b3,a2*b3,a3*b3,3,1),3,1)

f(mat(u1,v1,z1,u2,v2,z2,u3,v3,z3,3,3))=mat(mat(u1*b1,v1*b1,z1*b1,u2*b1,v2*b1,z2*b1,u3*b1,v3*b1,z3*b1,3,3),mat(u1*b2,v1*b2,z1*b2,u2*b2,v2*b2,z2*b2,u3*b2,v3*b2,z3*b2,3,3),mat(u1*b3,v1*b3,z1*b3,u2*b3,v2*b3,z2*b3,u3*b3,v3*b3,z3*b3,3,3),3,1)

In v0.95 you will have

f(a):a*mat(b1,b2,b3,3,1)

f(a)=a*mat(b1,b2,b3,3,1)

f(mat(a1,a2,a3,1,3))=mat(a1*b1+a2*b2+a3*b3,1,1)

f(mat(a1,a2,a3,3,1))=a1*b1+a2*b2+a3*b3

f(mat(u1,v1,z1,u2,v2,z2,u3,v3,z3,3,3))=mat(u1*b1+v1*b2+z1*b3,u2*b1+v2*b2+z2*b3,u3*b1+v3*b2+z3*b3,3,1)

I think that the situation with v0.95 is much acceptable now than before. On the other hand, I think that we have to be careful now because we can not take for granted that the result of these operation are symbolic vectors, matrices - as we would expect.

Regards,
Radovan

Edited by user 18 June 2012 14:46:23(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 18/06/2012(UTC)
Users browsing this topic
Guest
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.