Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

Defining differential operator that acts like curl

asked 10 years ago

Marios Papachristou gravatar image

updated 10 years ago

Hello,

As a newbie in using SAGE (experience with Python and Numpy), I was wondering how to define a differential operator that acts like curl (or ×F). The curl for a vector field F=(Fx,Fy,Fz)is defined as a determinant det(,F). I want to define such operators that act on Fx,Fy,Fz without calculating the determinant a priori. In other words if I was to multiply x with Fy, I would expect to get Fyx EDIT:

class DiffOpp(SageObject):

    def __init__(self, dep_var):
        self.dep_var = dep_var

    def __mul__(self, f):
        return diff(f, self.dep_var)
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 10 years ago

calc314 gravatar image

The previous question here links to a worksheet which gives the following code:

var ('x y z')
def divergence(F):
    assert(len(F) == 3)
    return diff(F[0],x) + diff(F[1],y) + diff(F[2],z) 
def curl(F):
    assert(len(F) == 3)
    return vector([diff(F[2],y)-diff(F[1],z), diff(F[0],z)-diff(F[2],x), diff(F[1],x)-diff(F[0],y)])

There is also a ticket here on this issue that has a link to some code as well.

Preview: (hide)
link

Comments

  1. However F work in n-dimensions since it's a dot product
  2. I do not want to just calculate the derivative but I want the differential operator to act as a multiplier

For example the hamiltonian operator ˆH=2m2+V can act on a wavefunction ψ as ˆH|ψ=2m2ψ+Vψ

Marios Papachristou gravatar imageMarios Papachristou ( 10 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 10 years ago

Seen: 499 times

Last updated: Dec 30 '14