## numerical integration – How add noise to a differential equation?

I have a differential equation:

$$frac{dx}{dt}=sech(x-1)$$

I want to add noise to it and try to solve it numerically, but it seems that I am programming something wrong, because there is no noise. I am trying to do this by adding a random number.

``````ClearAll("Global`*")

pars = {(Alpha) = 1, (Beta) = 1/20, (Gamma) = 1,
h = 1, (Omega) = 2 Pi 1/2, (Mu) = 1, xs = -1, xe = 1}

f = Sech(x(t) - xe)

sys = NDSolve({x'(t) ==
ArcTan(1 D(f, x(t))) + RandomReal({-1/10, 1/10}),
x(0) == xs}, {x}, {t, 0, 500})

Plot({Evaluate(x(t) /. sys), xe}, {t, 0, 10}, PlotRange -> All,
PlotPoints -> 40)
``````

Posted on

## Condition for a cubic equation to have a single root

If a cubic equation

$$f(x) = ax^3+bx^2+cx+d$$

Is given, what is the condition for the equation to only have a single root (counting multiple roots as one)

## equation solving – Can I calculate the reciprocal of a harmonic series in wolfram mathematica?

hello this way is how you solve an harmonic series in mathematical.
with the first 10 values

``````Sum[1/n,{n,1,10}] # solution is 2.49
``````

i want know how to do it this if i want reach up a number like 5

how many values i need for get 5 as a result. do you understand me?

Posted on

## How to Solve a simple Functional equation

As a newbie in Mathematica, I am currently trying to limit test what the software can actually do (and not do). Thus, I have reached the following problem.

What I want to do, is to construct a functional equation of three functions (2 known and 1 unknown) and solve it analytically. For example, consider the following code:

``````f(x_) := x^2
g(x_) := x^5
RSolve(h(x) == g(x) * f(x), h(x), x)
``````

where the solution for h(x) is trivially h(x) = x^5. However, mathematica throws the following error: So, is something like that possible?

Thank you,

Posted on

## integration – How would you find the original function from the Second Derivative given 2 coordinates of the original equation?

Given the second derivative and two coordinates of the original function, how would I find the original function? Most problems I have found online seem to give an xy pair for both the first derivative and the original function, but this question does not. How would you solve for C for the first derivative without that pair? Here’s an example of one of the questions:

$$f”(t) = 2e^t +3sin(t)$$
$$f(0) = -7, f(pi) = -8$$

Posted on

## pr.probability – A functional equation involving the inverse function

$$newcommandepepsilonnewcommandR{mathbb R}$$Let $$P$$ denote the set of all continuous probability density functions (pdf’s) $$p$$ on $$R$$ vanishing at $$pminfty$$. Let us say that a pdf $$pin P$$ is good if for each small enough $$ep>0$$ the functional equation
$$g(x)-g^{-1}(x)=ep, p(x)quadforall xinRtag1$$
has a solution $$gcolonRtoR$$, which is an increasing continuous function such that $$g(x)>x$$ for all real $$x$$.

It is clear that, if a pdf $$pin P$$ is good, then for any real $$a$$ and any real $$b>0$$ the pdf $$p_{a,b}$$ given by the formula $$p_{a,b}(x):=b,p(a+bx)$$ for real $$x$$ is good as well.

The problem here is to characterize the set of all good pdf’s $$pin P$$.

Of course, there is always a tautological characterization: a pdf $$pin P$$ is good if and only if it is good. Any non-tautological characterization would be of interest, including incomplete ones, such as conditions that are only sufficient or only necessary for the goodness. In particular, it would be of interest to know if the “triangular” pdf $$p_triangle$$ given by the formula $$p_triangle(x):=max(0,1-|x|)$$ for real $$x$$ is good.

This question is related to this answer.

Posted on

## “Further output of NIntegrate” ERROR at diffusion equation

Good day everybody,

I am trying to solve the diferential equation for diffusion:

dt(u)=A*dx(u^(m)*dx(u)),

where “m” is the difussion coefficient. In this case, I am trying to make “m” a function of x, and solve the equation numerically.

``````GCo = First(u /. NDSolve({D(u(x,t),t)==dCo*D((u(x,t)^mCo(x)*D(u(x,t),x)),x),(D(u(x,t),x)./->-20)=0,(D(u(x,t),x)./->40)=0,u(x,0)=FC0(x)},u,{x,-20,40},{t,0,10}))
``````

Where “FCo(x)” is the initial conditions.

I get the following errors:

“General::stop: Further output of NIntegrate::nlim will be suppressed during this calculation.”

“General::stop: Further output of General::munfl will be suppressed during this calculation.”

Is there any way to solve this?

Thank you very much for your help

Posted on

## abstract algebra – In the case where ⊕ is involved as a composite system M1 ⊕ M2, what kind of equation does ⊕ denote?

I am reading about relations between equations using kronecker products as well as the use of ⊕ in situations such as M1 ⊕ M2, M ⊕ N, S ⊕ S, S⊕S⊕…n and others besides. In these papers they are called composite systems.

I understand that in a kronecker product a multiplication is performed on each element of the first matrix by every element in the second and it forms a block matrix of the two systems. Such as that Amxn ⊗ Bpxq is the matrix pm x nq. With situations such as a11 x b11, a11xb12, etc…

But what kind of equation is the followed out by the ⊕ symbol in the case of the above equations?

Posted on

## C++ Simple equation Parser – Code Review Stack Exchange

I am relatively new to C++ coming form languages such as Java and would like tips to make my code more C++ like and doing things in the C++ way.

``````#pragma once

#include <string>
#include <memory>

class Expression
{
public:
std::string symbol;
std::shared_ptr<Expression> left;
std::shared_ptr<Expression> right;

float eval();
static Expression parse(std::string s);

private:
Expression(std::string symbol, Expression *left, Expression *right);
static Expression parseRec(std::string s);
static float evalRec(const Expression &e);
};
``````

cpp file:

``````#include "Expression.hpp"
#include <unordered_map>

Expression::Expression(std::string symbol, Expression *left, Expression *right)
: symbol(symbol), left(left), right(right) {}

float Expression::eval()
{
return Expression::evalRec(*this);
}

float Expression::evalRec(const Expression &e)
{
switch (e.symbol(0))
{
case '+':
return evalRec(*e.left) + evalRec(*e.right);
case '-':
return evalRec(*e.left) - evalRec(*e.right);
case '*':
return evalRec(*e.left) * evalRec(*e.right);
case "https://codereview.stackexchange.com/":
return evalRec(*e.left) / evalRec(*e.right);
default:
return std::stoi(e.symbol);
}
}

Expression Expression::parse(std::string s)
{
//Remove whitespace
std::string output;
for (auto &i : s)
{
if (i != ' ')
output += i;
}
return parseRec(output);
}

Expression Expression::parseRec(std::string s)
{
const std::unordered_map<char, int> precedence = {{'+', 1}, {'-', 1}, {'*', 10}, {"https://codereview.stackexchange.com/", 10}};
int indexOfLowest = -1;
int i = 0;
for (auto &&j : s)
{
switch (j)
{
case '+':
case '-':
case '*':
case "https://codereview.stackexchange.com/":
if (indexOfLowest == -1)
indexOfLowest = i;
else if (precedence.at(j) <= precedence.at(s(indexOfLowest)))
indexOfLowest = i;
break;
default:
break;
}
i++;
}
if (indexOfLowest == -1)
{
return Expression(s, NULL, NULL);
}
else
{
return Expression(std::string(1, s(indexOfLowest)),
new Expression(parseRec(s.substr(0, indexOfLowest))),
new Expression(parseRec(s.substr(indexOfLowest + 1, s.length() - indexOfLowest - 1))));
}
}
``````

and a simple main:

``````#include <iostream>
#include "Expression.hpp"

int main(int argc, char const *argv())
{
//Parsed expression tree
Expression e = Expression::parse("5 + 10 * 2 + 6 / 3");
std::cout << e.eval() << std::endl;
return 0;
}
``````

Many thanks

Posted on

## fa.functional analysis – Solution set of integral equation/ Kernel of linear operator

I am interested in understanding the solutions $$phi$$ of the following integral equation: $$0=int_0^1 int_0^1 phi(x,y)(x-y)thinspace dxthinspace dy.$$ Equivalently, I am interested in understanding the kernel of the linear function $$F:C^k(mathbb{R}^2)tomathbb{R}$$ where $$F(phi)=int_0^1 int_0^1 phi(x,y)(x-y)thinspace dxthinspace dy$$. (The particular function space for the domain doesn’t matter especially much to me – I have been assuming that $$kgeq1$$, but if it is convenient to use a different domain, then that will work for my purposes as well.)

So far I know that any symmetric function is a solution, i.e. any $$phi$$ satisfying $$phi(x,y)=phi(y,x).$$ However, I also know that not every solution is symmetric, as illustrated by the solution $$phi(x,y)=x+y^2$$.

I also know that the kernel of $$F$$ is of codimension 1, and so its dimension is countably infinite.
My questions are:

1. Is it possible to give a concise description of the family of solutions to this equation?
2. Is it possible to explicitly find a basis for the kernel of $$F$$? I mean this in the sense of finding a countable collection of functions whose span is dense in the kernel.
3. More generally, in the (limited) literature I’ve read on integral equations, I have not seen sources which deal with integral equations of two variables. Could you point me to a source where I can learn more about equations of this type? My intuition is that this equation is of a simple enough form that it seems like somebody must have studied it before. Does anybody know of a source that discusses this equation?