C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# Creating formula

By : user2172703
Date : October 22 2020, 08:10 PM
I wish this help you First we need to analyze the conditions and what each variable does.
X apparently provides the upper bound for Z, so Z = min(X, ???) conditions are only provided for Y >= 2, with Z being fixed as 0, if Y = 1 floor(Y / 2) = Z within the above range
code :
``````if Y < 1 or X < 1:
some error ???
elif Y == 1
Z = 0
else
Z = min(X, floor(Y / 2))
``````

Share :

## Creating excel chart by creating a formula?

By : 毛毛亘尧
Date : March 29 2020, 07:55 AM
this one helps. Creating a chart would be easier if you kept all of the answers in column F and all of the corresponding questions in column E. Then you could create a Pivot Chart (Insert > Pivot Table > Pivot Chart) with columns E and F as a source.
When you've done so, drag "Answers" to the "Values" zone, and to the "Row Labels" zone. Drag "Questions" to the "Report Filter" zone. Select the chart, click on the "Pivot Chart Tools" tab on the Ribbon, click "Change Chart Type", and select "Pie Chart" in the list. The chart is filtered by question: you can display the answers for a selected question, or for all of the questions combined.

## Creating dynamic formula

By : Jim Cracks
Date : March 29 2020, 07:55 AM
There are a couple options here and it depends on your needs and whether you need something very complex or something just simple to understand and expand upon (maybe for academic purposes).
code :
``````public class DynamicFormula
{
/// <summary>
/// This simply stores a variable name and its value so when this key is found in a expression it gets the value accordingly.
/// </summary>
public Dictionary<string, double> Variables { get; private set; }

/// <summary>
/// The expression itself, each value and operation must be separated with SPACES. The expression does not support PARENTHESES at this point.
/// </summary>
public string Expression { get; set; }

public DynamicFormula()
{
this.Variables = new Dictionary<string, double>();
}

public double CalculateResult()
{
if (string.IsNullOrWhiteSpace(this.Expression))
throw new Exception("An expression must be defined in the Expression property.");

double? result = null;
string operation = string.Empty;

//This will be necessary for priorities operations such as parentheses, etc... It is not being used at this point.
List<double> aux = new List<double>();

foreach (var lexema in Expression.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries))
{
//If it is an operator
if (lexema == "*" || lexema == "/" || lexema == "+" || lexema == "-")
{
operation = lexema;
}
else //It is a number or a variable
{
double value = double.MinValue;
if (Variables.ContainsKey(lexema.ToLower())) //If it is a variable, let's get the variable value
value = Variables[lexema.ToLower()];
else //It is just a number, let's just parse
value = double.Parse(lexema);

if (!result.HasValue) //No value has been assigned yet
{
result = value;
}
else
{
switch (operation) //Let's check the operation we should perform
{
case "*":
result = result.Value * value;
break;
case "/":
result = result.Value / value;
break;
case "+":
result = result.Value + value;
break;
case "-":
result = result.Value - value;
break;
default:
throw new Exception("The expression is not properly formatted.");
}
}
}
}

if (result.HasValue)
return result.Value;
else
throw new Exception("The operation could not be completed, a result was not obtained.");
}
/// <summary>
/// Add variables to the dynamic math formula. The variable should be properly declared.
/// </summary>
/// <param name="variableDeclaration">Should be declared as "VariableName=VALUE" without spaces</param>
{
if (!string.IsNullOrWhiteSpace(variableDeclaration))
{
var variable = variableDeclaration.ToLower().Split('=');    //Let's make sure the variable's name is LOWER case and then get its name/value
string variableName = variable[0];
double variableValue = 0;

if (double.TryParse(variable[1], out variableValue))
else
throw new ArgumentException("Variable value is not a number");
}
else
{
//Could throw an exception... or just ignore as it not important...
}
}
}
``````
``````    private void btCalculate_Click(object sender, RoutedEventArgs e)
{
string expression = tboxExpression.Text;    //"cost * item / 100" (IT MUST BE SEPARATED WITH SPACES!)
string variable1 = tboxVariable1.Text;      //"item=10"
string variable2 = tboxVariable2.Text;      //"cost=2.5"

DynamicFormula math = new DynamicFormula();
math.Expression = expression;   //Let's define the expression

try
{
double result = math.CalculateResult(); //In this scenario the result is 0,25... cost * item / 100 = (2.5 * 10 / 100) = 0,25
//Console.WriteLine("Success: " + result);
tboxResult.Text = result.ToString();
}
catch(Exception ex)
{
//Console.WriteLine(ex.Message);
tboxResult.Text = ex.Message;
}
}
``````

## Need help creating a somewhat odd Excel formula

By : Patrick Geery
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , This doesnt sound recursive the way you describe it.
Put this formula somewhere on the sheet and see if this is what you want:

## Creating R's formula using Python

By : user3727672
Date : March 29 2020, 07:55 AM
it fixes the issue to @nicola, I was able to solve this problem by doing the following:
code :
``````create_formula <- function(target_variable, other){
# y <- target_variable
# tilda <- '~'
# form_begin <- paste(y, tilda, sep=' ')
# fmla <- as.formula(paste(form_begin, paste(other, collapse= "+")))
# return(fmla)
y <- target_variable
fmla = as.formula(paste(y, '~ .'))
return(fmla)
}
``````
``````        if self.smogn:
smogned = runit.WFDIBS(

# here is the formula call (get_formula is a python function that calls create_formula defined above in R)
fmla=get_formula(self.target_variable, self.other),

# here is the data
dat=df_combined,

method=self.phi_params['method'][0],
npts=self.phi_params['npts'][0],
controlpts=self.phi_params['control.pts'],
thrrel=self.thr_rel,
Cperc=self.Cperc,
k=self.k,
repl=self.repl,
dist=self.dist,
p=self.p,
pert=self.pert)

``````

## Creating a sin formula in C

By : Vijay
Date : March 29 2020, 07:55 AM
may help you . Your mySin function is wrong in at least 5 separate ways. Using ** to represent exponentiation (to avoid confusion with xor), the correct formula is