1 Pages (3 items)
Jacob() - Syntax is incorrect? - Messages
#1 Posted: 4/15/2012 8:52:22 AM
Hello,
I am continuing to struggle with my nonlinear equations and this one just can not understand. It is again connected to Jacob() function.

I already mentioned this problem in another post regarding failing of solve() and roots() http://en.smath.info/forum/default.aspx?g=posts&m=6579#post6579.
I just do not understand why the "Syntax is incorrect" error here. The Jacob() itself is giving a matrix, but I can not define a function with it. I already did many similar problems like this one, but this particular one just drives me crazy
. I tried lots of different things here, but without success. Am I doing something wrong? Do I miss something? Is there some trivial thing that I can not see at the moment?
Here is the accompanied file Primer65cc.sm
Could someone take a look at it please.
Regards,
Radovan
I am continuing to struggle with my nonlinear equations and this one just can not understand. It is again connected to Jacob() function.

I already mentioned this problem in another post regarding failing of solve() and roots() http://en.smath.info/forum/default.aspx?g=posts&m=6579#post6579.
I just do not understand why the "Syntax is incorrect" error here. The Jacob() itself is giving a matrix, but I can not define a function with it. I already did many similar problems like this one, but this particular one just drives me crazy

Here is the accompanied file Primer65cc.sm
Could someone take a look at it please.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#2 Posted: 4/15/2012 5:31:37 PM
This should work:
[math lang=eng]fJ(X#):Jacob(ff(X#),mat(el(X#,1),el(X#,2),el(X#,3),el(X#,4),el(X#,5),el(X#,6),el(X#,7),el(X#,8),el(X#,9),el(X#,10),el(X#,11),el(X#,12),12,1))[/math]
Will check if I can fix this issue.
Regards.
[math lang=eng]fJ(X#):Jacob(ff(X#),mat(el(X#,1),el(X#,2),el(X#,3),el(X#,4),el(X#,5),el(X#,6),el(X#,7),el(X#,8),el(X#,9),el(X#,10),el(X#,11),el(X#,12),12,1))[/math]
Will check if I can fix this issue.
Regards.
#3 Posted: 4/16/2012 6:43:16 AM
Hello Andrey,
Thank you for answering but It seems that I was wrong in some way. I forgot that making a symbolic vector say X with the elements of the same name as the vector itself i.e. X[1],X[2]...is problematic.
Here is the example:

To be honest, I am not quite sure way is this not possible. There must be some reason for that, I suppose.
Therefore, the previous example with Jacob() was a kind of mistake. I should use another name for the vector, and then it would work:

On the other hand, If we try to use Jacob() inside a function which apply Newton Raphson method, there might be a problem. Here I continue with the previous example:

If we want to use this function fNewtonm() we must take care that the first argument "f(1)" is a function with as single argument, the second argument is "xs" - a symbolic vector. The problem is that we have to know in advance that the local function "fJ(X)" inside fNewtonm() must have the vector argument X with the symbolic vector elements X[1],X[2],..., otherwise this will not work. Therefore when we call the function fNewtonm() the second symbolic vector, "XS" here, must have symbolic vector elements with X[1],X[2],.... I do not know how to make this particular fNewtonm() more general in order to work with some arbitrary named symbolic vector because what Jacob() returns depends on "xs" vector and the argument name of "fJ()" function might be different.
Here is the accompanied file - Primer65ccc.sm
I hope I made myself understood.
Regards,
Radovan
Thank you for answering but It seems that I was wrong in some way. I forgot that making a symbolic vector say X with the elements of the same name as the vector itself i.e. X[1],X[2]...is problematic.
Here is the example:

To be honest, I am not quite sure way is this not possible. There must be some reason for that, I suppose.
Therefore, the previous example with Jacob() was a kind of mistake. I should use another name for the vector, and then it would work:

On the other hand, If we try to use Jacob() inside a function which apply Newton Raphson method, there might be a problem. Here I continue with the previous example:

If we want to use this function fNewtonm() we must take care that the first argument "f(1)" is a function with as single argument, the second argument is "xs" - a symbolic vector. The problem is that we have to know in advance that the local function "fJ(X)" inside fNewtonm() must have the vector argument X with the symbolic vector elements X[1],X[2],..., otherwise this will not work. Therefore when we call the function fNewtonm() the second symbolic vector, "XS" here, must have symbolic vector elements with X[1],X[2],.... I do not know how to make this particular fNewtonm() more general in order to work with some arbitrary named symbolic vector because what Jacob() returns depends on "xs" vector and the argument name of "fJ()" function might be different.
Here is the accompanied file - Primer65ccc.sm
I hope I made myself understood.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 Pages (3 items)
-
New Posts
-
No New Posts