Skip to main content

Questions tagged [functions]

Questions about the use of built-in Mathematica functions, including pure functions.

1 vote
1 answer
101 views

How to optimize performance with DeleteDuplicates?

Does anyone know how to improve this for speed performance? The code works fine, but DeleteDuplicates makes it really slow for large lists. ...
internet's user avatar
  • 703
1 vote
2 answers
53 views

How can I change design a function $Modu$ such that $Modu[2k,2]$ to be zero?

I am dealing with some calculations of integer variables, so I want to define a function $Modu[x]= x \; mod \; 2$ such that $Modu[2x]=0$. If I directly use $Mod[2k,2]$, the output should still be $Mod[...
HiPanda's user avatar
  • 111
1 vote
2 answers
71 views

How to exclude singularities for `NMinimize`

I have an messy expression and want to apply NMinimize to it, have no idea how to force NMinimize to ignore the singularities it ...
seva011's user avatar
  • 336
-1 votes
2 answers
89 views

How to find the precise and correct range of a specific angle in a triangle given certain conditions?

In $\triangle$ABC, let angles A, B, and C be the three interior angles of the triangle, and given that $\frac{\sin B}{\sin A} = 2\sqrt{3} \sin C$, then the range of values for $B + \frac{\pi}{6}$ is _ ...
csn899's user avatar
  • 4,401
1 vote
2 answers
52 views

Find a parameter to return minimum of the function of several variables

I have two functions $f_1(n,x)$ and $f_2(n,x)$, and I want them to look similar on the given range $n\in[1,20]$. I can only vary the parameter $x$. In other words I have a function $F(n,x)=f_1(n,x)-...
seva011's user avatar
  • 336
2 votes
2 answers
83 views

Construct plot of $exp(1/z)$

I want to plot the function $f(z) = e^\frac{1}{z}$ in 3 forms: First to be a plot like [this][1]. But I want to show legend of both magnitude and imaginary part scales. Second to be a plot only with $\...
MathLearner's user avatar
3 votes
3 answers
218 views

Odd results from DSolve

When I try this DSolve command DSolve[{x'[t] == y[t] + 2 E^t, y'[t] == x[t] - 2 E^t}, {x, y}, t] I get this as the return I tried this on two different ...
Moo's user avatar
  • 3,388
0 votes
1 answer
41 views

Defining Objects using a Table or Loop

Suppose I want to define weight[] on a list. For instance I want weight[a]:=3, weight[b]:=5, etc. I tried to do this using the ...
VertexVexed's user avatar
5 votes
1 answer
291 views

What algorithm does Mathematica's `FindSequenceFunction` use, and can it be replicated in Python?

I am curious about the algorithm used by Mathematica's FindSequenceFunction to identify patterns in sequences. This function is powerful in finding closed-form ...
user avatar
6 votes
3 answers
237 views

Composition of vectorvalued functions

Suppose I have two functions $f,g:\mathbb{R}^2 \to \mathbb{R}^2$ and that I want to compute $g(f(x,y))$. As an example, let's take $f(x,y)=(x+y, x-y)$ and $g(x,y)=(y^2,x^2)$. Then, $g(f(1,2))=(1,9)$. ...
user2978125's user avatar
0 votes
0 answers
49 views

Function returning error every other run

Disclaimer: I am new to Mathematica but have some experience with other programming languages. I have defined the following function (simplified version): ...
Leksa99's user avatar
5 votes
2 answers
221 views

Blurry shadows of 3D plots and objects

I am using a shadow function, planarShadow, as shared by Prof. Jens Nöckel on Shadows of 3D plots and objects This function works perfectly while making sharp ...
user444's user avatar
  • 2,644
1 vote
1 answer
110 views

Does Mathematica have a function which yields the degree of a polynomial with respect to one variable? [closed]

Since Mathematica seems not to have a function yielding the degree of a polynomial with respect to one variable, I wrote one: ...
florin's user avatar
  • 1,852
0 votes
0 answers
54 views

Pattern matching for a repeated pattern (but different matching elements)

Is there a nice syntax for a pattern that is repeated (but it should match when the matching elements are different). I mean something like ...
Kvothe's user avatar
  • 4,591
2 votes
1 answer
66 views

Why does the gather not seem to work?

Why isn't {4, 6} include in the first group? I expected the result would be {{{1, 9}, {2, 3}, {4, 6},{5, 10}}, {{11, 15}}} ...
internet's user avatar
  • 703

15 30 50 per page
1
2 3 4 5
255