@Evert's answer shows how you can do this by using either a closure or by using functools.partial, which are both fine solutions. Another alternative is provided by many numerical solvers. Consider, for example, scipy.optimize.fsolve. That function provides the args argument, which allows you to pass additional fixed arguments to the...

I think you should use sp.log instead of np.log. I run your code but it seems like the equation is too complex and no algorithms are implemented to solve it.

solver,isabelle,associativity,commutativity

Reasoning upto associativity and commutativity is usually done in Isabelle with the simplifier and ordered rewriting. In your example, you provide the simplifier with the associativity rule (oriented from left to right), the commutativity rule, and the left-commutativity rule. The details are explained in the Tutorial on Isabelle/HOL (Section 9.1,...

matlab,signals,solver,ode,square

A partial answer: If you put the line fprintf('%g\t%g\n', t, y) into your function test, you will see that the solver calls the function only at values of t where y is 24: 0 24 0 24 0 24 1.57072e-14 24 1 24 2 24 3 24 4 24 5...

matlab,solver,symbolic-math,symbolic-computation

Try adding the Real option to solve: solve(f(x)>0,x,'Real',1) ans = Dom::Interval(2^(1/2), Inf) Dom::Interval(-2^(1/2), 0) ...

c++,cuda,linear-algebra,solver,cusolver

1.cusolverSpScsrlsvchol returns wrong results for x: 1 3.33333 2.33333 1 3.33333 2.33333 1.33333 1 2.33333 1.33333 0.666667 1 1 1 1 1 You said: A is positive definite and symmetric. No, it is not. It is not symmetric. cusolverSpcsrlsvqr() has no requirement that the A matrix be symmetric. cusolverSpcsrlsvchol()...

Short version This is definitely possible! You can use the callback-function StartFcn in the model properties (or in the block itself). This function is being executed each time the model is being simulated. Then add a check for the solver-type that throws an error if it is set to Fixed-step....

vba,excel-vba,excel-2010,solver,excel-2013

Convergence, and also all other SolverOptions can be set using cell values, for example Convergence:= Range("A1").value. Value2 is a little faster than Value, and it is good practice to explicitly cast to double the cell value (and also trap any errors). Another way is to add the values as named...

matlab,simulink,solver,ode,differential-equations

Can you solve it in closed form? Looks doable to me. I advise anyone to have the answer in hand if possible before you start a numerical solution. Here's what I get. Check me: y(x) = e^(-x)*(8e^3x + 3e^4x + 1)/12 Wolfram Alpha says this is correct. (Note: Trouble for...

Did you check the documentation of Math.NET? There is page about how to solve linear equations.

solver,isabelle,theorem-proving

I just asked Tobias Nipkow and this is what he told me: presburger is a decision procedure for Presburger arithmetic, i.e. linear arithmetic on natural numbers and integers, plus some pre-processing, which is why your statement with real could be proven as well (as it boils down to a problem...

matlab,wolfram-mathematica,solver

Building on what jlandercy said, you can certainly use MATLAB's linprog function, which is MATLAB's linear programming solver. A linear program in the MATLAB universe can be formulated like so: You seek to find a solution x in R^n which minimizes the objective function f^{T}*x subject to a set of...

I have a strong suspicion that your equation was supposed to include -t_pw/f0, not -t_pw*f0, and that t_pw was supposed to be 3.0e-9, not 30e-9. Pfun <- function(b,f0=1e-9,t_pw=3.0e-9, a=30.7397582453682, c=6.60935546184612) { 1-exp((-t_pw)/f0*exp(-a*(1-b/c)^2)) } Then @Lyzander's uniroot() suggestion works fine: u1 <- uniroot(function(x) Pfun(x)-0.5,c(6,10)) The estimated value here is 8.05. par(las=1,bty="l")...

linear-programming,solver,ms-solver-foundation

(Note: no new releases of Solver Foundation are forthcoming - it's essentially been dropped by Microsoft.) The stack trace indicates that this is a bug in the simplex solver's presolve routine. Unfortunately the SimplexDirective does not have a way to disable presolve (unlike InteriorPointDirective). Therefore the way to get around...

python,numpy,matplotlib,scipy,solver

Notice that the result is actually real, up to numerical precision. e-30 is really a small number. The solutions reported are also consistent with the plot, so nothing to worry about.

discrete-mathematics,solver,simulated-annealing,rostering,tabu-search

If you go with OptaPlanner and don't want to follow the Employee Rostering design of assigning 8 hours Shifts (planning entities) to Employees (planning value), because of your 2th constraint, then you could try to follow the Cheap Time Example design, something like this: @PlanningEntity public class WorkAssignment { Employee...

Typically, for something like Newton's method, there are a number of termination criteria: An upper bound on the number of iterations. It is possible that the routine may get "stuck" or diverge such that if you do not find a root, you should exit after a certain max iterations. A...

r,optimization,solver,maximize,lpsolve

What if you added something similar to the way you did the roles to con? If you add t(model.matrix(~ Team + 0, DF)) you'll have indicators for each team in your constraint. For the example you gave: > con <- rbind(t(model.matrix(~ Role + 0,DF)), t(model.matrix(~ Team + 0, DF)), rep(1,nrow(DF)),...

There are a few options in Sage with solve, and this one seems to help (I assume the answer is okay). sage: solve(sqrt(x)==sqrt(20*(1500-x)),x,to_poly_solve=True) [x == (10000/7)] ...

python,recursion,probability,solver

If each board in the children variable is a state after a random tile has been spawned, wouldn't you need to add 1 to the number of empty tiles since the spot where the new tile spawned was empty before it spawned there? weights[section]*(1/(num_empty(board)+1))) That being said, calling a function...

excel,vba,excel-vba,random,solver

What you might do is to create your own =RAND() function (let's call it MYRAND() function) that takes an ON/OFF input. The idea is: You open the VBE Editor and add a module to your workbook; You insert your "Random on/off function", something like this: Public Function MYRAND(ByVal activation As...

You can use the Address property of the Range object to loop through all 300 columns. First you need 3 variables to hold locations of SetCell, ValueOf, and ByChange. Dim setCellRange as Range, valueOfRange as Range, byChangeRange as Range Set setCellRange = ActiveSheet.Range("B20") Set valueOfRange = ActiveSheet.Range("B3") Set byChangeRange =...

r,mathematical-optimization,solver,nonlinear-optimization

Try different starting values (initScal) than zero; the sum( w * 0^2) = 0 for all w.

solver,isabelle,theorem-proving

There generally is no linear ordering on the strength of proving methods and your word "weakest" assume there is one. We can nevertheless say that "auto" generally have at least the power of "simp" or "rule" but as it is more powerful it can also do some useless work that...