An archived instance of discourse for discussion in undergraduate PDE.

Question About Notation in Mathematica

qkhan

So when I was doing the sample final lab earlier today I thought I could do some shorthand just to save myself some typing but it didn't work out and I wanted to know why.

On Problem 1, under Fourier's solution the line of code that says:

Assumptions->Element[n, Integers]

I tried to put in

Assumptions-> n $\in \mathbb{Z}$

thinking they were equivalent but apparently not! When I did, my answers differed slightly. With Dr. McClure's code, I got the answer:
$$\frac{64[-1+(-1)^n]}{n^3\pi^3}$$

And with the shorthand, the answer is:
$$\frac{32[-2 + 2\cos(n \pi) + n \pi\sin(n \pi)]}{n^3 \pi^3}$$

I guess fundamentally they're the same answer because $n \pi\sin(n \pi)$ will always equal zero and $\cos(n \pi)$ does simplify down to $(-1)^n$ and I tried doing FullSimplify to see if it would reduce down further but it didn't. I was wondering if anybody knew why the shorthand doesn't work in this case?

Vince

I think that is because $\mathbb{Z}$ is just a symbol or character in Mathematica. More importantly it is not defined (likely shows up as a blue character in code). Thus when you call it, it is not referring to the integers.

Alternatively you could just define a variable as the integers like so and then just call it:

$\mathbb{Z}$ = Integers
 Assumptions->n $\in \mathbb{Z}$
qkhan

Oh okay, that makes a lot of sense! You're right, it's blue when it shows up in the code. I forget that just because I know $\mathbb{Z}$ is defined as the set of all integers doesn't mean that it's automatically designated that way in Mathematica. Thanks for clearing that up!

Vince

Cool, for some reason it didn't format properly (should have just worked) in that code snippet but I think its clear enough

clea

What does the Z stand for? I am not that familiar with mathematical terminology and was just curious. Also how do you produce that with mathematical code?

Vince

It is commonly used to denote the set of integer numbers. Only really helpful in this case for our Mathematica code to look 'nice' I think.

dwillia2

To make it in Mathematica there are three ways (that I am aware of). First are the palettes, just look around until you find it. Next you could type

\[DoubleStruckCapitalZ]

The best option:
You can also make it using what is called an alias. Hit escape, type "dsZ", hit escape again. I use this all the time. In case there is ever another symbol you'd be interested in making you can use the palettes and hover over the buttons to find all sorts of neat formatting things.

A few aliases I find particularly useful

int
dintt
sumt
dd
del2
el
p
clea

Yay! I did it, thanks @dwillia2!