1
$\begingroup$

I am trying to set an expression in Mathematica that uses an array. However it is problematic to typeset this expression and still be able to use it.

Here is my example:

data := {{8.2, 123.2}, {8.2, 123.2}, {8.22, 121.8}}
addata := {0.03, 0.3}
Fkt[c_, d_, e_] := Product[c[[dim]]* d[[dim]]* e[[dim]]], {dim, 1, 2}]
Fkt[data, data, addata]

Now I want to show the expression only in itself, e.g.:

$Fkt_{c,d, e} := \Pi_{dim=1}^2 c_{dim}*d_{dim}* e_{dim}$

However TraditionalForm does not do this. Can anyone give me a pointer in the right direction?

thanks

$\endgroup$
3
  • $\begingroup$ "TraditionalForm[] does not do this." - it can't. The expression's short; why not type it out yourself? (esc)prodt(esc) should generate a product expression whose blanks you can fill in... $\endgroup$ Jul 27, 2011 at 9:39
  • $\begingroup$ i have shortened the expression a lot already. and i want to use it to eye-proof the expression to make sure there are no mistakes there. You are saying that there is no way to do this in mathematica? $\endgroup$
    – tarrasch
    Jul 27, 2011 at 9:41
  • $\begingroup$ At least in the form you have produced, the only good way I'm aware of is TraditionalForm[HoldForm[Subscript[Fkt, c, d, e] := Product[Subscript[c, dim] Subscript[d, dim] Subscript[e, dim], {dim, 1, 2}]]] $\endgroup$ Jul 27, 2011 at 9:45

2 Answers 2

2
$\begingroup$

You can choose an option in the format->cell and cell->convert to as how to display your cells. Besides Shift+Ctrl+T gives the traditional form of a choosen fragment.

There is also Defer function, which prints the unevaluated form of an expression:

Defer[Product[c[[dim]]*d[[dim]]*e[[dim]], {dim, 1, 2}]]

gives

$\prod _{\dim =1}^2 c[[\dim ]] d[[\dim ]] e[[\dim ]]\ $.

$\endgroup$
5
  • $\begingroup$ Ah, Defer[]. Nice, I'm old-school and have no clue about these newfangled Mathematica functions... :) $\endgroup$ Jul 27, 2011 at 10:12
  • $\begingroup$ thats pretty, cool. It does not solve the problems with the whole array to subscript thing, but its a start. $\endgroup$
    – tarrasch
    Jul 27, 2011 at 10:25
  • $\begingroup$ Methematica does't regard array's elements as subscripts. If you want subscripts you have to put them directly as in the example of J.M. above. They can be inserted with Ctrl+_, say Fkt+(Ctrl+_)+c,d,e+(Ctrl+Space) for $Fkt_{c,d,e}$. $\endgroup$
    – Andrew
    Jul 27, 2011 at 11:17
  • $\begingroup$ In general, TraditionalForm[] stuff is unsuitable for computational purposes, @tarrasch. Why not be satisfied with StandardForm[]? $\endgroup$ Jul 27, 2011 at 12:37
  • $\begingroup$ its just that i want to be save. i have a mc-simulation that verifies my code. Yet i will communicate the equation only, not the code. So i want to make sure the equation corresponds to the code. is there a nonstandard package or sth that does this? $\endgroup$
    – tarrasch
    Jul 28, 2011 at 8:32
1
$\begingroup$

Perhaps you would like:

Definition[Fkt] // TraditionalForm

enter image description here

Also, if you would like to change the default TraditionalForm display, for example, displaying Part expressions as subscripts, you may use:

Unprotect[Part]
Format[Unevaluated@Part[a_, b_], TraditionalForm] := Subscript[a, b]

Now:

Definition[Fkt] // TraditionalForm

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .