Skip to content
Advertisement

UFuncTypeError: Cannot cast ufunc ‘det’ input from dtype(‘O’) to dtype(‘float64’) with casting rule ‘same_kind’? How to avoid this issue?

I’m trying to build a PDE in python. I’m new to this and wondering where I have gone wrong. Would appreciate some help. I understand that I have a python object and I’m trying to cast it to a float64 but is there any way around this?

Here is my error

JavaScript

Here is my code

JavaScript

Advertisement

Answer

A symbolic calculation like this should be done with sympy rather than numpy. There is no good reason to use numpy for any part of what you are doing so it is best to avoid using it altogether when using sympy until you understand what the different libraries are for:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement