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 : 26 September 2010 00:18:13(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 Andrey,

Let's define a vector, matrix function (function returning vector or matrix). For example:
f(x)←mat(1,x/{1-x},x^2,1,x^2,x^3,2,3)
We can see the dimensions of vector, matrix it returns - but only with symbolic equal to:
rows(f(a))—2
cols(f(a))—3
length(f(x))—6
Numerical equal to will not work for the previous functions. The error will be if the arguments of "f" are not defined. Actually we can get the dimensions by simple using some defined variables or constants as arguments, say:
rows(f(0))=2
cols(f(0))=3
length(f(0))=6
The problem is that this is no "bullet proof" because if we use, say:
length(f(1))=#@#
The error will be issued (division by zero) - one of the "f" function elements is problematic.

To make myself clear. Why am I asking this? For instance, we can not use rows, cols or length functions in for lops directly. For instance, this will not work
for(i,range(1,rows(f(a))),for(j,range(1,cols(f(a))),el(A,i,j)←el(f(5),i,j)))
if variable "a" is not previously defined. However, if it was previously defined but if the "f" function "does not like it" - the error will be isued.

Sometimes we just have to do this. My question is - Is there any way to make this to work? Actually, rows, cols and length to work the same with simbolic equal to and numerical equal to. The argument to the function "f" in this case is irelevant - the point is that function "f" has only one argument - nothing else.

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 : 10 January 2012 04:54:15(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)
[FIXED] Good

f(x)←mat(1/x,{1-x}/x,4-x,2/x,3/x,5-x^2,2,3)
rows(f(x#))=2
cols(f(x#))=3
length(f(x#))=6

Regards,
Radovan

Edited by user 15 February 2012 01:22:03(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
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.