Skip to content

Output Derivatives in Inverse Problem!!!! #967

Answered by tsarikahin
ppandit95 asked this question in Q&A
Discussion options

You must be logged in to vote

The problem here is that np.savetxt. Check here https://stackoverflow.com/questions/51218937/saving-a-3d-numpy-array-to-txt-file.
I think this should work

def get_derivatives(x,M): 
      dM1_x = dde.grad.jacobian(M,x,i=0,j=0) 
      dM2_x = dde.grad.jacobian(M,x,i=1,j=0) 
      return dM1_x,dM2_x

f=model.predict(observe_x,operator = get_derivatives)
res_stacked = np.hstack((observe_x.reshape(-1,1),f[0].reshape(-1,1),f[1].reshape(-1,1)))
np.savetxt("Derivatives.dat",res_stacked)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ppandit95
Comment options

Answer selected by ppandit95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants