simplification

Is minimization of boolean expressions NP-Complete?

I know that boolean satisfiability is NP-Complete, but is the minimization/simplification of a boolean expression, by which I mean taking a given expression in symbolic form and producing an equivalent but simplified expression in symbolic form, NP-Complete? I'm not sure that there's a reduction from satisfiability to minimization, but I...

How to optimize splitting in F# more?

This code is splitting a list in two pieces by a predicate that take a list and return false in the moment of splitting. let split pred ys = let rec split' l r = match r with | [] -> [] | x::xs -> if pred (x::l) then x::(split' (x::l) xs) else [] let res = split' [] ys let last = ys |> Seq.skip (Seq....

What ways are there to simplify the install of a php app for linux and hopefully windows as well?

I have a php application ( http://github.com/tchalvak/ninjawars ), essentially a php-based webgame that I run at http://ninjawars.net . I frequently configure and install the app for myself for localhost development, and it's a somewhat trial-and-error hacked-up process. Now that I've open sourced the app, I've got some users wishing t...

C#: How to simplify this string-of-numbers-to-various-date-parts-code

I have a string that might be between 1 and 8 characters long. I need to convert those into a day, a month and a year. For missing parts I will use the current one. The code I have now is kind of big and ugly, and I was wondering if someone have a more clever idea on how to do this. My current code is listed below: var day = DateTime....

Is It Possible To Simplify This Branch-Based Vector Math Operation?

I'm trying to achieve something like the following in C++: class MyVector; // 3 component vector class MyVector const kA = /* ... */; MyVector const kB = /* ... */; MyVector const kC = /* ... */; MyVector const kD = /* ... */; // I'd like to shorten the remaining lines, ideally making it readable but less code/operations. MyVector ...

Boolean Algebra Simplification

Need help have no idea the thought process in doing this kind of simplification. ! - Denotes NOT Lets say I have !((A+B) * (A+!B)) I need to simplify that using all rules except absortion. I know it is A * !B + !A * B but I need to know the process to get there. What is a good place to start. I do several different things but I never co...

PHP: Call a method on a returned class

I have a method which returns a class and want to call a method on it. Instead of $theClass = $this->getClass(); $theClass->foo(); I would like to write $this->getClass()->foo(); Is there a syntax for this as of PHP4? This works: $this->{$this->getClassName()}->foo(); But I would like to manipulate the class beforehand (I do th...

Simplified iphone In-app store implementation for built-in product features

This question is for those familiar with implementing the iphone in-app store functionality. The app I'm building has only built-in features that are unlocked when features are purchased. Further, any modifications or additions to store items will require an app update. Also, it is only in English so has no localized languages for t...

AS3: How to simplify Action Script 3 Code ?!

Here's a example that I've to use when I want to create a button with mouse-over effect: this.buttonExample.buttonMode = true; this.buttonExample.useHandCursor = true; this.buttonExample.addEventListener(MouseEvent.CLICK,myaction); I'm new to AS3 - is there any way, to simplify this code like this: this.buttonExample....

help with multiplying polynomials in lisp

for example: (3x2 - 5x + 2)(7x + 1) and you simplify it like this: ((3 2)(-5 1)(2 0))((7 1)(1 0)) ((21 3)(3 2)(-35 2)(-5 1)(14 1)(2 0)) (21 3)(32 2)(9 1)(2 0) and you get this answer: 21x3 + 32x2 + 9x + 2 i need this solution in lisp please help ...

Need help simplifying my php table

I am relatively new to php and have a feeling that I am going the long way round when displaying data from mysql. I have a table a I want to show a few fields from my database. How would I achieve this without having to echo every bit of the table??? Here is the code: <?php $query1 = mysql_send("SELECT firstname, lastname, email...

Is it possible to join these two regex expressions into one?

Hi folks, i have the following two regular expressions (in order btw). 1. ^~/buying/(.*)\?(.*) => foo= group 1 baa= group 2. 2. ^~/buying/(.*) => foo= group 1 baa= nothing/empty/null/baibai What's i'm trying to do is, if the url has a questionmark, then split it into two groups. Otherwise, just throw all the stuff into th...

Boolean Logic Simplification Issue

I hate this stuff. Just to note. + means OR * means AND ! means NOT. (A+B) * (A+C) * (!B + !C) (A | B) & (A | C) & (!B | !C) // more conventnal The answer is A(!B + !C) I'm trying to get there. So I start off with using Distributive rule which gets me here (A + B) * C * (!B + !C) and that's where I'm stuck. I know I some how hav...

Boolean Simplification

Hi, I have a boolean simplification problem that's already been solved.. but I'm having a hard time understanding one basic thing about it.. the order in which it was solved. The problem is simplifying this equation: Y = ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC The solution is: Y = ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC = ¬A¬B¬C + ¬AB¬C ...

simplifying and rearranging non-commutative variables in mathematica

this is a little complicated. i spent 2 weeks on this, so i'd love ur input or suggestion how to figure it out or where to post. in short, i have an expression that contains multiplications between p1,p2,q1 and q2, and i'd like to use [qi,pi]=ii*hb, where i={1,2} to get the expression to a symmetric form (pi^a*qi^b+qi^b*pi^a)/2. so for...

help simplifying function that adds and increments "image[]" into a array

I've been working a lot with forms lately and decided to make a php script to simplify some aspects that I see myself repeating, I won't post the full monstrosity that I have created, but instead I will ask you to help me simplify the following code if possible: function add($name,$input,&$array) { $p = explode('[',$name); if(isset($p...