Friday 15 May 2015

wolfram mathematica - using python to solve a nonlinear equation -


I have not used a python but the mathematical equation is not able to solve which I am trying to solve I am I am trying to solve the variables "a" of the following equations where s, c, mu, and delta t parameters are known.

Enter image details here

I used to write NSolve in mathematics, Solve, etc., but it is running for an hour with no luck. Since I'm not familiar with Python, is there any way I can use Python to solve this equation? "post-text" itemprop = "text">

You are not looking for an analytical solution for these equations because they are transcendental, in which a A .

I think the problem is with numerical solutions, that the limit of acceptable values ​​for a is interrupted by arcsin since Arcsin is defined for arguments between only -1 and 1 (believe that you should be a ), alpha for your code Code> and beta require a & gt; S / 2 and A & gt; (Sc) / 2 .

In Python, you can get a zero of your third equation (form f (a) = 0 ) brentq function: import as sipy.optimize np from copy as import. Brent = 10014.6 c = 6339.06 mu = 398600.0 dt = 780.0 def f (a): alpha = 2 * np.arcsin (np. Sqrt (s / (2 * a)) beta = 2 * np.arcsin (np.sqrt ((sc) / (2 * a)) alpha-beta - (np sin (alpha) -npsin (beta) ) - NP SCRT (MU / A ** 3) * DT A = Maximum (S / 2, (SC) / 2) A = Brentac (F, A, 10 * A0)

Edit:

The way brentq (f, a, b) is to clarify the tasks that it searches for f zero at one interval [A, b] . Here, we know that a is less than maximum (S / 2, (S-C) / 2) . I guessed that it was a high upper limit 10 times, and it worked for the given parameters. More generally, you need to make sure that the change in f happens between a and b and you can read more about this How that works in the function.

No comments:

Post a Comment