equation

solving dynamic number of non-linear equations in python

亡梦爱人 提交于 2019-12-11 08:27:21
问题 Fsolve in Scipy seems to be the right candidate for this, I just need help passing equations dynamically. I appreciate any thoughts in advance. By dynamic I mean number of equations differ from one run to another for example one situation i have : alpha*x + (1-alpha)*x*y - y = 0 beta*x + (1- beta)*x*z - z = 0 A*x + B*y + C*z = D and another situation i have: alpha*x + (1-alpha)*x*y - y = 0 beta*x + (1- beta)*x*z - z = 0 gama*x + (1 -gama)*x*w - w =0 A*x + B*y + C*z + D*w = E alpha , beta , A

Error using fzero in Matlab: Undefined function or method 'det' for input arguments of type 'function_handle'

为君一笑 提交于 2019-12-11 08:08:39
问题 I have the same kind of problem described in this topic: Using fzero: Undefined function or method 'isfinite' for input arguments of type 'sym' Their answers really helped me, but I am still stuck. I also have to find the zeros of a function of w, this function is defined in several steps: So the only unknown is w, and I defined other objects such as: lambda= @(w) ((16*rho(i)*A(i)*w^2*Lprime(i)^2)/(E(j)*I(i)))^0.25; beta=@(w) lambda*b(i)^0.5; gamma=@(w) lambda*Lprime(i)^0.5; Then, I define a

Plotting position of robot joint graph does not work

醉酒当歌 提交于 2019-12-11 07:56:32
问题 I want to write a command to display equation of robot position and its graph. This is my command, but it did not display the graph: clear; clc; % initial position theta1s=-150; theta2s=-80; theta3s=-50; theta4s=-100; theta5s=-180; % final position theta1f=20; theta2f=100; theta3f=80; theta4f=50; theta5f=180; % time taken for movement tf=input('time=') % acceleration for every link acc1=(4.*(20-(-150)))./(tf^2) acc2=(4.*(100-(-80)))./(tf^2) acc3=(4.*(80-(-50)))./(tf^2) acc4=(4.*(50-(-100)))./

Solving a double integral equation for a third variable

Deadly 提交于 2019-12-11 07:19:23
问题 I've been trying to solve a double integral equation for a third variable in matlab. An example: At first, I tried to solve it symbolically (when k=1) as below: syms x y h F = @(x,y,h) 2*x*y+4*h; f = @(x) x/2; solve(int(int(F(x,y,h)*f(x),x,0,3)*f(y),y,0,1)-3, h) The code gives the right answer, i.e. h=2/3 when k=1. For my real problem, however, the functions F and f are so much more complex. And when I applied the same code above with the complex F and f, the matlab does not solve it in an

Java string-type equation double digit value issue

这一生的挚爱 提交于 2019-12-11 05:16:21
问题 I've been assigned to create a Java program which reads a string equation and calculates its value. But the code I've managed to create this far is only able to calculate single-digit integers. And I have no idea how to make my longer length integers work. What should my function look like in order to work with double or even triple digit integers? public class Ex8 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here

Using fzero: Undefined function or method 'isfinite' for input arguments of type 'sym'

半世苍凉 提交于 2019-12-11 04:50:32
问题 I use matlab for symbolic calculations. After long calculations I've got a function of x, which is the combination of bessel functions and I want to find it's zeros. For that purpose I use fzero function in Matlab. But while it works perfectly for single bessel functions, it wont work for the mine one. >> fzero(@(x)besselj(0,x), 3.5) ans = 2.4048 >> fzero(@(x)DELTA_xi, 3.5) ??? Undefined function or method 'isfinite' for input arguments of type 'sym'. Error in ==> fzero at 333 elseif

Including Exponents in jQuery?

最后都变了- 提交于 2019-12-11 04:16:35
问题 How do you implement exponents in JQuery? I'm modifying this: $.fn.sumValues = function() { var sum = 0; this.each(function() { if ( $(this).is(':input') ) { var val = $(this).val(); } else { var val = $(this).text(); } sum += parseFloat( ('0' + val).replace(/[^0-9-\.]/g, ''), 10 ); }); return sum; and $(document).ready(function() { $('input.price').bind('keyup', function() { $('span.total').html( $('input.price').sumValues() ); }); to calculate a more complex formula of summations from user

Equation that compute a Neural Network in Matlab

a 夏天 提交于 2019-12-11 02:01:24
问题 I created a neural network matlab. This is the script: load dati.mat; inputs=dati(:,1:8)'; targets=dati(:,9)'; hiddenLayerSize = 10; net = patternnet(hiddenLayerSize); net.inputs{1}.processFcns = {'removeconstantrows','mapminmax', 'mapstd','processpca'}; net.outputs{2}.processFcns = {'removeconstantrows','mapminmax', 'mapstd','processpca'}; net = struct(net); net.inputs{1}.processParams{2}.ymin = 0; net.inputs{1}.processParams{4}.maxfrac = 0.02; net.outputs{2}.processParams{4}.maxfrac = 0.02;

Parse equation to list of tuples in Python

大兔子大兔子 提交于 2019-12-11 00:34:31
问题 I want to parse equations and get a list of tuples. For example, when I enter 2x = 4+3y, I want to get [('', '2', 'x', '='), ('','4','',''), ('+','3','y','')] This is my regex so far: ([+-]*)([0-9]+)([a-z]*)([<=>]*) It works fine for the above query but it does not capture equations like 2 = x +3y , (where x does not have any coefficient) How do I capture that? 回答1: (\d*)(\w*) *(=) *(\d*)(\w*) *[+|\-|*|/] *(\d*)(\w*) How about this regex? It separates all operands and operators. (and inside

Python: Find a best fit function for a list of data

故事扮演 提交于 2019-12-10 14:02:59
问题 I am aware of many probabilistic functions builted-in python, with the random module. I'd like to know if, given a list of floats, would be possible to find the distribution equation that best fits the list? I don't know if numpy does it, but this function could be compared (not equal, but similar) with the Excel's "Trend" function. How would I do that? 回答1: Look at numpy.polyfit numpy.polyfit(x, y, deg, rcond=None, full=False)¶ Least squares polynomial fit. Fit a polynomial p(x) = p[0] * x*