How would I take data from an Excel tab and create a list for use in a Classify function?

I would like to do the following:

  1. Load data from a single tab of an Excel workbook into a Mathematica table.
  2. Prepare the data for use with the Mathematica Classify function.

The training set that I want to pass into Classify would be:

{{cell[2,1],cell[2,2],cell[2,3]}->cell{2,7},  {cell[3,1],cell[3,2],cell[3,3]}->cell{3,7}, ...    ,{cell[n,1],cell[n,2],cell[n,3]}->cell{n,7}} 

I have no problem importing the Excel data into a table.

I am unsure as to how this data would be converted into a list for use with Classify.

c code to find the line number in the function argument string

    #include<stdio.h>     #include<string.h>     unsigned int FindFunctionDefn( const char* strFunctionName, const char*      strSourceCode ){     int n = strlen(strSourceCode);     int m = strlen(strFunctionName);     int i = 0;     unsigned int  line = 0;     char new[300];     strcpy(new,"");     int p;     char u[1];     for(i=0;i<n;i++)     {   if (strSourceCode[i]!='\n'){     u[0] = strSourceCode[i];     strcat(new,u);     }      if (strSourceCode[i] == '\n'){     line = line + 1;     p=strstr(new,strFunctionName);     printf("%d",p);     if (p!=NULL){     printf("%s \n",p);     printf("%u",line);     return line;     }      else     {     strcpy(new,"");     }     }      }      }            int main(int argc, const char * argv[]){     const char strFunctionName[] = "func2";     const char strSourceCode[] =  "int func1(){ return 0; }\n int      func2(){ return 1; }\n" "int main(int argc, char*argv[]){ return      func2(); }\n";     FindFunctionDefn( strFunctionName, strSourceCode );     }       [![this is the code in codeblock[![\]\[1\]][1]][1]][1] 

the following C function: unsigned int FindFunctionDefn( const char* strFunctionName, const char* strSourceCode ); FindFunctionDefn takes two strings as inputs: a function name and a program string; it returns as an output the line number that contains the function definition (differentiate this with the function calls) in the program string. The program string is a valid C code; it contains a character “\n” indicate the end of a line with the line number starts from one. The program string is guaranteed not to contain any C (or C++) comments. The function FindFunctionDefn returns 0 if it fails to find the function definition. For example, char strFunctionName[] = “func2”; char strSourceCode[] = “int func1(){ return 0; }\n int func2(){ return 1; }\n” “int main(int argc, char*argv[]){ return func2(); }\n”; FindFunctionDefn( strFunctionName, strSourceCode ) should return 2. but i am not getting any output please clarify what have i done wrong thanks

If you have two recursive calls in a function and one terminates before the second how do you calculate the time complexity?

Suppose you have a function which calls to itself twice. So both go down recusively until they reach some condition. But one of them will go less times than the other. For example one would call itself n times until it terminates while the second calls itself merely n-5 times.

How do I go by, calculating the lower bound. I assume, for the upper bound you just go about calculating the bigger path of n levels. But how would you calculate the lower bound?

How to extract envelope for piecewise defined function?

I have a plot generated from an ugly and complex set of piece-wise functions. I’m looking to extract the envelope function from this data set. I’ve tried a lot of suggestions in other threads, but none seem to contain information about dealing with piece-wise functions. I’ve tried using a Fourier series, but that didn’t seem to give me what I was looking for. The plot is located belowenter image description here

Spaces In scanf Function

I have wrote the following code:

#include <stdio.h>  int main(){      int task;     char input_1, input_2, input_3, input_4;      scanf("%d",&task);     switch(task){         case 1:             scanf("%c %c %c %c", &input_1, &input_2, &input_3, &input_4);              break;         case 2:              printf("%c",'2');             break;         case 3:             printf("%c",'3');             break;         default:              printf("%s","wrong");     }  return 0; } 

Now the the variable input_1 get a value of ‘/n’ when pressing 1+enter+a. To solve this I change it to:

#include <stdio.h>  int main(){      int task;     char input_1, input_2, input_3, input_4;      scanf("%d",&task);     switch(task){         case 1:             scanf(" %c %c %c %c", &input_1, &input_2, &input_3, &input_4);               break;         case 2:              printf("%c",'2');             break;         case 3:             printf("%c",'3');             break;         default:              printf("%s","wrong");     }  return 0; } 

But I still try to understand why in the first code ‘/n’ was assigned to input_1

Why isn’t my function evaluating to an explicit number?

I’m just wondering why my function is not evaluating as I think it should. I put in the following:

dp = {{0, 71}, {1, 71}, {2, 71}, {3, 70}, {4, 69}, {5, 67}, {6,65}, {7, 63}, {8, 61}, {9, 60}, {10, 60}, {11, 61}, {12, 63}, {13,65}, {14, 66}, {15, 67}, {16, 67}, {16, 67}, {17, 66}, {18,65}, {19, 63}, {20, 60}, {21, 58}, {22, 56}, {23, 55}}; f = Fit[dp, {1, x, x^2, x^3, x^4, x^5, x^6, x^7}, x]; f[3] 

but as output I get

(71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7)[3] 

The output I want is the polynomial’s value at x=3.

Recursive Binary Search Tree Insert Function Using Generic Nodes

I am trying to code a function that adds a generic node to a binary search tree in the correct position. The node uses generic . I get a stack overflow error when adding a good amount of data to the BST and cannot understand why. I start the search with the root node every time. The code is somewhat complex because I wanted to have a parent pointer, but if this is much simpler without the parent pointer or there is a better way to implement that, please let me know. What error am I making in my recursion?

public Node(K k, V v) {         this.L = null;         this.R = null;         this.parent = null;         this.key = k;         this.value = v;     }  protected boolean insert(Node curNode, K key, V value) {         int result = key.compareTo(curNode.key);         if(result == 0){             return false;         }         else if(result < 0){             if(curNode.L != null)                 return insert(curNode.L, key, value);             else{                 Node toAdd = new Node(key, value);                 toAdd.parent = curNode;                 curNode.L = toAdd;                 return true;             }         }         else if(curNode.R != null)                 return insert(curNode.R, key, value);             else {                 Node toAdd = new Node(key, value);                 toAdd.parent = curNode;                 curNode.R = toAdd;                 return true;             }         } 

Is there any difference between these two solutions for finding generating function?

Consider the following question.

Find the generating function for the number of integer solutions to the equation $ c_{1}+c_{2}+c_{3}+c_{4}=20$ where $ -3\leq c_{1}, -3 \leq c_{2}, -5\leq c_{3}\leq 5, $ and $ 0 \leq c_{4}$ .

  • The first solution: $ $ (c_{1} + 3)+(c_{2}+3)+(c_{3}+5)+c_{4}=20 + 3 + 3 + 5 \Rightarrow c_{1}’+c_{2}’+c_{3}’+c_{4}’=31 $ $ where $ 0\leq c_{1}’, 0 \leq c_{2}’, 0\leq c_{3}’\leq 10, $ and $ 0 \leq c_{4}’$ . The generation function is $ f(x) = (x^{0}+x^{1}+…)^{3}(x^{0}+x^{1}+…+x^{10})$ , and the number of integer solutions is the coefficient of $ x^{31}$ in $ f(x)$ .

  • The second solution (My solution): $ $ g(x) = (x^{-3}+x^{-2}+…+x^{3})^{2}(x^{-5}+x^{-4}+…+x^{5})(x^{0}+x^{1}+…)$ $ , and the number of integer solutions is the coefficient of $ x^{20}$ in $ g(x)$ .

My question: In the solution manual book, the presented solution is the first solution, but I think that the second solution is correct, and it is simpler than the first solution. Is my solution correct? What is the difference between these two solutions?