Message Boards Message Boards

0
|
2994 Views
|
5 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Operations with lists

Posted 2 years ago

Hello Community. I am running an automated Mathematica code which includes the following as inputs.

vars = Input["Please input variables in a list form"]
list = Input["Please input a basis in a list form"]
paramList = Input["Please input parameters in a list form"]

When I run the code, it calls vars (1st input) and I will type {t, x, u}, then click "OK". Then it calls list (2nd input) and I will type

{X1 = {1, 0, 0},
X2 = {0, 0, u},
X3 = {0, (E^(Kt) S^2)/(2 K),  E^(Kt) u (l1 + x)},
X4 = {0, E^(-Kt), -((E^(-Kt) u)/K)}, 
X5 = {-((  E^(2 Kt) S^2)/(2 K^2)), E^(2 Kt) (l2 - (x S^2)/(2 K)),  E^(2 Kt) u (l3 + l4 x - x^2)},
X6 = {-E^(-2 Kt), E^(-2 Kt) (l5 + K x), -E^(-2 Kt) u (x + S^2/(2 K^2))},

then click "OK". Then it calls paramList (3rd input), a list of parameters, and I will type {K, S, T} and click "OK". However, l1, l2, .... l5 is part of the third input, is not defined , so the code gives false outputs since l1, l2, .... l5 is not recognized.

Note: l1 = S^2/(2 K^2 - T); l2 = (S^2 (K^2 T - S^2))/(2 K^3); l3 = S^2/(2 K - l1^2); l4 = (4 K^2 T - 3 S^2)/(2 K^2); l5 = (S^2 - K^2 T)/ K;

How do I include l1, l2, .... l5 as part of 3rd input (which is a string) when I run the code ?

Ps: let me know if more information is required for a better answer.

POSTED BY: Nomsa Ledwaba
5 Replies
Posted 2 years ago

The code in the question is not formatted as code so the \ preceding the greek characters is missing. Suggest you provide a simpler example without greek characters and explain what you mean by

The challenge: When typing the list how does one include the following as part of the inputs?

What inputs?

POSTED BY: Rohit Namjoshi
Posted 2 years ago

I have edited and used simple letters instead of Greek letters.

POSTED BY: Nomsa Ledwaba
Posted 2 years ago

The inputs to my generic code are vars, list and paramList.

POSTED BY: Nomsa Ledwaba
Posted 2 years ago

Still not clear what you are trying to do. This is not clear

Note that if my code was not generic I would have defined l1, l2, .... l5 on the code so that whenever I type the inputs, they are recognized. When typing the list (input) how does one include l1, l2, .... l5 as part of the inputs for list in the case whereby a code is generic?

What do you mean by "they are recognized", and "When typing the list (input) how does one include l1, l2, .... l5 as part of the inputs for list"?

What result are you expecting after entering the 3 lists?

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Ps: I have edited my question. How do I input a list with unknowns in Mathematica essentially? My code calls for 3 inputs as I mentioned earlier as stated. There's an input with unknowns l1,l2, l3,..., l6.

POSTED BY: Nomsa Ledwaba
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract