In the script below gg(t) is the standard Gaussian function, and hh(u) is its Fourier transform. I am calculating the energy both in t and u domains and try to verify that wxmaxima (17.10.01) gives the same. When calculating the energy in u domain the magnitude is correct (the same as in 't', %o4) but the sign is negative (%o6), which is wrong. How can I avoid the error?
(%i1) gg(t):=1/(σ*sqrt(2*%pi))*exp(-(t-t_0)^2/(2*σ^2));
(%o1) gg(t):=1/(σ*sqrt(2*%pi))*exp((-(t-t_0)^2)/(2*σ^2))
(%i2) ee(t):=exp(-%i*2*%pi*u*t);
(%o2) ee(t):=exp((-%i)*2*%pi*u*t)
(%i3) hh:integrate(gg(t)*ee(t), t, -∞,∞);
"Is "σ" positive or negative?"p;
(hh) %e^(-2*%pi^2*u^2*σ^2-2*%i*%pi*t_0*u)
(%i4) integrate(abs(gg(t))^2, t, -∞,∞);
"Is "σ" positive or negative?"p;
(%o4) 1/(2*sqrt(%pi)*σ)
(%i6) kk:abs(hh)^2;
integrate(kk, u, -∞,∞);
(kk) %e^(-4*%pi^2*u^2*σ^2)
"Is "σ" zero or nonzero?"n;
(%o6) -1/(2*sqrt(%pi)*σ)
--> ;
Related
I'm trying to check if the increment from one number to the next is the same from the second to it's next and so on but found that it returns "false" when it should say "true". Here is what i found out after an hour of tinkering. Does anyone know why this happens and if it's possible to fix?
(%i1) kill(all)$;
(%i1) pointsx:[0.1,0.2,0.3,0.4,0.65,0.9]$;
(%i2) pointsx[2]-pointsx[1]; pointsx[3]-pointsx[2];
(%o2) 0.1
(%o3) 0.1
(%i4) is(pointsx[2]-pointsx[1]=pointsx[3]-pointsx[2]);
(%o4) false
(%i5) is(pointsx[2]-pointsx[1]>pointsx[3]-pointsx[2]);
(%o5) true
I want to understand how dependencies in Maxima for differentiation work
for iterated cases.
I tried here:
(%i1) depends([f],[x,y]);
(%o1) [f(x,y)]
(%i2) depends([g],[x,y]);
(%o2) [g(x,y)]
(%i3) depends([x,y],[ε]);
(%o3) [x(ε),y(ε)]
(%i4) diff(g,ε);
(%o4) (g[y])*(y[ε])+(g[x])*(x[ε])
(%i5) h(x,y):=f(x,y)+g(x,y);
(%o5) h(x,y):=f(x,y)+g(x,y)
(%i6) diff(h(x,y),ε);
(%o6) g(x,y)[ε]+f(x,y)[ε]
(%i7) diff(h,ε);
(%o7) 0
In (%o4) I get the total derivative with respect to \epsilon. Whereas in (%o6) the derivatives of x and y with respect to \epsilon are not shown. Why?
And can I make Maxima to show these derivatives in the result?
Dependencies declared by depends are only recognized for symbolic, undefined functions. The dependency is associated with the function name (a symbol).
A function with an actual definition, as defined by := or define, is not recognized. The body of the function could contain any combination of other functions, so the only way to know on which other functions the function depends is to evaluate the function body. That is what is happening when you write diff(h(x, y), ε).
Consider the following statements:
(%i1) matchdeclare([a,b], constantp);
(%o1) done
(%i2) defmatch(match, a*x+b);
(%o2) match
(%i3) match(2*x+3);
(%o3) [b = 3, a = 2]
I want to generalise this pattern in a function. But then it doesn't seem to work anymore:
(%i1) matchForm(test, form, constants) := block(
matchdeclare(constants, constantp),
defmatch(match, form),
match(test)
);
(%o1) matchForm(test, form, constants) :=
block(matchdeclare(constants, constantp), defmatch(match, form), match(test))
(%i2) test: 2*x+3;
(%o2) 2 x + 3
(%i3) form: a*x+b;
(%o3) a x + b
(%i4) constants: [a,b];
(%o4) [a, b]
(%i5) matchForm(test, form, constants);
defmatch: evaluation of atomic pattern yields: a x + b
(%o5) false
Debugging a bit, a bit it seems like the issue is that matchdeclare doesn't accept the argument to be a variable. Is ther any way to make a function like I try to make in maxima?
I haven't tried this, but: perhaps you can get the effect you want via
apply (matchdeclare, [constants, 'constantp]),
which will evaluate constants before calling matchdeclare.
The set of points closer to a given point than a given set, i.e.,
{x | ||x − x0|| ≤ ||x − y|| for all y ∈ S}
where S ⊆ R^n
It reminds me of an Euclidean ball, but I don't know how to proceed to check if it's convex or not.
( In this case it's the 2-norm used above ).
The link: https://see.stanford.edu/materials/lsocoee364a/hw1sol.pdf
2.7 provides the answer, where you prove that the set is a halfspace and thus the set is convex.
It is suitable in many series and polynomials to treat 0^0 as 1.
Unfortunately, Maxima think it is expt.
How to force?
Try this. Use tellsimp to define a different rule for the simplification of 0^0.
(%i1) display2d : false $
(%i2) simp : false $
(%i3) tellsimp (0^0, 1);
(%o3) [\^rule1,simpexpt]
(%i4) simp : true $
(%i5) 0^0;
(%o5) 1
(%i6) sum (k^k, k, 0, 5);
(%o6) 3414
Note that you must disable simplification (via simp:false$) before defining the rule, otherwise the default simplification (which triggers an error) is applied.