The solution given says that let m = lg n. Recurrence becomes S(m) =S(m/2) + theta(lgm). Case 2 of master’s theorem applies. But how come case

# Tag: Solving

## Solving indexed ODE in Mathematica

I would like to solve an ODE with indexed variables symbolically. Is there a way to do that? $ $ \frac{dp_{\beta\alpha}}{dt}=m\left(p_{1\alpha}p_{\beta2}+p_{2\alpha}p_{\beta1}\right)$ $ m is called mass and is constant. t is time.

## solving algebraic puzzle using the mathematica

I have tried to solve this algebraic puzzle,

$ $ abc+abc+abc=ccc$ $

using mathematics but I don’t know what I am doing wrong. Can you help me?

**I have tried these three ways**

$ $ Reduce[3 (100 a + 10 b + c) == 100 c + 10 c + c, 0 <= a <= 9, 0 <= b <= 9, 0 <= c <= 9, Integers]$ $

$ $ Solve[3 (100 a + 10 b + c) == 100 c + 10 c + c, 0 <= a <= 9, 0 <= b <= 9, 0 <= c <= 9, Integers]$ $

$ $ FindIntance[3 (100 a + 10 b + c) == 100 c + 10 c + c, 0 <= a <= 9, 0 <= b <= 9, 0 <= c <= 9, Integers]$ $

## Solving integral involving absolute value of a vector

I am trying to integrate the following in mathematica:

$ \int_0^r \frac{exp(-k_d(|\vec{r}-\vec{r_j}|+|\vec{r}-\vec{r_i}|)}{|\vec{r}-\vec{r_j}|\times|\vec{r}-\vec{r_i}|}r^2dr$ .

I have first defined, the following functions,

$ \vec p(x,y,z)= (x-x_j)\hat i + (y-y_j)\hat j+(z-z_j)\hat k$

Similarly,

$ \vec q(x,y,z)= (x-x_i)\hat i + (y-y_i)\hat j+(z-z_i)\hat k$ .

And,

$ \vec r(x,y,z)=x\hat i + y\hat j+z\hat k $

Then I clicked the integration symbol in the classroom assistant panel and typed the integrand in the $ expr$ portion. While typing this, I have used $ Abs$ to take modulus of the functions $ \vec p(x,y,z)$ and $ \vec q(x,y,z)$ . I have included the limits as $ 0$ to $ Abs(r)$ and the $ var$ as $ r$ in the integration symbol. But when I press( Shift + Enter ) no output value is shown . Can anyone tell me where I have made mistake ?

## Solving symoblic system of non-linear equations takes too long

I am trying to solve a set of system of symbolic non-linear equations:

`g1 = ptz + pz + 2 pty q0 q1 - 2 ptz q1^2 + 2 px q0 q2 - 2 pz q2^2 - 2 px q1 q3 - 2 pty q2 q3 - 2 ptz q3^2 - 2 pz q3^2 ; g2 = 2 (ptx q0 q1 + px q0 q1 + ptz q1 q2 - pz q1 q2 + ptz q0 q3 + pz q0 q3 - ptx q2 q3 + px q2 q3); g3 = ptx + px - 2 ptx q1^2 - 2 px q1^2 - 2 pz q0 q2 - 2 pty q1 q2 - 2 px q2^2 - 2 pty q0 q3 - 2 pz q1 q3 - 2 ptx q3^2 ; g4 = -2 pty q0 q2 - 2 py q0 q2 + 2 ptz q1 q2 - 2 pz q1 q2 - 2 ptz q0 q3 - 2 pz q0 q3 - 2 pty q1 q3 + 2 py q1 q3 ; g5 = ptz + pz - 2 py q0 q1 - 2 pz q1^2 - 2 ptx q0 q2 - 2 ptz q2^2 - 2 ptx q1 q3 - 2 py q2 q3 - 2 ptz q3^2 - 2 pz q3^2 ; g6 = -pty - py - 2 pz q0 q1 + 2 py q1^2 + 2 ptx q1 q2 + 2 pty q2^2 + 2 py q2^2 - 2 ptx q0 q3 + 2 pz q2 q3 + 2 pty q3^2 ; g7 = q0^2 + q1^2 + q2^2 + q3^2; NSolve[{g1 == 0, g2 == 0, g3 == 0, g4 == 0, g5 == 0, g6 == 0, g7 == 1}, {q0, q1, q2, q3}, Reals] `

Here all variables except q0, q1, q2 and q3 are considered fixed. The variables represent a unit quaternion. Testing for corner cases (by setting single element of quaternion to 0) reveals that these set of equations don’t have a solution, which is what I intend to prove. But the code takes too long to run. Any suggestions would be appreciated.

I could treat the elements of quaternion and the permutations of the elements as separate variable and solve the system as Linear Equations, which I did for the corner cases. But here I don’t have enough constraints (10 unknowns with 7 constraints) and hence can’t employ that method.

## How to leverage the fact that I’m solving 1000’s of very similar SMT instances?

I have a core SMT solver problem consisting of 100,000 bit-vector array clauses, and one 10000-dimensional bit-vector array. Then, my program takes as input k << 100,000 new clauses, and adds them to the core SMT problem. My goal is, for any input of k clauses, to solve the entire problem.

Is there any static optimization or learning I could do on the core problem in order to find a better way to solve each of its siblings? For instance, is there some property of the graph of bit-vector variables being constrained in each clause that I could use as a heuristic for solving the specific instances?

Thanks!

## Solving subset-sum encryption (Princeton Creative Assignment)

The question: https://www.cs.princeton.edu/courses/archive/spring03/cs226/assignments/password.html

Input files: ftp://ftp.cs.princeton.edu/pub/cs226/password/

The question asks to use a symbol table for faster decryption. The implementation of symbol table can be either using hash table or BST. I am pretty sure we have to use a hash table as each element in the table can contain linked lists for sums that can be obtained using every subset. There are 5*c possible subsets (given in the txt file) and 2^(5*c) possible ways of adding these subsets.

I am not sure if this is efficient enough. The linked lists will be extremely toward the top of table and get exponentially smaller (by power of 2) toward the bottom. Lookup time will definetely not be constant.

This question is part of the creative assignments released by Princeton from their COS226 course. The links are given above.

## trouble solving the recurrence 4T(n/2) + n

I am having trouble figuring out how to solve this recurrence problem…

$ $ \begin{aligned} &4T(n/2) + n \ = &4(4T(n/4) + n/4) + n \ = &16T(n/4) + 2n \ = &4^kT(n/2^k) + kn \end{aligned} $ $

I lose the trail here and I cannot figure out how to finish it and actually find the complexity. Can anyone help? How can this be done?

## Solving the Knapsack problem in $O(n^2P)$, where P is the maximum weight of all items

Assume for the regular knapsack problem we have additional information – maximal weight of every item – lets denote it as P. Using this information, I want to solve the problem using dynamic programming in $ O(n^2P)$ . Anyone have an idea how to solve it?

## Problem solving an exercices in system architecture

So hey guys hope you are doing well. I have aproblem solving this exercices. I have tried a lot but it seems my answer are always wrong first here is the problem:

In the case where these registers have the following values:

AX = 13C4; BX = 324F; CX = 2200; BP = 1500, DS = 3000; SS = 5000; SI = 1100; DI = 2000

Calculate the physical address of the memory where the operand is saved, as well as the content of the memory locations in each of the following addressing modes: at.

MOV [2000], AX

b. MOV [SI],

AL vs. MOV [BX], CX

d. MOV [DI + 25], AX

e. MOV [BP], BX