Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:53:06+00:00 2026-06-13T13:53:06+00:00

I have a cube of particles which I’ve projected onto a 2D grid, Projecting

  • 0

I have a cube of particles which I’ve projected onto a 2D grid, Projecting the particles onto the grid by a clouds in cells and weighting them by a scalar.

I would then like the gradient of the scalar at every grid point. In 2D I am doing this using np.gradient and I get two arrays with the gradient in the x and y directions:

gradx, grady = np.gradient(grid)

Does anyone have any idea how I can generalize this to 3 Dimensions? The Clouds in Cells in 3D is fine but I am then left with a grid with the shape (700, 700, 700).

As far as I can see np.gradient can’t deal with this?

Thanks,
Daniel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:53:07+00:00Added an answer on June 13, 2026 at 1:53 pm

    The Numpy documentation indicates that gradient works for any dimensions:

    numpy.gradient(f, *varargs)

    Return the gradient of an N-dimensional array.

    The gradient is computed using central differences in the interior and
    first differences at the boundaries. The returned gradient hence has
    the same shape as the input array.

    Parameters :

    f: array_like. An N-dimensional array containing samples
    of a scalar function.

    *varargs: 0, 1, or N scalars specifying the sample distances in each direction, that is: dx, dy, dz, … The default distance is 1.

    Returns :

    g: ndarray. N arrays of
    the same shape as f giving the derivative of f with respect to each
    dimension.

    Seems like you should be able to extend your 2-dimensional code to 3D like you would expect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cube which I want to rotate. I also have a light
I have a Cube dimension which has a relationship between tier and market. They
I have a Cube which draws its data from 4 fact/dim tables. FactCaseEvents (EventID,CaseID,TimeID)
I have a SSAS cube in which there is a measure that needs to
I have an analysis services cube in SQL server 2005 which I'm connecting to
I have cube which contains geographic sales data. I want to pull sales of
I have a Cube which I want to rotate using mouse motion. So if
I have a cube in a test environment which is in an SSAS database
I have a cube with some dimensions. There I have a dimension 'Product' which
I have a cube in my OpenGL view which I can rotate when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.