I have struggled with differentiator opam operation From the formula: Vout = -RC.dVin/dt For the input signal is square wave(or triangle wave), when Vin increases, the dVin/dt should be positive, therefore Vout should be negative, but when i simulated the differentiator on Circuit Maker, it show the plot as in the picture (when Vin increases, Vout is positive). Anyone explain this to me ?
The "in phase" relates only to sinusoidal quantities (e.g. your last row of pictures). For anything else, it's just that, a derivative, plus an RC time constant, where the case need be.
For your 1st example, the derivative of a square wave (the first half, for now) is a pulse with the value and with the duration of the slope. If the square wave is ideal, the slope is infinite, therefore the pulse is infinite -- no such thing in nature. So, the response for an actual RC differentiator to a finite slope square wave will be the voltage at the input, and then, since the square wave has reached the amplitude and it stays flat, and the derivative of a constant is zero, the output tends to go to zero, but the capacitor is still charged, so it will discharge, creating the pulse you see. If the differentiator would have been an active one (opamp), the derivative would have been a pulse with the width of the slope, and its amplitude formed by the time constant multiplied by the dV/dt.
Since the picture you show is a bit oversimplified, here are two examples of a passive and an ideal, active RC differentiator, with a \$\tau\$=0.1ms, in response to a step input with a finite slope of 1V/\$\mu\$s. The passive one:
and the active one (note the amplitude and the duration):
For the second case, you have a signal that is formed by two ramps, a positive and a negative one. The derivative of a ramp is a constant, so you get alternating positive and negative constants, or a square wave.
For none of the cases above you can talk about a phase, since the waveforms are a sum of sine and cosine waves (see this). But in the third case, it's simply the derivative of sin(x), or cos(x). Here you are dealing with harmonic waveforms, so it's safe to talk about the phase. As it happens, for the differentiator, the phase is 90o.
Also, the output is only negative, -RC*dV/dt, if you're inverting it, as in the case of an opamp.