I wanted to know how to create symbolic vectors in sympy. Once I have accomplished that, I would like to understand if it possible to integrate the following type of complex equation using sympy platform. I want the analytical solutions and hence want the solutions in symbolic form.
x1,x2,B are all 3D vectors, c is a small positive constant and
integrating w.r.t 't'
If this gets complicated in sympy could you please suggest any other platform to go forward with such analytical solutions.
Any help will be greatly appreciated. Thank you!
Related
I'am trying to solve a following problem.
In fact, this is Least Absolute Deviation Regression problem. I want to know how to solve this with python. I know that scipy has "linprog" which solve linear system with linear inequality constraints. But here there is two variable in inequality constraints, t, x. So, I want to know how to apply the "linprog" or is there other library which can solve this problem? Thanks
You have to write your problem in standard form, splitting the second inequality constraint and concatenating the two optimization variables. Then, you can feed it to linprog.
It is more of a math problem than an implementation one.
I'm trying to set up a system for solving these 5 coupled PDEs in FyPi to study the dynamics of electrons and holes in semiconductors
The system of coupled PDEs
I'm struggling with defining the terms highligted in blue as they're products of one variable with gradient of another. For example, I'm able to define the third equation like this without error messages:
eq3 = ImplicitSourceTerm(coeff=1, var=J_n) == ImplicitSourceTerm(coeff=e*mu_n*PowerLawConvectionTerm(var=phi), var=n) + PowerLawConvectionTerm(coeff=mu_n*k*T, var=n)
But I'm not sure if this is a good way. Is there a better way how to define this non-linear term, please?
Also, if I wanted to define a term that would be product of two variables (say p and n), would it be just:
ImplicitSourceTerm(p, var=n)
Or is there a different way?
I am amazed that you don't get an error from passing a PowerLawConvectionTerm as a coefficient of an ImplicitSourceTerm. It's certainly not intended to work. I suspect you would get an error if you attempted to solve().
You should substitute your flux equations into your continuity equations so that you end up with three second-order PDEs for electron drift-diffusion, hole drift-diffusion, and Poisson's equation. It will hopefully then be a bit clearer how to use FiPy Terms to represent the different elements of those equations.
That said, these equations are challenging. Please see this issue and this notebook for some pointers on how to set up and solve these equations, but realize that we provide no examples in our documentation because we haven't been able to come up with anything robust enough. Solving for pseudo-Fermi levels has worked a bit better for me than solving for electron and hole concentrations.
ImplicitSourceTerm(p, var=n) is a reasonable way to represent the n*p recombination term.
I'm trying to solve symbolically a system of the two following differential equations either in python or in r:
I want to find symbolic solutions for dH/dt=0 and dV/dt=0. However, I struggle to convert summations with matrixes and vector into code (python or R). Could someone help me?
Thanks in advance!
I have a following
ordinary differential equation
and numeric parameters Sigma=0.4, x(0) = 4 and dx(0)/dt = 0
My task is to get Cauchy problem solution (Initial value problem solution) of differential equation using ode function
Can someone help me? I don't even know how to write equation and especially numeric parameters in correct way for SciPy.
P.S. Sorry for not posting images, I've just registered.
Like Warren said, scipy.integrate.odeint is the 'SciPy' way to solve this.
But before you take your problem to SciPy (or whatever solver you end up using) you'll want to convert your 2nd order ODE to a first order ODE using something like: http://tutorial.math.lamar.edu/Classes/DE/SystemsDE.aspx
To get things into SciPy you need to get your equation looking like:
y' = f(y)
But right now your equation is written like:
y'' = f(y, y')
The solution is to add more variables to your system, but the link will explain it more thoroughly.
I am trying to solve a system of partial differential equations of the general form
F(f(x,y), f'(x,y), f''(x,y), g(x,y), g'(x,y), g''(x,y)) = 0
where the derivatives may be taken with respect to both x and y and f(x,y) and g(x,y) are subject to some constraint
G(f(x,y),g(x,y)) = 0
I wonder if there exists any (preferably Python based) solver (not a method, as I know the methods) that can deal with a problem of this kind? Would appreciate any help and apologise if my question seems to general.
Such a problem will require initial conditions and boundary conditions to be satisfied to obtain an unique solution. Also you will need to provide a domain (geometry) to the solver. I think you must look at finite element solvers in python.
Just a quick Google search provided few finite element solvers in python, however I have not tested any. So I guess that would be a good starting point.
If you are looking for a finite element solver, Fenics has python bindings.