Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does solve() produces an error?

Why does solve() produces an error? TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.

#!/usr/bin/env python
# coding: utf-8

# In[2]:


var('Ex Ey Ez')


# In[3]:


E=vector([Ex,Ey,Ez])


# In[4]:


var('Px Py Pz')


# In[5]:


P=vector([Px,Py,Pz])


# In[6]:


var('LAx LAy LAz LBx LBy LBz')


# In[7]:


LA=vector([LAx,LAy,LAz]); LB=vector([LBx,LBy,LBz])


# In[8]:


var('k QAx QAy')


# In[9]:


QA=QAx*LA+QAy*LB


# In[20]:


solve(E-P==k*(E-QA), [k, QAx, QAy])


# In[24]:


solve((E-P).cross_product(E-QA)==0, [QAx, QAy])