When I input the function (A1[.2])Exp(t*plus[.2])+(A2[.2])Exp(t*minus[.2])
, where A1[x]
, plus[x]
, A2[x]
, and minus[x]
are predefined functions, I get an output of a plot with no function on it.
(Ideally, I'd be able to generalize this function so that the .2 could be replaced with a variable that has a slider and would update live on a graph, so any assistance with that would be great too)
I'm pretty new to Wolfram (picked it up today) so I'm not too sure what syntax errors there could be, but I assume it's an issue with syntax, since that's always the issue in similar problems on here.
In the code below, I do get the correct answers for A1[.2]
,A2[.2]
,plus[.2]
, and minus[.2]
, and when I actually plug these numbers in and input it in Wolfram Alpha, it comes out with the exact graph I'm looking for. However, on here, no dice.
Here is the code that I have:
{gr,kk,ma,po,ve} = {10,5,1,1,-1}
det[x_] := ((x*gr)^2-(4*kk/ma))^.5
plus[x_] := (-x*gr+det[x])/2
minus[x_] := (-x*gr-det[x])/2
xv = {{po},{ve}}
A1[b_] := Inverse[{{1,1},{plus[b],minus[b]}}][[1]].xv
A2[b_] := Inverse[{{1,1},{plus[b],minus[b]}}][[2]].xv
Plot[(A1[.2])Exp(t*plus[.2])+(A2[.2])Exp(t*minus[.2]),{t,0,5}]
The graph should look like a sine function that gets smaller and smaller in magnitude as t increases, but there is a plot shown and no function shown in the plot. This is what it should look like: