cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

two functions that depend on vector variables are giving error results

rdelascasas
6-Contributor

two functions that depend on vector variables are giving error results

To all,

the functions f1s and g1s are giving erroneus results, but i cannot find my mistake.

Please, if you can also check the evaluation of the integral below that will help as well.

thank you in advance,

Rogelio

6 REPLIES 6

the functions f1s and g1s are giving erroneus results,

With "erroneus results" you probably mean that you did not expect nested matrices as result?

It looks like the vectorization in f1 of your function Delta is the reason for that behaviour, but at the moment its unclear to me what exactly is going on here as at first look I loose track as of your multiple nesting of different functions. At least I was not able to reproduce the effect with more simple examples.

26.05.png

OK, and here is a simpler example.

26.05_2.png

The vector d is hard coded at definition time in f(). The definition of f() is "take every element of d and add it to x" which would return a 3x1 vector. when f(a) simply adds the two vecors but if f() is called vectorized, Mathcad inserts every element of a singly in function f() and get back a 3x1 vector three times - so the result is a nested array.

In your file its the vector d consisting of ten eights which causes that mannerism in the definition of Delta.

One possible workaround is to make d a paremeter of your functions a sketched in the pic above.

Thanks Werner,

i soon as i eliminated the vectorization in the f1s and g1s functions in the definition of the functions the problems seems to be solved.

i tried to run the pi function below the f1s and g1s function and now it says "pattern match exception".

Do you know what that means?

thank you in advance,

Rogelio

RichardJ
19-Tanzanite
(To:rdelascasas)

Your function returns a complex value, which is not compatible with the infinite limit.

rdelascasas
6-Contributor
(To:RichardJ)

it has worked for me in other cases of integrals with infinite limits, but i cannot find why it is not working now.

please, see attached file.

Is there any other way to do this kind of calculations?

thank you in advance,

rogelio

RichardJ
19-Tanzanite
(To:rdelascasas)

As you increase the limit the imaginary part converges very fast, so that's easy. The real part oscillates, but it's clear what it will converge to eventually. It seems you also have a non-convergence problem if the limit is too high (those exponential terms, I think). I don't know what level of accuracy you require.

Top Tags