Tag Info

New answers tagged

1

Using Piecewise is a good choice. gradePoint[grade_] := With[{g = Ceiling[grade]}, Piecewise[{{4., g >= 80}, {3.75, g >= 75}, {3.5, g >= 70}, {3.25, g >= 65}, {3., g >= 60}, {2.75, g >= 55}, {2.5, g >= 50}, {2.25, g >= 45}, {2., g >= 40}}, 0]]; You may check whether the function works perfectly. ...


1

You can use TableForm to set up the table. row1 = {"GP", 0, 2., 2.25, 2.5, 2.75, 3.0, 3.25, 3.75, 4.}; row2 = {"Marks", "0-39", "40-44", "45-49", "50-54", "55-59", "60-64", "65-69", "70-74", "75-79", "80-100"}; {row2, row1} // TableForm It wasn't clear to me what you want to do with this data, but you can get the mean of the GPs with ...


7

TableForm[ Table[{NumberForm[t, {Infinity, 1}], NumberForm[f[t], {Infinity, 1}], NumberForm[g[t], {Infinity, 3}]}, {t, 0, 2, .5}], TableHeadings -> {{}, {t, x, y}}, TableAlignments -> "."]


6

SetPrecision[tab, 7] // TableForm


0

Try increasing the PrintPrecision. This works on V 10.01, windows 7 tab = {{0.9420076, 0.9979831}, {0.6985363, 0.9860302}, {0.3964154, 0.9523944}, {0.4683808, 0.9640774}, {0.3644067, 0.9458417}, {0.2378723, 0.9048291}, {0.2726637, 0.9194800}, {0.1667687, 0.8590895}}; SetOptions[$FrontEndSession, PrintPrecision ->7] TableForm[tab]


4

There are a lot of syntax errors and general messiness in this code. My proxy server won't let me download FinancialData at the moment, so I can't test this completely, but several things you should note: intermediate variables should localised using Module. syntax error: y = Take[ema {2}] should be y = Take[ema, {2}] or just ema[[2]]. ...


1

since this has popped up as unanswered, one approach to this if you really want to use floating values as "indices" is to save up the "index" values and use them directly as iterators: dbvals = Table[ dBx , {dBx, .1, .5, .05} ] ; bzvals = Table[ Bz , {Bz, .4, 1.5, .1} ] ; Do[data[dBx, Bz] = {x, f[dBx, Bz]}, {dBx, dbvals}, {Bz, bzvals}] ListDensityPlot[ ...


2

L = StringSplit["I want to create a matrix by laying"] {"I", "want", "to", "create", "a", "matrix", "by", "laying"} Outer[f, L, L] // TableForm


0

Mapping Hold or HoldForm over all the elements effectively freezes the expression for easier manipulation. (This method was used in R. Maeder's Programming in Mathematica, page 137.) x = 12.; Replace[Map[HoldForm, Defer[Sin[x]^2 + Cos[x]^2], Infinity] , HoldForm[x] -> HoldForm[12]] == Sin[x]^2 + Cos[x]^2 Sin[12]^2+Cos[12]^2==1. And in a table: ...


1

Your can use Replace* inside Hold or Deffer like this: x = 12; test = Defer[Sin[x]^2 + Cos[x]^2] == Sin[x]^2 + Cos[x]^2 Sin[x]^2 + Cos[x]^2 == 1. Block[{x}, test /. x -> y] /. y -> x Sin[12.]^2 + Cos[12.]^2 == 1. Just idea, no doubt better approach can be found.


1

There are a number of errors in your code, so hopefully going through them one by one will help you in your task. First, I'll define numbers to insert into the matrices: h[k_, l_] := k Sin[l]; g[i_, k_, l_] := 10/(1 + i^2 + k^2 + l^2) + RandomReal[]; f[i_, l_] := i l; x[l_] := 1; M = 10; n = 4; The first line of code, H = Table[H[k, l], {k, 2 M}, {l, 2 ...



Top 50 recent answers are included