Multiple constraints optimization problem in matlab


How can I solve an optimization problem with multiple constraints in matlab?
I am trying to solve for:

min g(M)
subject to
- If C(i,j) > a, then g(M(i,j)) > alpha
- If C(i,j) < b, then g(M(i,j)) < -alpha
- else, -alpha <= g(M(i,j)) <= alpha

I read about the optimization toolbox, but I couldn’t find an example similar to what I am trying to achieve. Is it possible to solve such an optimization problem?

EDIT: Concrete example

I tried using the “fmincon” tool, but couldn’t get it to work. The error message tells me that I did not give enough input arguments, but I can’t figure out why.
Here is a concrete example of such an optimization problem (I gave a special example for the function g, but in practice I would like to be able to plug in many different functions):

Consider $g(M)=sum_{i,j}{sqrt{|M_{i,j}|}}$,

Where

$M$ is a 3 by 3 matrix.

I reformulated slightly the optimization problem as follows

Solve $min_{M,gamma}{g(M)+gamma}$

subject to

$||M||_{1} < gamma$

$gamma > 0$

$C_{i,j} > a => M_{i,j} > alpha $

$C_{i,j} < b => M_{i,j} < beta$

$ b < C_{i,j} < a => beta < M_{i,j} < alpha$

with parameters:

$alpha = 0.5$

$beta = -0.2$

$a = 3$

$b = -1$

$C = left[begin{matrix}
-5 & 2 & 3 \
8 & -8 & 4 \
0 & 7 -& 1end{matrix}right]$

Show that the finite Abelian group is cyclic


Suppose that $G$ is a finite Abelian group that has exactly one subgroup for each divisor of |$G|$. Show that $G$ is cyclic.

What I have so far:

By the Fundamental Theorem of Finite Abelian Groups, we may write $G$ as $G=Z_{n_1}oplusdotsoplus Z_{n_k}$ for a set of $k$ integers $n_1$ through $n_k$ that are prime.

If $m$ divides the order of a finite Abelian group $G$, then $G$ has a subgroup of order $m$.

I am not sure what else I need to know.

If a sequence of continuous functions converges pointwise to a continuous function on $ [a,b] $, it converges uniformly


If a sequence of continuous functions converges pointwise to a continuous function on $ [a,b] $, it converges uniformly.

Looking at other theorems on the relationship between continuity and uniform convergence and how they require significant additional assumptions to assure uniform convergence, it seems like the above statement should be false in general. However I’m unable to find a counterexample. Any suggestions?

Finding $ max_{x in [2,4]} left| 2 x cos(2 x) – (x – 2)^{2} right| $.


This is a problem taken from Burden’s and Faires’ Numerical Analysis. Define $ f: Bbb{R} to Bbb{R} $ by
$$
forall x in Bbb{R}: quad
f(x) stackrel{text{df}}{=} 2 x cos(2 x) – (x – 2)^{2}.
$$
How can I rigorously prove, without sketching a graph, that $ displaystyle max_{x in [2,4]} |f(x)| = |f(4)| $? The problem is trivial if one sketches a graph.

$L$ is regular. Prove that $D(L)$ is also regular


I ask you for look at my solution:
$L$ is regular. Prove that $D(L)={w|ww^Rin L, winSigma^*}$ is also regular.

Idea
I go through states from two places (two fingers). When fingers meet in the same state I accept this word.

Formalisation
Automaton for $L:(Q,Sigma, delta, q_0, F)$
And for $D(L)(NFA):(Q’,Sigma, delta’, q_0′,F’)$
$Q’=Qtimes Q$
$delta’((q_1, q_2),ain Sigma) = {(delta(q_1,a), delta^{-1}(q_1)}$
$q_0′={(q_1, q_2):q_1 = q_0wedge q_2in F}$
$F’={(q,q)|qin Q}$

How to calculate the center of mass for a cloud of 3D spheres?


Given the spheres in 3D space: center(xi,yi,zi), radius and density and the info is stored in an array
sphere_data[n][5]:


// Sphere_ID x y z radius density

1 x1 y1 z1 rad1 density_1

2 x2 y2 z2 rad2 density_2

n xn yn zn radn density_n


So how to calculate the center of mass for this cloud of 3D sphere?

Any tips or recommendation would be appreciate.

If $n in mathbb N$, under what conditions are $n$ and $n+2$ relatively prime?


The Statement of the Problem:

If $n in mathbb N$, under what conditions are $n$ and $n+2$ relatively prime?

My Thoughts:

I know that the answer is that $n$ must be odd. However, I’m not sure how to prove it. Technically, the question doesn’t ask to prove it, but I feel like I should be able to. So, I’m trying to find a way to represent $n$ as both an odd and an even number, break it into cases, then derive a contradiction in the even case using some sort of feature of relatively prime number (e.g. integer combinations). I feel like this should be really easy, but I’m sitting here scratching my head. Any help here would be appreciated.

What are some tips/techniques that might help me solve this (brutal) differential equation?


I’ve been working on a certain physics problem involving differential equation for two years. I’ve made some progress on it recently, but I’ve come across another roadblock, namely an integral that I have no idea how to compute. What are some tips or techniques that might help me evaluate it? I’ve been having trouble with it because I’ve nev taken a diff-eq class, although I’m also aware that this is a difficult problem in itself (non-linear second order equation). Please note: I do NOT want the solution the the problem, just the tools to solve it myself.

Here’s the problem:

There is a fixed massive body at the origin and another object on the x axis with some initial velocity in the x direction. Find an equation that describes the position of the orbiting object with respect to time.

Here is my work so far. Let me know if I’ve made a mistake. Note that a is the derivative of v, which is the derivative of r, and G,M, and m are constants.

Start with $F=ma$

The gravitational force between two objects is $$F_g=-frac{GMm}{r^2},$$ so
$$-frac{GMm}{r^2}=ma$$ and $$-frac{GM}{r^2}=a.$$

Now, $$a=frac{dv}{dt}=frac{dv}{dr}frac{dr}{dt}=vfrac{dv}{dr},$$ so
$$-frac{GM}{r^2}=vfrac{dv}{dr}$$
$$-frac{GM}{r^2}dr=vdv$$
Integrating both sides I get
$$int_{r_o}^{r}-frac{GM}{r^2}dr=int_{v_o}^{v}vdv$$ where$r_o$ and $v_o$ are initial radius and velocity. This becomes$$frac{GM}{r}-frac{GM}{r_o}=frac{1}{2}(v^2-v_o^2)$$
$$pmsqrt{frac{2GMr_o-2GMr+v^2_or_or}{rr_o}}=frac{dr}{dt}$$
$$pmint_{r_0}^{r}sqrt{frac{r_or}{2GMr_o-2GMr+v^2_or_or}}dr=int_{0}^{t}dt$$
$$pmint_{r_0}^{r}sqrt{frac{r_or}{2GMr_o-2GMr+v^2_or_or}}dr=t$$
Which is obscene.

I just have no idea how to do this. I’ve tried rewriting it all sorts of ways with little to no luck. What can I do?

Prove that language is context-free $C={x#y mid x,yin {a,b}^*wedge xneq y}$


Prove that this language is context-free: $C={x#y|x,yin {a,b}^*wedge xneq y}$.
I try to construct a grammar:
$Srightarrow C_a#C_b|C_b#C_a$
$C_arightarrow XC_aX|a$
$C_brightarrow XC_bX|b$
$Xrightarrow a|b$

Is it good ? I can try to prove it.

Edit
$Srightarrow C_abY|C_baY$
$C_arightarrow XC_aX|aY#$
$C_brightarrow XC_bX|bY#$
$Yrightarrow Ya|Yb|epsilon$
$Xrightarrow a|b$
$Srightarrow RT | TR$
$Rrightarrow aRa | aRb|bRa|bRb |#$
$Trightarrow a|b|Ta|Tb$

How does SIM unlocking work under the hood?


I know what SIM unlocking is and how to do it, but my question is how does SIM unlocking work under the hood? What is actually going on that prevents me from just popping another carriers SIM in there?

More importantly, since many of us have root access, unlocked bootloaders, and S-OFF for the HTC folks why are there no easy “flash this ROMfile and unlock your phone” scenarios? Is the locking mechanism physically present on the Qualcomm chip and not actually part of the Android system? I would think it would be in the radio partition or EFS.

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam