Physics Help Forum analytical expression to numerical grid points

 Physics Software Physics Software Forum - Physics software for computers and calculators

 Oct 24th 2018, 01:15 AM #1 Junior Member   Join Date: Jul 2018 Posts: 4 analytical expression to numerical grid points Hello everybody does anyone knows how can I map an analytical expression for B to a discrete grid in numeral simulation? Like the results of numerical MHD simulation which produce discrete data for B.
 Oct 24th 2018, 02:00 AM #2 Senior Member     Join Date: Jun 2016 Location: England Posts: 750 The only way I can think of is the brute force method. You basically calculate the analytical expression for every point in the grid. Sometimes, if the analytical expression describes a "well behaved" phenomenon, shortcuts can be achieved by approximations and interpolating. There may be more elegant solutions for certain particular problems, but in general I can't think of any other way. __________________ ~\o/~
Oct 24th 2018, 02:52 AM   #3
Senior Member

Join Date: Oct 2017
Location: Glasgow
Posts: 291
 Originally Posted by mehdi6 Hello everybody does anyone knows how can I map an analytical expression for B to a discrete grid in numeral simulation? Like the results of numerical MHD simulation which produce discrete data for B.
I don't what B is, but you could perhaps just loop over your discrete space and sample the analytical function?

Psuedocode (C# style):

Code:

B = new List<double>();

foreach (var xValue in xValues)
{
var value = myAnalyticalFunction(xValue);
B.Append(value);
}

Print(B)
In the above pseudocode, "xValues" is a list of x-axis values. If your function is multi-variate, you can loop over points.

 Tags analytical, expression, grid, numerical, points

« Simulator | - »

 Thread Tools Display Modes Linear Mode

 Similar Physics Forum Discussions Thread Thread Starter Forum Replies Last Post Vijay9 General Physics 0 Jul 16th 2017 05:18 AM pranimaboity2050 Nuclear and Particle Physics 0 Nov 17th 2014 10:23 AM kl.twilleger General Physics 2 Apr 15th 2013 08:35 AM Squint General Physics 0 Apr 15th 2013 07:12 AM shamreen Theoretical Physics 3 Jun 2nd 2010 12:14 AM