How do I treat the results of Fit as text?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I would like to take the results of Fit
(or any FittedModel
) and treat them as text, including making substitutions for the variables. But I can't figure out how to do this.
For example
"Subscript[I, m]/Subscript[I, r]" <> " = " <> ToString[Fit[currentRatio[32],1,x,x^2,x^3,x]/.x->"Subscript[I, r]"]
produces the garbled output
Subscript[I, m]/Subscript[I, r] = -6 2 -10 3
0.591585 + 0.00126235 I - 1.75804 10 I + 8.08979 10 I
r r r
How do I treat the results of Fit
or FittedModel
as text?
fitting text
add a comment |Â
up vote
4
down vote
favorite
I would like to take the results of Fit
(or any FittedModel
) and treat them as text, including making substitutions for the variables. But I can't figure out how to do this.
For example
"Subscript[I, m]/Subscript[I, r]" <> " = " <> ToString[Fit[currentRatio[32],1,x,x^2,x^3,x]/.x->"Subscript[I, r]"]
produces the garbled output
Subscript[I, m]/Subscript[I, r] = -6 2 -10 3
0.591585 + 0.00126235 I - 1.75804 10 I + 8.08979 10 I
r r r
How do I treat the results of Fit
or FittedModel
as text?
fitting text
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I would like to take the results of Fit
(or any FittedModel
) and treat them as text, including making substitutions for the variables. But I can't figure out how to do this.
For example
"Subscript[I, m]/Subscript[I, r]" <> " = " <> ToString[Fit[currentRatio[32],1,x,x^2,x^3,x]/.x->"Subscript[I, r]"]
produces the garbled output
Subscript[I, m]/Subscript[I, r] = -6 2 -10 3
0.591585 + 0.00126235 I - 1.75804 10 I + 8.08979 10 I
r r r
How do I treat the results of Fit
or FittedModel
as text?
fitting text
I would like to take the results of Fit
(or any FittedModel
) and treat them as text, including making substitutions for the variables. But I can't figure out how to do this.
For example
"Subscript[I, m]/Subscript[I, r]" <> " = " <> ToString[Fit[currentRatio[32],1,x,x^2,x^3,x]/.x->"Subscript[I, r]"]
produces the garbled output
Subscript[I, m]/Subscript[I, r] = -6 2 -10 3
0.591585 + 0.00126235 I - 1.75804 10 I + 8.08979 10 I
r r r
How do I treat the results of Fit
or FittedModel
as text?
fitting text
fitting text
edited yesterday
m_goldberg
82.6k869190
82.6k869190
asked yesterday
orome
5,85523680
5,85523680
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
"Subscript[I, m]/Subscript[I, r]" <> " = " <>
ToString[Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> "Subscript[I, r]", StandardForm]
With InputForm
inplace of StandardForm
we get
"Subscript[I, m]/Subscript[I, r] = 0. +
0.9999999999999991*"Subscript[I, r]" +
2.511131286529154*^-15*"Subscript[I, r]"^2 +
0.9999999999999988*"Subscript[I, r]"^3"
Note: ToString >> Details and Options:
ToString
supports the same set of options asOpenAppend
, with default settingsFormatType->OutputForm
,PageWidth->Infinity
,TotalWidth->Infinity
.
ToString[x^2]
ToString[x^2, StandardForm]
ToString[x^2, InputForm]
add a comment |Â
up vote
5
down vote
Just use Row:
Row[
Subscript[I, m]/Subscript[I, r] ,
" = ",
Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> Subscript[I, r]
]
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
"Subscript[I, m]/Subscript[I, r]" <> " = " <>
ToString[Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> "Subscript[I, r]", StandardForm]
With InputForm
inplace of StandardForm
we get
"Subscript[I, m]/Subscript[I, r] = 0. +
0.9999999999999991*"Subscript[I, r]" +
2.511131286529154*^-15*"Subscript[I, r]"^2 +
0.9999999999999988*"Subscript[I, r]"^3"
Note: ToString >> Details and Options:
ToString
supports the same set of options asOpenAppend
, with default settingsFormatType->OutputForm
,PageWidth->Infinity
,TotalWidth->Infinity
.
ToString[x^2]
ToString[x^2, StandardForm]
ToString[x^2, InputForm]
add a comment |Â
up vote
4
down vote
accepted
"Subscript[I, m]/Subscript[I, r]" <> " = " <>
ToString[Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> "Subscript[I, r]", StandardForm]
With InputForm
inplace of StandardForm
we get
"Subscript[I, m]/Subscript[I, r] = 0. +
0.9999999999999991*"Subscript[I, r]" +
2.511131286529154*^-15*"Subscript[I, r]"^2 +
0.9999999999999988*"Subscript[I, r]"^3"
Note: ToString >> Details and Options:
ToString
supports the same set of options asOpenAppend
, with default settingsFormatType->OutputForm
,PageWidth->Infinity
,TotalWidth->Infinity
.
ToString[x^2]
ToString[x^2, StandardForm]
ToString[x^2, InputForm]
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
"Subscript[I, m]/Subscript[I, r]" <> " = " <>
ToString[Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> "Subscript[I, r]", StandardForm]
With InputForm
inplace of StandardForm
we get
"Subscript[I, m]/Subscript[I, r] = 0. +
0.9999999999999991*"Subscript[I, r]" +
2.511131286529154*^-15*"Subscript[I, r]"^2 +
0.9999999999999988*"Subscript[I, r]"^3"
Note: ToString >> Details and Options:
ToString
supports the same set of options asOpenAppend
, with default settingsFormatType->OutputForm
,PageWidth->Infinity
,TotalWidth->Infinity
.
ToString[x^2]
ToString[x^2, StandardForm]
ToString[x^2, InputForm]
"Subscript[I, m]/Subscript[I, r]" <> " = " <>
ToString[Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> "Subscript[I, r]", StandardForm]
With InputForm
inplace of StandardForm
we get
"Subscript[I, m]/Subscript[I, r] = 0. +
0.9999999999999991*"Subscript[I, r]" +
2.511131286529154*^-15*"Subscript[I, r]"^2 +
0.9999999999999988*"Subscript[I, r]"^3"
Note: ToString >> Details and Options:
ToString
supports the same set of options asOpenAppend
, with default settingsFormatType->OutputForm
,PageWidth->Infinity
,TotalWidth->Infinity
.
ToString[x^2]
ToString[x^2, StandardForm]
ToString[x^2, InputForm]
edited yesterday
answered yesterday
kglr
164k8188388
164k8188388
add a comment |Â
add a comment |Â
up vote
5
down vote
Just use Row:
Row[
Subscript[I, m]/Subscript[I, r] ,
" = ",
Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> Subscript[I, r]
]
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
add a comment |Â
up vote
5
down vote
Just use Row:
Row[
Subscript[I, m]/Subscript[I, r] ,
" = ",
Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> Subscript[I, r]
]
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Just use Row:
Row[
Subscript[I, m]/Subscript[I, r] ,
" = ",
Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> Subscript[I, r]
]
Just use Row:
Row[
Subscript[I, m]/Subscript[I, r] ,
" = ",
Fit[Table[x, x + x^3, x, 0, 1, .1], 1, x, x^2, x^3, x] /.
x -> Subscript[I, r]
]
edited yesterday
m_goldberg
82.6k869190
82.6k869190
answered yesterday
Ulrich Neumann
5,080413
5,080413
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
add a comment |Â
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
If I try to join that with a string as in the OP I get the same error: "StringJoin::string: String expected at position 2 in...".
â orome
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
With Row[...] you can combine strings and Style-objects!
â Ulrich Neumann
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
It never fails that no matter what I'm trying to do, I eventually reach the point where I kick myself and ask: Why didn't I just do this in Python!
â orome
yesterday
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183303%2fhow-do-i-treat-the-results-of-fit-as-text%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password