# [SciPy-user] do complex numbers default to double precision?

Nils Wagner nwagner at mecha.uni-stuttgart.de
Thu Jun 30 09:15:29 CDT 2005

```Ryan Krauss wrote:

> Thanks to Nils and Robert for their quick responses.  This is
> definitely one thing to love about SciPy.  I posted my null space
> question yesterday and Robert responded in 20 minutes and Nils in 30.
> I posted my optimization question this morning and Nils reponded in 8
> minutes!  It is almost like chatting with tech support.  You make
> SciPy a pleasure to use!  Thanks.
>
> Coincidentally, these two problems are linked and I don't know if my
> numerical error problems are from fmin or the null space/svd stuff.
> Once I find the input that drives my matrix to have a null space, I
> find the vector that corresponds to the null space (assuming the
> sub-matrix is only rank deficient by 1).  Then I combined the null
> space vector with zeros that correspond with the boundary condition on
> one end of the problem.  So, a 4x1 null space vector would give me an
> 8x1 full vector.  I then take the 8x8 full matrix which has a 4x4
> submatrix whose determinant is roughly 0 and multiply it by the 8x1
> vector of the boudnary conditions I just solved for.  This should then
> give me an 8x1 vector of the boundary conditions on the other end.
> The problem is that there are some elements of this second vector that
> should be 0 because of the boundary conditions and they are actually
> of order 1e-10, if the vector is normalized so that its magnitude is
> 1.  This physically means that I have a cantilever beam with a free
> end that has just a little bit of force and moment at the free tip.
>
> Ryan

Ryan,

problem asap.

A good starting point for your problem is an article by Ram
Transcendental eigenvalue problem and its applications
AIAA Journal Vol.40 (2002) pp. 1402-1407

Nils

>
> Ryan Krauss wrote:
>
>> The matrix is currently 4x4 but will grow to probably 6x6.  It is
>> definitely nonlinear.  The matrix contains sinh, cosh, sin, and cos.
>> I am using the transfer matrix method to analyze structures.  When
>> you say two-parameter, do you mean the real and imaginary part of the
>> independent variable?  I guess you are right that I don't necessarily
>> need to use the determinant.  In order to satisfy the boundary
>> conditions of the problem this 4x4 or 6x6 matrix (which is really a
>> submatrix of an 8x8 or 12x12) must have a null space.  So, what would
>> be the better thing to look for?  An eignevalue that approaches 0?
>>
>> Ryan
>>
>> Nils Wagner wrote:
>>
>>> Ryan Krauss wrote:
>>>
>>>> I have a matrix that is a function of a complex valued input.  I am
>>>> trying to find that value of that input that drives the determinant
>>>> of the matrix to zero.  I am searching for this value using fmin.
>>>> The error I am trying to minimize is the abs(det(complex matrix)).
>>>
>>>
>>>
>>>
>>> It's not a good idea to use the determinant directly since det(A) is
>>> a rapidly varying function. As far as I understand your problem,
>>> you are interested in the solution of a two-parameter nonlinear
>>> eigenvalue problem. Is that correct ? How about the size of your
>>> complex matrix A ?
>>>
>>> Nils
>>>
>>>> I don't seem to be able to drive this error lower that roughly
>>>> 9e-17, regardless of the values for ftol and xtol I use.
>>>>
>>>> Am I hitting some internal limitation?  Are complex values by
>>>> default single or double precision?
>>>>
>>>> Thanks,
>>>>
>>>> Ryan
>>>>
>>>> _______________________________________________
>>>> SciPy-user mailing list
>>>> SciPy-user at scipy.net
>>>> http://www.scipy.net/mailman/listinfo/scipy-user
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user at scipy.net
>>> http://www.scipy.net/mailman/listinfo/scipy-user
>>>
>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user at scipy.net
>> http://www.scipy.net/mailman/listinfo/scipy-user
>>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

```